-
Notifications
You must be signed in to change notification settings - Fork 26
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
Switch data_stream to object notation #124
Conversation
b6e2dd5
to
2173f24
Compare
@axw @felixbarny any objections to changing this? While not necessary anymore for the reroute processor (as @felixbarny explained on the issue), it would also solve the problem described in elastic/apm-server#10643. |
I don't have objections to change to object notation. However, I think both Logstash and ingest pipelines should provide more built-in support for dotted field names. This will become more important as we and our users are adopting OpenTelemetry more because OTel attributes are all just a flat key/value map. See also elastic/elasticsearch#96648 |
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.
I'm fine with this change. Agree with @felixbarny, ideally Logstash and Elasticsearch wouldn't care, but in the mean time we can fix user issues this way.
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.
LGTM, with one suggestion
model/modelpb/apmevent.pb.json.go
Outdated
@@ -65,6 +65,7 @@ func (e *APMEvent) MarshalFastJSON(w *fastjson.Writer) error { | |||
} | |||
|
|||
if e.DataStream != nil { | |||
doc.DataStream = &modeljson.DataStream{} |
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.
I think if we declare the zero value struct above the if
block, and only take a pointer to it in this block, then we can avoid an allocation. i.e.
var dataStream modeljson.DataStream
if e.DataStream != nil {
doc.DataStream = &dataStream
...
}
Closes #44.