-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[exporters/datadog]: improve datadog_add_span_events #9997
Conversation
|
@gbbr (or someone else from APM) to review |
// single: converts all the events to a single json object | ||
// multi: converts each span event to a separate tag. | ||
// The default value is `single` | ||
SpanEventsAsTags string `mapstructure:"span_events_as_tags"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a string, let's create a new type alias like we do here:
opentelemetry-collector-contrib/exporter/datadogexporter/config/config.go
Lines 140 to 166 in 7aac4a9
// CumulativeMonotonicSumMode is the export mode for OTLP Sum metrics. | |
type CumulativeMonotonicSumMode string | |
const ( | |
// CumulativeMonotonicSumModeToDelta calculates delta for | |
// cumulative monotonic sum metrics in the client side and reports | |
// them as Datadog counts. | |
CumulativeMonotonicSumModeToDelta CumulativeMonotonicSumMode = "to_delta" | |
// CumulativeMonotonicSumModeRawValue reports the raw value for | |
// cumulative monotonic sum metrics as a Datadog gauge. | |
CumulativeMonotonicSumModeRawValue CumulativeMonotonicSumMode = "raw_value" | |
) | |
var _ encoding.TextUnmarshaler = (*CumulativeMonotonicSumMode)(nil) | |
// UnmarshalText implements the encoding.TextUnmarshaler interface. | |
func (sm *CumulativeMonotonicSumMode) UnmarshalText(in []byte) error { | |
switch mode := CumulativeMonotonicSumMode(in); mode { | |
case CumulativeMonotonicSumModeToDelta, | |
CumulativeMonotonicSumModeRawValue: | |
*sm = mode | |
return nil | |
default: | |
return fmt.Errorf("invalid cumulative monotonic sum mode %q", mode) | |
} | |
} |
Also, wondering if we should have this on a traces::span_events
section, and call it... tags_mapping
?
// get events as just a general tag | ||
if s.Events().Len() > 0 { | ||
tags[eventsTag] = eventsToString(s.Events()) | ||
if eventsLen := s.Events().Len(); eventsLen > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we are in the process of moving part of the code to the Datadog Agent (see #9693, pending stability of the pdata
module) so it may take a little until this is mergeable
I'll just leave a note here saying that we'll soon be looking into a better way to handle OpenTelemetry APM events at Datadog. Until then, I'd suggest not changing this to avoid breaking users even more Lastly, indeed #9693 changes the code significantly to using what's in the Datadog Agent, but ultimately it should work out as the same behaviour. If we do decide to make this change, it should be made over there. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
This is an Enhancement to the #2338.
Basically the current translation from open telemetry span events to span tags creates a big json string which really hard to read. Since datadog pretty the tags which are segmented with dots in the tag's name i suggested to have separate tags per event. Also for backward compatibility created a new config for it.