mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-18 03:22:12 +02:00
Remove the WithDisabled option from Jaeger exporter (#1806)
* Remove the WithDisabled option from Jaeger exporter * Update PR number
This commit is contained in:
parent
6867faa096
commit
1b9f16d3af
@ -91,6 +91,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
- The `trace.FlagsDebug` and `trace.FlagsDeferred` constants have been removed and will be localized to the B3 propagator. (#1770)
|
- The `trace.FlagsDebug` and `trace.FlagsDeferred` constants have been removed and will be localized to the B3 propagator. (#1770)
|
||||||
- Remove `Process` configuration, `WithProcessFromEnv` and `ProcessFromEnv`, and type from the Jaeger exporter package.
|
- Remove `Process` configuration, `WithProcessFromEnv` and `ProcessFromEnv`, and type from the Jaeger exporter package.
|
||||||
The information that could be configured in the `Process` struct should be configured in a `Resource` instead. (#1776, #1804)
|
The information that could be configured in the `Process` struct should be configured in a `Resource` instead. (#1776, #1804)
|
||||||
|
- Remove the `WithDisabled` option from the Jaeger exporter.
|
||||||
|
To disable the exporter unregister it from the `TracerProvider` or use a no-operation `TracerProvider`. (#1806)
|
||||||
|
|
||||||
## [0.19.0] - 2021-03-18
|
## [0.19.0] - 2021-03-18
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@ type options struct {
|
|||||||
|
|
||||||
// TracerProviderOptions defines the options for tracer provider of sdk.
|
// TracerProviderOptions defines the options for tracer provider of sdk.
|
||||||
TracerProviderOptions []sdktrace.TracerProviderOption
|
TracerProviderOptions []sdktrace.TracerProviderOption
|
||||||
|
|
||||||
Disabled bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithBufferMaxCount defines the total number of traces that can be buffered in memory
|
// WithBufferMaxCount defines the total number of traces that can be buffered in memory
|
||||||
@ -81,18 +79,8 @@ func WithSDKOptions(opts ...sdktrace.TracerProviderOption) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithDisabled option will cause pipeline methods to use
|
|
||||||
// a no-op provider
|
|
||||||
func WithDisabled(disabled bool) Option {
|
|
||||||
return func(o *options) {
|
|
||||||
o.Disabled = disabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRawExporter returns an OTel Exporter implementation that exports the
|
// NewRawExporter returns an OTel Exporter implementation that exports the
|
||||||
// collected spans to Jaeger.
|
// collected spans to Jaeger.
|
||||||
//
|
|
||||||
// It will IGNORE Disabled option.
|
|
||||||
func NewRawExporter(endpointOption EndpointOption, opts ...Option) (*Exporter, error) {
|
func NewRawExporter(endpointOption EndpointOption, opts ...Option) (*Exporter, error) {
|
||||||
uploader, err := endpointOption()
|
uploader, err := endpointOption()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -149,9 +137,6 @@ func NewExportPipeline(endpointOption EndpointOption, opts ...Option) (trace.Tra
|
|||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(&o)
|
opt(&o)
|
||||||
}
|
}
|
||||||
if o.Disabled {
|
|
||||||
return trace.NewNoopTracerProvider(), func() {}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
exporter, err := NewRawExporter(endpointOption, opts...)
|
exporter, err := NewRawExporter(endpointOption, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -62,14 +62,6 @@ func TestInstallNewPipeline(t *testing.T) {
|
|||||||
endpoint: WithAgentEndpoint(),
|
endpoint: WithAgentEndpoint(),
|
||||||
expectedProvider: &sdktrace.TracerProvider{},
|
expectedProvider: &sdktrace.TracerProvider{},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "with disabled",
|
|
||||||
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
|
||||||
options: []Option{
|
|
||||||
WithDisabled(true),
|
|
||||||
},
|
|
||||||
expectedProvider: trace.NewNoopTracerProvider(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
@ -101,14 +93,6 @@ func TestNewExportPipeline(t *testing.T) {
|
|||||||
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
||||||
expectedProviderType: &sdktrace.TracerProvider{},
|
expectedProviderType: &sdktrace.TracerProvider{},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "with disabled",
|
|
||||||
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
|
||||||
options: []Option{
|
|
||||||
WithDisabled(true),
|
|
||||||
},
|
|
||||||
expectedProviderType: trace.NewNoopTracerProvider(),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "always on",
|
name: "always on",
|
||||||
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
endpoint: WithCollectorEndpoint(collectorEndpoint),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user