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

Do instrument creation functions in metric API need their own options? #3872

Closed
MrAlias opened this issue Mar 14, 2023 · 0 comments · Fixed by #3895
Closed

Do instrument creation functions in metric API need their own options? #3872

MrAlias opened this issue Mar 14, 2023 · 0 comments · Fixed by #3895
Assignees
Labels
area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package proposal
Milestone

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Mar 14, 2023

Currently the options for instrument creation are defined as ...

  1. Ones encompassing all instruments
    // Option applies options to all instruments.
    type Option interface {
    Float64ObserverOption
    Int64ObserverOption
    Float64Option
    Int64Option
    }
  2. Ones for float64 Observers
    // Float64ObserverOption applies options to float64 Observer instruments.
    type Float64ObserverOption interface {
    applyFloat64Observer(Float64ObserverConfig) Float64ObserverConfig
    }
  3. Ones for int64 Observers
    // Int64ObserverOption applies options to int64 Observer instruments.
    type Int64ObserverOption interface {
    applyInt64Observer(Int64ObserverConfig) Int64ObserverConfig
    }
  4. Ones for float64 synchronous instruments
    // Float64Option applies options to synchronous float64 instruments.
    type Float64Option interface {
    applyFloat64(Float64Config) Float64Config
    }
  5. Ones for in64 synchronous instruments
    // Int64Option applies options to synchronous int64 instruments.
    type Int64Option interface {
    applyInt64(Int64Config) Int64Config
    }

There is no way to specify an option for a single instrument kind. There are changes to the OTel specification that are proposing such specificity may be needed: open-telemetry/opentelemetry-specification#3216

Proposal

Add options for each instrument.

This comes with the trade-off that the package API will have 12 additional option interfaces added to it and become cluttered.

Prior art

We decided to provide a span start and end options for similar reasons in the trace API.

@MrAlias MrAlias added pkg:API Related to an API package area:metrics Part of OpenTelemetry Metrics labels Mar 14, 2023
@MrAlias MrAlias added this to the v1.15.0 milestone Mar 14, 2023
@MrAlias MrAlias changed the title Do instrument creation functions in metric API need their own options Do instrument creation functions in metric API need their own options? Mar 14, 2023
@github-project-automation github-project-automation bot moved this to Triage Needed in Go: Metric API (GA) Mar 14, 2023
@MrAlias MrAlias self-assigned this Mar 15, 2023
@MrAlias MrAlias moved this from Triage Needed to In Progress in Go: Metric API (GA) Mar 15, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Go: Metric API (GA) Mar 21, 2023
@MrAlias MrAlias modified the milestones: v1.15.0, v1.15.0-RC2 Mar 22, 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 proposal
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant