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

Asynchronous metric instruments ignoring attributes #2548

Closed
duncanpo opened this issue Feb 23, 2024 · 5 comments · Fixed by #2557
Closed

Asynchronous metric instruments ignoring attributes #2548

duncanpo opened this issue Feb 23, 2024 · 5 comments · Fixed by #2557
Assignees
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@duncanpo
Copy link

Describe your environment
I am using Windows, and building with Visual Studio 2019

Steps to reproduce
This issue can be reproduced by making some small changes to the "metrics_simple" example. Replace the file examples/common/metrics_foo_library/foo_library.cc with the attached version. The new file simply add some random attributes in the call to observe in the callback function. Build the example and run.

What is the expected behavior?
I expect to see some random attributes in the output

What is the actual behavior?
Attributes is always empty in the output

Additional context
This issue seems to be introduced from commit cf5cdaa
foo_library.cc.txt

@duncanpo duncanpo added the bug Something isn't working label Feb 23, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 23, 2024
@lalitb lalitb self-assigned this Feb 23, 2024
@duncanpo
Copy link
Author

I should clarify, you can simply run the observable_counter part of the example as that is the only relevant part:
metrics_ostream_example.exe observable_counter

@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 26, 2024
@lalitb
Copy link
Member

lalitb commented Feb 26, 2024

@duncanpo I am sure I am doing something wrong, as multiple people have reported it. I just used the attached foo_library, and can see the attributes getting generated:

./metrics_ostream_example observable_counter
{
  scope name    : ostream_metric_example
  schema url    :
  version       : 1.2.0
  start time    : Mon Feb 26 22:34:42 2024
  end time      : Mon Feb 26 22:34:43 2024
  instrument name       : ostream_metric_example_observable_counter
  description   :
  unit          :
  type          : SumPointData
  value         : 4.1
  attributes            :
        key2: value2
        key3: value3
  resources     :
        service.name: unknown_service
        telemetry.sdk.language: cpp
        telemetry.sdk.name: opentelemetry
        telemetry.sdk.version: 1.13.0
}
{
  scope name    : ostream_metric_example
  schema url    :
  version       : 1.2.0
  start time    : Mon Feb 26 22:34:42 2024
  end time      : Mon Feb 26 22:34:44 2024
  instrument name       : ostream_metric_example_observable_counter
  description   :
  unit          :
  type          : SumPointData
  value         : 4.1
  attributes            :
        key2: value2
        key3: value3
  type          : SumPointData
  value         : 5.2
  attributes            :
        key2: value2
        key4: value4
  resources     :
        service.name: unknown_service
        telemetry.sdk.language: cpp
        telemetry.sdk.name: opentelemetry
        telemetry.sdk.version: 1.13.0
}

Any idea what is expected here?

@lalitb
Copy link
Member

lalitb commented Feb 26, 2024

Ah please ignore - the telemetry.sdk.version is 1.13.0 in my output above, seems somehow old sdk is getting used for me. Let me check further.

@duncanpo
Copy link
Author

@lalitb, this is what I see when I am running from commit cf5cdaa

{
scope name : ostream_metric_example
schema url :
version : 1.2.0
start time : Tue Feb 27 02:46:55 2024
end time : Tue Feb 27 02:47:04 2024
instrument name : ostream_metric_example_observable_counter
description :
unit :
type : SumPointData
value : 30
attributes :
resources :
service.name: unknown_service
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
telemetry.sdk.version: 1.13.0
}
{
scope name : ostream_metric_example
schema url :
version : 1.2.0
start time : Tue Feb 27 02:46:55 2024
end time : Tue Feb 27 02:47:05 2024
instrument name : ostream_metric_example_observable_counter
description :
unit :
type : SumPointData
value : 33.1
attributes :
resources :
service.name: unknown_service
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
telemetry.sdk.version: 1.13.0
}

@duncanpo
Copy link
Author

And what I see running out of commit d32f960

{
scope name : ostream_metric_example
schema url :
version : 1.2.0
start time : Tue Feb 27 03:20:08 2024
end time : Tue Feb 27 03:20:08 2024
instrument name : ostream_metric_example_observable_counter
description :
unit :
type : SumPointData
value : 2.1
attributes :
key3: value3
key4: value4
resources :
service.name: unknown_service
telemetry.sdk.language: cpp
telemetry.sdk.name: opentelemetry
telemetry.sdk.version: 1.13.0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants