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

MeterMust and variants can live in a metricutil package #1290

Closed
rakyll opened this issue Oct 29, 2020 · 3 comments
Closed

MeterMust and variants can live in a metricutil package #1290

rakyll opened this issue Oct 29, 2020 · 3 comments
Labels
area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package
Projects

Comments

@rakyll
Copy link
Contributor

rakyll commented Oct 29, 2020

The Must* types and functions are convenience wrappers, we can move them to another package. They make it harder to focus on what are the core types and where the developers start engaging with the metric package.

@MrAlias MrAlias added area:metrics Part of OpenTelemetry Metrics pkg:API Related to an API package priority:p1 labels Oct 29, 2020
@MrAlias MrAlias added this to To do in P1 Burndown via automation Oct 29, 2020
@MrAlias MrAlias added this to To do in OpenTelemetry Go RC via automation Oct 29, 2020
@MrAlias MrAlias added this to the RC1 milestone Oct 29, 2020
@MrAlias MrAlias removed this from the RC1 milestone Feb 12, 2021
@punya punya removed this from To do in OpenTelemetry Go RC Feb 17, 2021
@MrAlias
Copy link
Contributor

MrAlias commented May 3, 2022

Removed Must* types in #2587.

@MrAlias MrAlias closed this as completed May 3, 2022
@ronisec
Copy link

ronisec commented Aug 29, 2022

Is there a new home for the Must* types? Trying to figure out how we can update our Otel version which heavily uses the following practice:

// Some code in the codebase

// Globally defined metrics
var (
   meter = metric.Must(global.MeterProvider().Meter(instrumentationName))
   myCounter = meter.NewInt64Counter("my_metric")
)

// Some code
...

Ideally we can panic on failure to initialize the metrics at the global level.

@MrAlias
Copy link
Contributor

MrAlias commented Aug 29, 2022

Is there a new home for the Must* types? Trying to figure out how we can update our Otel version which heavily uses the following practice:

// Some code in the codebase

// Globally defined metrics
var (
   meter = metric.Must(global.MeterProvider().Meter(instrumentationName))
   myCounter = meter.NewInt64Counter("my_metric")
)

// Some code
...

Ideally we can panic on failure to initialize the metrics at the global level.

You will need to define your own functionality to wrap the creation function with panic logic at this point.

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
P1 Burndown
  
To do
Development

No branches or pull requests

3 participants