Fix environment variable when contains URI with splitter sign = inside
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.mdupdated for non-trivial changes - [ ] Design discussion issue #
- [ ] Changes in public API reviewed
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: jkljajic / name: Jovo Kljajic (7bf7d9a0aa1710302b7a6d1cfae9d78d6671ae3e)
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?
It's unclear how
OTEL_RESOURCE_ATTRIBUTESshould 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.
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.
Closed as inactive. Feel free to reopen if this PR is still being worked on.
Here goes the requirement from the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable