Skip to content

DefaultMeterFactory.Create and MeterOptions.Scope #86684

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

Closed
JamesNK opened this issue May 24, 2023 · 3 comments
Closed

DefaultMeterFactory.Create and MeterOptions.Scope #86684

JamesNK opened this issue May 24, 2023 · 3 comments

Comments

@JamesNK
Copy link
Member

JamesNK commented May 24, 2023

Description

A meter factory sets the scope of the meter it creates to itself:

Meter m = new Meter(options.Name, options.Version, options.Tags, scope: this);
meterList.Add(m);

However, a scope can be provided on MeterOptions.Scope, which passed to Create.

Create should probably throw an error if a scope is specified. Otherwise there could be confusion about why the specified scope value wasn't used.

Reproduction Steps

object myCoolScope = new object();
IMeterFactory f = CreateFactory();
Meter meter = f.Create(new MeterOptions("Name") { Scope = myCoolScope });

Debug.Assert(meter.Scope == myCoolScope); // Fails?!?!

Expected behavior

Throw an error.

Actual behavior

The scope provided by the user is ignored, and the meter scope is set to the factory.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@ghost ghost added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners untriaged New issue has not been triaged by the area owner labels May 24, 2023
@JamesNK JamesNK added area-System.Diagnostics.Metric and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 24, 2023
@JamesNK
Copy link
Member Author

JamesNK commented May 24, 2023

cc @tarekgh @noahfalk

@tarekgh tarekgh added this to the 8.0.0 milestone May 24, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label May 24, 2023
@tarekgh tarekgh self-assigned this May 24, 2023
@tarekgh
Copy link
Member

tarekgh commented May 24, 2023

Thanks @JamesNK. I'll take care with that.

@tarekgh
Copy link
Member

tarekgh commented May 26, 2023

This is addressed by #86740

@tarekgh tarekgh closed this as completed May 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants