Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[config] prepare package for release
This PR does the following: - adds a section to versions.yaml, please review that the new section makes sense, it didn't seem to fit in any of the other groups. - adds doc.go - adds example Signed-off-by: Alex Boten <aboten@lightstep.com>
- Loading branch information
Alex Boten
committed
Nov 9, 2023
1 parent
fe68fe9
commit 3e4eee5
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package config can be used to parse a configuration file | ||
// that follows the JSON Schema defined by the OpenTelemetry | ||
// Configuration schema. | ||
package config // import "go.opentelemetry.io/contrib/config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package config_test | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/contrib/config" | ||
"go.opentelemetry.io/otel" | ||
) | ||
|
||
func ExampleNewSDK() { | ||
// NewSDK returns a configured SDK as configured | ||
// per the options and any error that occurred during | ||
// the initialization process. | ||
configuredSDK, err := config.NewSDK( | ||
config.WithContext(context.Background()), | ||
config.WithOpenTelemetryConfiguration(config.OpenTelemetryConfiguration{ | ||
TracerProvider: &config.TracerProvider{}, | ||
MeterProvider: &config.MeterProvider{}, | ||
}), | ||
) | ||
|
||
if err != nil { | ||
// Handle error appropriately. | ||
panic(err) | ||
} | ||
|
||
// This SDK can then be used to get a TracerProvider and | ||
// MeterProvider | ||
otel.SetTracerProvider(configuredSDK.TracerProvider()) | ||
otel.SetMeterProvider(configuredSDK.MeterProvider()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters