Skip to content

Conversation

sergiofbsilva
Copy link

@sergiofbsilva sergiofbsilva commented Sep 5, 2025

Standalone rack applications need to initialize middlewares explicitly:

Rack::Builder.new do
	use *OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args
	run lambda { |_arg| [200, { 'Content-Type' => 'text/plain' }, body] }
 end

However this doesn't take into account the new OTEL_SEMCONV_STABILITY_OPT_IN environment variable.

This PR ensures rack middleware_args are selected consistently based on OTEL_SEMCONV_STABILITY_OPT_IN environment variable.

Ensure rack middleware_args are selected consistently based on
`OTEL_SEMCONV_STABILITY_OPT_IN` environment variable.
Copy link

CLA Not Signed

@ericmustin
Copy link
Contributor

Thanks for opening this @sergiofbsilva . We chatted on this briefly in SIG, just wanted to clarify

  • To confirm, the issue here that you're using rack as a standalone app, and the env var OTEL_SEMCONV_STABILITY_OPT_IN isn't being respected because it isn't being by the evaluated by the middleware_args helper method?

cc @hannahramadan

@sergiofbsilva
Copy link
Author

Thanks for opening this @sergiofbsilva . We chatted on this briefly in SIG, just wanted to clarify

  • To confirm, the issue here that you're using rack as a standalone app, and the env var OTEL_SEMCONV_STABILITY_OPT_IN isn't being respected because it isn't being by the evaluated by the middleware_args helper method?

cc @hannahramadan

Yes, that's right. We want to use middleware_args without all the logic around OTEL_SEMCONV_STABILITY_OPT_IN being on the API client.

@hannahramadan
Copy link
Contributor

Thanks @sergiofbsilva! This looks like a good change, and allows users to continuing using middleware_args vs needing to explicitly add one of the new middleware_args_* methods. We look forward to reviewing when you're ready.

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