Skip to content

[enrichments] Add support for inferred spans - #116

Merged
lahsivjar merged 2 commits into
elastic:mainfrom
lahsivjar:inferred-spans
Oct 29, 2024
Merged

[enrichments] Add support for inferred spans#116
lahsivjar merged 2 commits into
elastic:mainfrom
lahsivjar:inferred-spans

Conversation

@lahsivjar

Copy link
Copy Markdown
Contributor

Adds support for inferred spans, check agent specs for more details.

@lahsivjar
lahsivjar requested a review from a team as a code owner October 28, 2024 12:19
@lahsivjar
lahsivjar requested a review from JonasKunz October 28, 2024 12:19
spanLink.Attributes().RemoveIf(func(k string, v pcommon.Value) bool {
switch k {
case "is_child", "elastic.is_child":
if v.Bool() && !spanID.IsEmpty() {

@lahsivjar lahsivjar Oct 28, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[For reviewers] In APM data we add an empty string in the slice if span ID is empty (ref), however, I didn't think it was important so didn't handle it here. Let me know if it needs to be added.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was not intentionally done in apm-data for that code path. I don't think span links are allowed to have an empty span ID in OTLP?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think span links are allowed to have an empty span ID in OTLP?

I am not sure about this, I kept the span ID check for now, let me know if you think we should remove this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In APM data we add an empty string in the slice if span ID is empty (ref), however, I didn't think it was important so didn't handle it here

Just wanted to agree with you here. I'd keep the span ID check as is just as a safety measure.

spanLink.Attributes().RemoveIf(func(k string, v pcommon.Value) bool {
switch k {
case "is_child", "elastic.is_child":
if v.Bool() && !spanID.IsEmpty() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was not intentionally done in apm-data for that code path. I don't think span links are allowed to have an empty span ID in OTLP?

Comment thread enrichments/trace/internal/elastic/span.go Outdated
@lahsivjar
lahsivjar requested a review from a team as a code owner October 28, 2024 16:16
@lahsivjar
lahsivjar requested a review from JonasKunz October 28, 2024 16:19
Comment on lines +375 to +378
if tc.expectedSpanLinks != nil {
tc.expectedSpanLinks.CopyTo(expectedSpan.Links())
} else {
expectedSpan.Links().RemoveIf(func(_ ptrace.SpanLink) bool { return true })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[For reviewers] This piece is a bit weird because CopyTo doesn't handle non initialized empty span links.

@JonasKunz JonasKunz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lahsivjar
lahsivjar merged commit 77d76ae into elastic:main Oct 29, 2024
@lahsivjar
lahsivjar deleted the inferred-spans branch October 29, 2024 15:09
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.

2 participants