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

[Instrumentation.Runtime] Optimize options usage #2289

Open
Kielek opened this issue Nov 4, 2024 · 0 comments
Open

[Instrumentation.Runtime] Optimize options usage #2289

Kielek opened this issue Nov 4, 2024 · 0 comments
Labels
comp:instrumentation.runtime Things related to OpenTelemetry.Instrumentation.Runtime

Comments

@Kielek
Copy link
Contributor

Kielek commented Nov 4, 2024

A bit odd. Why not just remove the parameter?

-public RuntimeMetrics(RuntimeInstrumentationOptions _1)
+public RuntimeMetrics()

Could make the whole class static. But need some way to make sure it is bootstrapped.

Like instead of...

        var instrumentation = new RuntimeMetrics(options);
        builder.AddMeter(RuntimeMetrics.MeterInstance.Name);
        return builder.AddInstrumentation(() => instrumentation);

Do something like...

        GC.KeepAlive(RuntimeMetrics.SomethingAccessibleToTriggetStaticCtor)
        return builder.AddMeter(RuntimeMetrics.MeterInstance.Name);

Originally posted by @CodeBlanch in #2281 (comment)

@Kielek Kielek added the comp:instrumentation.runtime Things related to OpenTelemetry.Instrumentation.Runtime label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.runtime Things related to OpenTelemetry.Instrumentation.Runtime
Projects
None yet
Development

No branches or pull requests

1 participant