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

ResourceBuilder Attribute Value is lost when using int value #1606

Closed
Mario-Hofstaetter opened this issue Nov 22, 2020 · 1 comment · Fixed by #1720
Closed

ResourceBuilder Attribute Value is lost when using int value #1606

Mario-Hofstaetter opened this issue Nov 22, 2020 · 1 comment · Fixed by #1720
Assignees
Labels
bug Something isn't working

Comments

@Mario-Hofstaetter
Copy link

Bug Report

      <PackageReference Include="OpenTelemetry.Api" Version="1.0.0-rc1.1" />
      <PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.0.0-rc1.1" />
      <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc1.1" />
      <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc1.1" />
      <PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc1.1" />
  • Runtime version: netcoreapp3.1

Symptom

When adding Attributes to ResourceBuilder, AddAttributes accepts IEnumerable<KeyValuePair<string, object>>.
However, when adding a tag with value as int, the value is discarded / null in jaeger.
When using a string or calling ToString() the value is used.

What is the expected behavior?

Since the parameter is of type object the int value should work.

What is the actual behavior?

The integer value is lost.

Reproduce

BackendServiceResource = ResourceBuilder.CreateDefault()
	.AddService(serviceName:ServiceName, serviceInstanceId:ServiceInstanceId, serviceNamespace:ServiceNamespace, serviceVersion:ServiceVersion)
	.AddAttributes(new []
	{
		new KeyValuePair<string, object>("my.foobar1", 1), // will get lost
		new KeyValuePair<string, object>("my.foobar2", "2"),
		new KeyValuePair<string, object>("my.foobar3", 3.ToString()),
	});

// ...

builder.SetResourceBuilder(BackendServiceResource)
//...

Result in jaeger 1.21.0:

grafik

@Mario-Hofstaetter Mario-Hofstaetter added the bug Something isn't working label Nov 22, 2020
@cijothomas cijothomas self-assigned this Dec 1, 2020
@cijothomas
Copy link
Member

Thanks @Mario-Hofstaetter for reporting.
The attributes are currently only supporting bool, long, double, string. We need to make it same as the Tags in activity. I'll make a bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants