Skip to content

[telemetrygen] Add timeout flag#47299

Merged
mx-psi merged 9 commits into
open-telemetry:mainfrom
araiu:telemetrygen/add_timeout_flag
Apr 15, 2026
Merged

[telemetrygen] Add timeout flag#47299
mx-psi merged 9 commits into
open-telemetry:mainfrom
araiu:telemetrygen/add_timeout_flag

Conversation

@araiu
Copy link
Copy Markdown
Contributor

@araiu araiu commented Apr 1, 2026

Description

Add support timeout setting for telemetrygen

Link to tracking issue

Fixes #47203

Testing

Sending traces to a collector that has an artificial delay of 10s before answering

❯ go run . traces --traces 1 --timeout 5s --otlp-insecure
2026-04-01T17:29:31.673+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to READY	{"grpc_log": true}
2026/04/01 17:29:34 traces export: context deadline exceeded: rpc error: code = DeadlineExceeded desc = context deadline exceeded
2026-04-01T17:29:34.980+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to SHUTDOWN	{"grpc_log": true}
❯ go run . traces --traces 1 --timeout 15s --otlp-insecure
2026-04-01T17:30:42.046+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to READY	{"grpc_log": true}
2026-04-01T17:30:52.052+0300	INFO	channelz/trace.go:200	[core] [Channel #1] Channel Connectivity change to SHUTDOWN	{"grpc_log": true}

@araiu araiu requested review from a team, codeboten and mx-psi as code owners April 1, 2026 14:31
@github-actions github-actions Bot added the cmd/telemetrygen telemetrygen command label Apr 1, 2026
@github-actions github-actions Bot requested review from Erog38 and bogdan-st April 1, 2026 14:32
Copy link
Copy Markdown
Contributor

@bogdan-st bogdan-st left a comment

Choose a reason for hiding this comment

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

Looks good, small nits that I think should be addressed.
Also please add this new flag to the readme as well.

fs.Float64Var(&c.Rate, "rate", c.Rate, "Approximately how many metrics/spans/logs per second each worker should generate. Zero means no throttling.")
fs.Var(&c.TotalDuration, "duration", "For how long to run the test. Use 'inf' for infinite duration.")
fs.DurationVar(&c.ReportingInterval, "interval", c.ReportingInterval, "Reporting interval")
fs.DurationVar(&c.Timeout, "timeout", c.Timeout, "Maximum time to wait for the test to complete. Zero means no timeout.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is confusing as the timeout is the wait time for one export event not the full "test"

fs.Float64Var(&c.Rate, "rate", c.Rate, "Approximately how many metrics/spans/logs per second each worker should generate. Zero means no throttling.")
fs.Var(&c.TotalDuration, "duration", "For how long to run the test. Use 'inf' for infinite duration.")
fs.DurationVar(&c.ReportingInterval, "interval", c.ReportingInterval, "Reporting interval")
fs.DurationVar(&c.Timeout, "timeout", c.Timeout, "Maximum time to wait for the test to complete. Zero means no timeout.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, zero means no timeout is misleading, zero would configure the SDK's default timeout which is 10s.

Copy link
Copy Markdown
Contributor Author

@araiu araiu Apr 5, 2026

Choose a reason for hiding this comment

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

Agree, will update the usage message.
Also, digging a bit into this it looks like the exporter is defaulting to a 5s timeout , while the Go SDK exporters default to 10s

}
}

func TestHTTPExporterOptions_Timeout(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be worth testing the grpc exporter as well, the new timeout is wired for both but this is only testing http.

Comment thread cmd/telemetrygen/internal/config/config.go Outdated
Comment thread cmd/telemetrygen/pkg/logs/exporter.go Outdated
@mx-psi
Copy link
Copy Markdown
Member

mx-psi commented Apr 13, 2026

@bogdan-st do you want to give this another look before I merge?

Copy link
Copy Markdown
Contributor

@bogdan-st bogdan-st left a comment

Choose a reason for hiding this comment

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

Still would have liked a README line but that's not that important.
LGTM otherwise

@mx-psi
Copy link
Copy Markdown
Member

mx-psi commented Apr 14, 2026

@araiu Can you add a README line documenting this option?

@araiu
Copy link
Copy Markdown
Contributor Author

araiu commented Apr 14, 2026

@araiu Can you add a README line documenting this option?

Definitely, missed this from @bogdan-st's previous comment. Also took the liberty to update the collector-contrib image to a newer version.

While we're at this, @bogdan-st do you see any other flags that might be worth getting surfaced instead of

Check `telemetrygen traces --help` for all the options.

?

@mx-psi
Copy link
Copy Markdown
Member

mx-psi commented Apr 15, 2026

I think

@araiu Can you add a README line documenting this option?

Definitely, missed this from @bogdan-st's previous comment. Also took the liberty to update the collector-contrib image to a newer version.

Thanks!

While we're at this, @bogdan-st do you see any other flags that might be worth getting surfaced instead of

Check `telemetrygen traces --help` for all the options.

I think that is a valuable conversation, I will merge this PR and whatever we decide can be included in a future PR

@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Apr 15, 2026

Thank you for your contribution @araiu! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmd/telemetrygen telemetrygen command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support timeout setting for telemetrygen

5 participants