-
Notifications
You must be signed in to change notification settings - Fork 244
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
Clean up whitespace in OTEL_RESOURCE_ATTRIBUTES #1541
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -87,6 +87,13 @@ | |||
_(configurator_resource_attributes).must_equal(expected_resource_attributes) | |||
end | |||
end | |||
|
|||
it 'cleans up whitespace in user provided resources' do | |||
OpenTelemetry::TestHelpers.with_env('OTEL_RESOURCE_ATTRIBUTES' => 'important_foo=x, important_bar=y') do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this trim values as well?
OpenTelemetry::TestHelpers.with_env('OTEL_RESOURCE_ATTRIBUTES' => 'important_foo=x, important_bar=y') do | |
OpenTelemetry::TestHelpers.with_env('OTEL_RESOURCE_ATTRIBUTES' => ' important_foo=x, important_bar=y ') do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this but decided against it - I could add it in, not sure what other otel instrumentation agents do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be using Baggage format so should be trimming spance then URL decoding https://github.com/open-telemetry/opentelemetry-go/blob/main/sdk/resource/env.go#L92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my first time ever writing ruby and I haven't been able to run the tests locally (got ruby 2 installed), but I have made the changes and hopefully they make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait sorry I messed up the order, trim first! committing in a moment
@inssein checking in since it's been a while. Looks like the test suite is failing. Would you mind taking a look again? |
@arielvalentin I took a quick look but I can't figure out how my test is wrong. I don't quite have a local development environment going, would love a pointer. Edit: odd that it's only partial failures at the OS level. |
I suspect it's decode_www_form_component cause the cross-system difference. Could you try to remove And/Or use |
I'm suspecting there's also some intermittent flakiness in the tests. I started playing with the changes in this PR in my dev environment because I too could not figure out what was wrong. Tests pass most of the time, but error occasionally saying the two |
👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
Could I get permission to run workflows or does it have to be approved each time? |
The current policy is only for first time contributors. Once your first PR is merged, the policy will allow actions to run automatically for future PRs. Thanks again for your understanding and your first contribution. |
When I run these tests locally via docker I get no failures:
I'm not a ruby developer and I don't quite understand what's going on. I can remove the uri decoding stuff but then it wouldn't be to spec. |
👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
I think I understand why this is failing. The This test is likely running in a non-deterministic order and if the test runs first, the singleton is set with the appropriate values, however if another test sets the singleton then this test fails because it will not re-evaluate the environment value. Instead of making this test part of the SDK configurator like you have it in here, I recommend using the
This will make your test suite stable and predictable while ensuring correctness. |
Fixes #1540