Skip to content

[pdatatest] Ignore span attribute value #27689

Closed
@atoulme

Description

@atoulme

Component(s)

pkg/pdatatest

Is your feature request related to a problem? Please describe.

We compare spans which have unique attribute values (such as UUIDs). This creates issues when comparing two sets of spans.

Describe the solution you'd like

We want to ignore a specific span attribute value during comparison.

Describe alternatives you've considered

We use this code for now:

func ignoreSpanAttribute(attributeName string, traces ptrace.Traces) {
	for i := 0; i < traces.ResourceSpans().Len(); i++ {
		rs := traces.ResourceSpans().At(i)
		for j := 0; j < rs.ScopeSpans().Len(); j++ {
			ss := rs.ScopeSpans().At(j)
			for k := 0; k < ss.Spans().Len(); k++ {
				span := ss.Spans().At(k)
				if _, ok := span.Attributes().Get(attributeName); ok {
					span.Attributes().PutStr(attributeName, "*")
				}
			}
		}
	}
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions