Skip to content

Add instrumentation library name and version to OTLP exported metrics#1418

Merged
codeboten merged 3 commits intoopen-telemetry:masterfrom
ocelotl:issue_1417
Nov 25, 2020
Merged

Add instrumentation library name and version to OTLP exported metrics#1418
codeboten merged 3 commits intoopen-telemetry:masterfrom
ocelotl:issue_1417

Conversation

@ocelotl
Copy link
Copy Markdown
Contributor

@ocelotl ocelotl commented Nov 25, 2020

Fixes #1417

Description

Add missing instrumentation library attributes to the OTLP exported metrics

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • translate_metrics

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@ocelotl ocelotl requested review from a team, codeboten and hectorhdzg and removed request for a team November 25, 2020 06:57
@ocelotl ocelotl self-assigned this Nov 25, 2020
@ocelotl ocelotl assigned ocelotl and unassigned ocelotl Nov 25, 2020
Copy link
Copy Markdown
Contributor

@NathanielRN NathanielRN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Love the metrics attention :)

Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question, then I can move to approving this PR and merging.

)

instrumentation_library_metrics.instrumentation_library.name = (
export_record.instrument.meter.instrumentation_info.name
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the instrumentation info not be pulled from the resource on the export_record?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those values can possible be different I think? I'm wondering what "instrumentation library" in the context of metrics means. For [tracing[(https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md#instrumentation-libraries) it is instrumentation library (like flask), but here there is no such thing. Whereas Resource is defined as the entity that is producing the telemetry.

We should find out which is the most appropriate for what otlp needs in this field.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find the instrumentation info in the resource object:

ipdb> export_record.resource
<opentelemetry.sdk.resources.Resource object at 0x7f4c390dc730>
ipdb> dir(export_record.resource)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_attributes', 'attributes', 'create', 'create_empty', 'merge']
ipdb> export_record.resource
<opentelemetry.sdk.resources.Resource object at 0x7f4c390dc730>
ipdb> export_record.resource.attributes
OrderedDict([('a', 1), ('b', False)])
ipdb> export_record.resource.attributes
                              attributes     create()       create_empty() merge()       
                              instance 

This happens because we can have a Resource without those attributes, but the Meter will have them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering what "instrumentation library" in the context of metrics means. For [tracing[(https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md#instrumentation-libraries) it is instrumentation library (like flask), but here there is no such thing.

I think it is supposed to be the same thing from reading this. I think this code is correct

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like Observers have a meter, filed a bug #1424

@ocelotl ocelotl requested a review from codeboten November 25, 2020 21:53
@codeboten codeboten merged commit 47b5b35 into open-telemetry:master Nov 25, 2020
@ocelotl ocelotl deleted the issue_1417 branch November 26, 2020 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing instrumentation library name and version from OTLP exported metrics

5 participants