Skip to content

Conversation

@lahsivjar
Copy link
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() {
Copy link
Contributor Author

@lahsivjar lahsivjar Oct 28, 2024

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.

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

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() {

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?

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

Copy link

@JonasKunz JonasKunz left a comment

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
3 checks passed
@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