Skip to content

test: initialize metrics once in TestMain to prevent concurrent map access#1238

Merged
christos68k merged 2 commits intoopen-telemetry:mainfrom
rogercoll:fix_integration_metrics
Mar 10, 2026
Merged

test: initialize metrics once in TestMain to prevent concurrent map access#1238
christos68k merged 2 commits intoopen-telemetry:mainfrom
rogercoll:fix_integration_metrics

Conversation

@rogercoll
Copy link
Copy Markdown
Contributor

Periodic caller goroutines from earlier tests may still be calling metrics.AddSlice after cancelling the context, racing with metrics. Start in subsequent tests.

See failure example https://github.com/open-telemetry/opentelemetry-ebpf-profiler/actions/runs/22881720558/job/66385932626?pr=1237#step:7:285

Periodic caller non waited routine: https://github.com/rogercoll/opentelemetry-ebpf-profiler/blob/fix_integration_metrics/tracer/tracer.go#L1138

…ccess

Periodic caller goroutines from earlier tests may still be calling
metrics.AddSlice after returning, racing with metrics. Start in
subsequent tests.
@rogercoll rogercoll requested review from a team as code owners March 10, 2026 03:30
@rogercoll
Copy link
Copy Markdown
Contributor Author

We could use the mutex in metrics.Start, but this method is assumed to be only called once during start-up.

@christos68k christos68k merged commit b715333 into open-telemetry:main Mar 10, 2026
32 checks passed
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.

3 participants