Skip to content

DefaultMeterFactory.Create and MeterOptions.Scope #86684

Closed

Description

@JamesNK

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

Activity

  1. ghost added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on May 24, 2023
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on May 24, 2023
  3. added and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on May 24, 2023
  4. JamesNK commented on May 24, 2023

    @JamesNK
    MemberAuthor
  5. added this to the 8.0.0 milestone on May 24, 2023
  6. ghost removed
    untriagedNew issue has not been triaged by the area owner
    on May 24, 2023
  7. self-assigned this
    on May 24, 2023
  8. tarekgh commented on May 24, 2023

    @tarekgh
    Member

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

  9. tarekgh commented on May 26, 2023

    @tarekgh
    Member

    This is addressed by #86740

  10. ghost locked as resolved and limited conversation to collaborators on Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions