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

[api-metrics]: Create or verify compliance of Counter #2548

Closed
5 tasks
Tracked by #2480
dyladan opened this issue Oct 20, 2021 · 5 comments · Fixed by #2588
Closed
5 tasks
Tracked by #2480

[api-metrics]: Create or verify compliance of Counter #2548

dyladan opened this issue Oct 20, 2021 · 5 comments · Fixed by #2588
Assignees

Comments

@dyladan
Copy link
Member

dyladan commented Oct 20, 2021

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter

  • Creation method
    • name (required)
    • unit (optional string)
    • description (optional string)
  • Interface
    • Add
      • required increment amount
      • optional attributes
      • optional context
  • Noop implementation

Current Status 10/27

Currently we have bound and unbound versions. The unbound version satisfies the value and attribute parameters. In #2559 @legendecas has made the unbound version the only version. The following still needs to be done:

  • Add optional context parameter
  • Remove unused option constantLabels
  • Remove unused option component
  • Remove SDK option boundaries (may need SDK changes)
  • Remove SDK option aggregationTemporality (may need SDK changes)
@dyladan dyladan added feature-request up-for-grabs Good for taking. Extra help will be provided by maintainers labels Oct 20, 2021
@legendecas
Copy link
Member

I didn't find any statements on Counter.Add and other synchronous instruments that they should have an optional parameter of context. But there is a statement about associating contexts with synchronous instruments:

Synchronous instruments (e.g. Counter) are meant to be invoked inline with application/business processing logic. For example, an HTTP client could use a Counter to record the number of bytes it has received. Measurements recorded by synchronous instruments can be associated with the Context.

@dyladan dyladan self-assigned this Oct 27, 2021
@dyladan dyladan removed the up-for-grabs Good for taking. Extra help will be provided by maintainers label Oct 27, 2021
@dyladan
Copy link
Member Author

dyladan commented Oct 27, 2021

The "optional context" parameter in the issue description came from exactly that line. Of course you can always get context implicitly but as a general rule we also allow explicit context anywhere implicit context is allowed.

@legendecas
Copy link
Member

The unused metrics options constantLabels and component should be removed as they are not part of the spec. boundaries and aggregationTemporality should be configured with metric readers so they should be removed from the MetricOptions too, but there are usages in the current SDK so it might need a refactor.

@legendecas
Copy link
Member

IIUC, the attributes of the second parameter of Counter.add is already optional: https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts#L142

@dyladan
Copy link
Member Author

dyladan commented Oct 29, 2021

IIUC, the attributes of the second parameter of Counter.add is already optional: main/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts#L142

Yes it is. Not sure what I was thinking :)

The unused metrics options constantLabels and component should be removed as they are not part of the spec. boundaries and aggregationTemporality should be configured with metric readers so they should be removed from the MetricOptions too, but there are usages in the current SDK so it might need a refactor.

Agree. Added to the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants