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

Verify compliant metric API specification implementation: Instrument UpDownCounter #3378

Closed
2 tasks done
Tracked by #3383
MrAlias opened this issue Oct 20, 2022 · 7 comments
Closed
2 tasks done
Tracked by #3383
Assignees
Labels
area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Oct 20, 2022

  • Identify all the normative requirements, recommendations, and options the specification defines as comments to this issue
  • Ensure the current metric API implementation is compliant with these normative requirements, recommendations, and options in those comments.
@MrAlias MrAlias added area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package labels Oct 20, 2022
@MrAlias
Copy link
Contributor Author

MrAlias commented Nov 8, 2022

#3454

@MrAlias MrAlias self-assigned this Jan 6, 2023
@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

There MUST NOT be any API for creating an UpDownCounter other than with a Meter.

Post #3454, our implementation is compliant with this.

@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

This MAY be called CreateUpDownCounter. If strong type is desired, OpenTelemetry API authors MAY decide the language idiomatic name(s), for example CreateInt64UpDownCounter, CreateDoubleUpDownCounter, CreateUpDownCounter<Int64>, CreateUpDownCounter<double>.

We do not follow this optional criteria. We instead follow more common Go method naming and use Int64UpDownCounter and Float64UpDownCounter.

@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

This API SHOULD NOT return a value (it MAY return a dummy value if required by certain programming languages or systems, for example null, undefined).

We comply with this recommendation:

Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)

@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

Parameters:

  • The amount to be added, can be positive, negative or zero.
  • Optional attributes.

I'm assuming these were meant to be normatively declared1.

Both parameters are accepted for the Add methods of up-down counters:

Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)

Footnotes

  1. https://github.com/open-telemetry/opentelemetry-specification/pull/3082

@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

OpenTelemetry API authors MAY decide to allow flexible attributes to be passed in as individual arguments. OpenTelemetry API authors MAY allow attribute values to be passed in using a more efficient way (e.g. strong typed struct allocated on the callstack, tuple).

We do not allow attribute name/type registration at instrument creation time, meaning we do not support this optional feature. We do comply with the requirement to allow users to provide flexible attributes at invocation (of the Add API) time.

@MrAlias
Copy link
Contributor Author

MrAlias commented Jan 7, 2023

Every normative clause from the UpDownCounter section of the v1.16.0 specification has been identified and our API has been validated that it complies. Closing.

@MrAlias MrAlias closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant