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

[pdatatest] Ignore span timestamps #27688

Closed
atoulme opened this issue Oct 16, 2023 · 3 comments
Closed

[pdatatest] Ignore span timestamps #27688

atoulme opened this issue Oct 16, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@atoulme
Copy link
Contributor

atoulme commented Oct 16, 2023

Component(s)

pkg/pdatatest

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

The pdatatest framework currently enforces span comparisons based on timestamps.

Describe the solution you'd like

I would like to be able to ignore timestamps in comparisons.

Describe alternatives you've considered

We use this code to modify the spans:

func ignoreStartTimestamp(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)
				span.SetStartTimestamp(0)
			}
		}
	}
}

func ignoreEndTimestamp(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)
				span.SetEndTimestamp(0)
			}
		}
	}
}

Additional context

No response

@atoulme atoulme added enhancement New feature or request needs triage New item requiring triage labels Oct 16, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@djaglowski djaglowski added help wanted Extra attention is needed good first issue Good for newcomers and removed needs triage New item requiring triage labels Oct 16, 2023
@sakulali
Copy link
Contributor

Hello @atoulme, could you kindly assign to me, thanks!

dmitryax pushed a commit that referenced this issue Oct 17, 2023
**Description:** 
Support ignore timestamps in span comparisons for pdatatest.

**Link to tracking Issue:** 

#27688

**Testing:**
make chlog-validate
go test for pkg/pdatatest

**Documentation:**
Add usage for `ptracetest.IgnoreStartTimestamp()` and
`ptracetest.IgnoreEndTimestamp()`
@atoulme
Copy link
Contributor Author

atoulme commented Oct 17, 2023

Thanks @sakulali !

@atoulme atoulme closed this as completed Oct 17, 2023
JaredTan95 pushed a commit to openinsight-proj/opentelemetry-collector-contrib that referenced this issue Oct 18, 2023
**Description:** 
Support ignore timestamps in span comparisons for pdatatest.

**Link to tracking Issue:** 

open-telemetry#27688

**Testing:**
make chlog-validate
go test for pkg/pdatatest

**Documentation:**
Add usage for `ptracetest.IgnoreStartTimestamp()` and
`ptracetest.IgnoreEndTimestamp()`
sigilioso pushed a commit to carlossscastro/opentelemetry-collector-contrib that referenced this issue Oct 27, 2023
**Description:** 
Support ignore timestamps in span comparisons for pdatatest.

**Link to tracking Issue:** 

open-telemetry#27688

**Testing:**
make chlog-validate
go test for pkg/pdatatest

**Documentation:**
Add usage for `ptracetest.IgnoreStartTimestamp()` and
`ptracetest.IgnoreEndTimestamp()`
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
**Description:** 
Support ignore timestamps in span comparisons for pdatatest.

**Link to tracking Issue:** 

open-telemetry#27688

**Testing:**
make chlog-validate
go test for pkg/pdatatest

**Documentation:**
Add usage for `ptracetest.IgnoreStartTimestamp()` and
`ptracetest.IgnoreEndTimestamp()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants