Skip to content
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

Merged
merged 5 commits into from
Jul 25, 2023

Conversation

dmathieu
Copy link
Member

Closes #44.

@dmathieu dmathieu requested a review from a team as a code owner July 20, 2023 09:24
@simitt
Copy link
Contributor

simitt commented Jul 20, 2023

@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.

@felixbarny
Copy link
Member

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

Copy link
Member

@axw axw left a 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.

model/modelpb/apmevent.pb.json.go Show resolved Hide resolved
Copy link
Member

@axw axw left a 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

@@ -65,6 +65,7 @@ func (e *APMEvent) MarshalFastJSON(w *fastjson.Writer) error {
}

if e.DataStream != nil {
doc.DataStream = &modeljson.DataStream{}
Copy link
Member

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
    ...
}

@dmathieu dmathieu enabled auto-merge (squash) July 25, 2023 11:59
@dmathieu dmathieu merged commit 4939b2f into elastic:main Jul 25, 2023
2 checks passed
@dmathieu dmathieu deleted the data-stream-object branch July 25, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use object notation for data_stream fields
4 participants