Skip to content

Adding the Metrics Counter API#1578

Merged
SergeyKanzhelev merged 16 commits intoopen-telemetry:mainfrom
reyang:reyang/counter
Mar 30, 2021
Merged

Adding the Metrics Counter API#1578
SergeyKanzhelev merged 16 commits intoopen-telemetry:mainfrom
reyang:reyang/counter

Conversation

@reyang
Copy link
Copy Markdown
Member

@reyang reyang commented Mar 25, 2021

Changes

During the 03/18/2021 Metrics API/SDK SIG Meeting, we've agreed to focus on Counter as the 1st step to tackle the instruments.

This will be discussed during the upcoming (3/25) Metrics API/SDK SIG meeting.

Related issues #

Related oteps OTEP146

@reyang reyang requested review from a team March 25, 2021 07:29
Copy link
Copy Markdown
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

If I were you I would split this into 2 PRs:

  • One that clarifies instrument properties
  • One that adds the Counter details


var counterPowerUsed = meter.CreateCounter<double, PowerConsumption>("power_consumption", unit="kWh");
counterPowerUsed.Add(13.5, new PowerConsumption { customer = "Tom" });
counterPowerUsed.Add(200, new PowerConsumption { customer = "Jerry" }, ("is_green_energy", true));
Copy link
Copy Markdown

@noahfalk noahfalk Mar 27, 2021

Choose a reason for hiding this comment

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

While I don't anticipate our .NET 6 implementation to include this strongly typed struct capability it does do a good job indicating the kind of flexibility we'd like language implementors to have.

Copy link
Copy Markdown
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

Meta Comment:

Strings in OTel Specification SHOULD be specified somewhere globally and you should just denote that things are strings, referencing that specification. We have a lot off "string" references in the Trace Spec where this spec is far more explicit.

I think it's worth opening a bug to address that and not blocking this PR. That said, not 100% happy with ASCII vs BMP and wanted to understand why.

reyang and others added 2 commits March 30, 2021 08:19
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
@SergeyKanzhelev SergeyKanzhelev merged commit ea7ec75 into open-telemetry:main Mar 30, 2021
@reyang reyang deleted the reyang/counter branch October 4, 2021 17:33
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* counter API

* fix link

* clarify unit and description

* address review comments

* avoid money

* move the counter creation example to the right place

* update the example to avoid anything related to billing/accounting

* mention that BMP is basically utf8mb3

* Update specification/metrics/new_api.md

Co-authored-by: Leighton Chen <lechen@microsoft.com>

* Update specification/metrics/new_api.md

Co-authored-by: Leighton Chen <lechen@microsoft.com>

* Update specification/metrics/new_api.md

Co-authored-by: Leighton Chen <lechen@microsoft.com>

* explain why 63 was chosen for unit string length

Co-authored-by: Leighton Chen <lechen@microsoft.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
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.

10 participants