-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add span processor configuration (#8117)
This PR adds support for configuring batch span processor for internal collector traces. It adds support to export them via the stdout exporter. Linked issue #8106 Follows #8097 Signed-off-by: Alex Boten <[email protected]>
- Loading branch information
Alex Boten
authored
Jul 21, 2023
1 parent
5f11443
commit 5613523
Showing
12 changed files
with
300 additions
and
7 deletions.
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,19 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: service | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Add support for span processor configuration for internal traces | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [8106] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | | ||
These options are still experimental. To enable them, users must enable both | ||
`telemetry.useOtelForInternalMetrics` and `telemetry.useOtelWithSDKConfigurationForInternalTelemetry` | ||
feature gates. |
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -120,6 +120,9 @@ type TracesConfig struct { | |
// tracecontext and b3 are supported. By default, the value is set to empty list and | ||
// context propagation is disabled. | ||
Propagators []string `mapstructure:"propagators"` | ||
// Processors allow configuration of span processors to emit spans to | ||
// any number of suported backends. | ||
Processors []SpanProcessor `mapstructure:"processors"` | ||
} | ||
|
||
// Validate checks whether the current configuration is valid | ||
|
@@ -132,6 +135,29 @@ func (c *Config) Validate() error { | |
return nil | ||
} | ||
|
||
func (sp *SpanProcessor) Unmarshal(conf *confmap.Conf) error { | ||
if !obsreportconfig.UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate.IsEnabled() { | ||
// only unmarshal if feature gate is enabled | ||
return nil | ||
} | ||
|
||
if conf == nil { | ||
return nil | ||
} | ||
|
||
if err := conf.Unmarshal(sp); err != nil { | ||
return fmt.Errorf("invalid span processor configuration: %w", err) | ||
} | ||
|
||
if sp.Batch != nil { | ||
if sp.Batch.Exporter.Console == nil { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bogdandrutu
Member
|
||
return fmt.Errorf("invalid exporter configuration") | ||
} | ||
return nil | ||
} | ||
return fmt.Errorf("unsupported span processor type %s", conf.AllKeys()) | ||
} | ||
|
||
func (mr *MetricReader) Unmarshal(conf *confmap.Conf) error { | ||
if !obsreportconfig.UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate.IsEnabled() { | ||
// only unmarshal if feature gate is enabled | ||
|
Oops, something went wrong.
This sound more like a
Validate
concern and not anUnmarshal
. The rule of thumb that I use in general (maybe good to document somewhere) is:Validate
.