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

Fix environment variable when contains URI with splitter sign = inside #3670

Closed

Conversation

jkljajic
Copy link

Fixes #.
When OTEL_RESOURCE_ATTRIBUTES contains KeyValuePair key=http://localhost/key=value&key2=value2 it does not detect very well because it splits with "=" and get more then length of 2

Changes

#if NET6_0 || NETSTANDARD2_1_OR_GREATER
                string[] keyValuePair = rawKeyValuePair.Split(AttributeKeyValueSplitter,2);
#else
                string[] keyValuePair = rawKeyValuePair.Split(AttributeKeyValueSplitter);
                if(keyValuePair.Length > 2)
                {
                    keyValuePair = new string[] { keyValuePair[0], string.Join(AttributeKeyValueSplitter.ToString(), keyValuePair.Skip(1)) };
                }
#endif

Please provide a brief description of the changes here.

trying to spit only on the first occurrence of AttributeKeyValueSplitter and because that is supported in net6 and NETSTANDARD2_1_OR_GREATER I need to add additional work around wor previus Dotnet release

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@jkljajic jkljajic requested a review from a team September 16, 2022 08:33
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 16, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: jkljajic / name: Jovo Kljajic (7bf7d9a)

@reyang
Copy link
Member

reyang commented Sep 16, 2022

It's unclear how OTEL_RESOURCE_ATTRIBUTES should be used when the attribute value has special characters (any escape rules), is there a clear spec or the spec is simply buggy?

@jkljajic
Copy link
Author

It's unclear how OTEL_RESOURCE_ATTRIBUTES should be used when the attribute value has special characters (any escape rules), is there a clear spec or the spec is simply buggy?

Is not point to any special character its just splitter '=', in our case we trying to inject a log URL reference to Grafana or any other tool and call directly, using the same approach with Java agent that works and we see that the same URL in open telemetry traces, but not in case Dotnet.
I think this is just overseeing and should be good that parsing key-value pairs keep that in mind and allow to use of the splitter sign in the value part.

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Sep 25, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2022

Closed as inactive. Feel free to reopen if this PR is still being worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Issues and pull requests which have been flagged for closing due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants