-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add Runtime metrics test #900
Add Runtime metrics test #900
Conversation
|
As far as I understand
We can consider adding a configuration setting like I have never tried the metrics API and I am exploring how the collection works when using a PUSH-based exporter like OTLP. This is probably where the collection of .NET Runtime metric happens. The OTel spec defines
The current implementation gives the processor up to 5 seconds to shut down. I think it is OK. To sum up, I propose: Option 1 (OTel spec-compliant):
Option 2 (probably more pragmatic at the moment):
As far as lazy I would probably go for Option 2. And in the meantime, I can try implementing open-telemetry/opentelemetry-dotnet#3417 |
I'm also leaning towards option 2. Option 1 does not seem like the right solution to this problem either even though it leverages a spec-compliant setting. The problem is exposed by short-running programs. If the program completes before the configured export interval, the runtime metrics would still not be collected and exported. If that duration is not predictable, and they want to prevent frequent metric exports (when the application runs longer) the env variable in option 2 may be a better option. |
Will fix the issue, once after #910 gets merged. |
It looks like this test is flaky
I guess that After a quick look, I think that
|
|
@@ -121,7 +121,7 @@ public async Task<Container> StartContainerAsync(TestSettings testSettings, int | |||
/// StartTestApplication starts the test application | |||
// and returns the Process instance for further interaction. | |||
/// </summary> | |||
public Process StartTestApplication(int traceAgentPort = 0, string arguments = null, string packageVersion = "", int aspNetCorePort = 0, string framework = "", bool enableStartupHook = true) | |||
public Process StartTestApplication(int traceAgentPort = 0, int metricsAgentPort = 0, string arguments = null, string packageVersion = "", int aspNetCorePort = 0, string framework = "", bool enableStartupHook = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that our continued reliance on these optional parameters is going make the tests harder to maintain. On the one hand, it's nice that the test only needs to call StartTestApplication
with a single named parameter. However, based on my experience with these usages, it gets harder and harder to keep track of which parameters are being used over time. That is why I prefer the overloads that take settings/config objects, which make it a lot easier to track down which specific settings are being used/customized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
Part of #665 .NET runtime metrics
Metrics are lost during application exit. Especially, in a console app that run and exit metrics are lost. Adding a MeterProvider.ForceFlush resolves an issue. Spent lot of debugging hours in isolating this issue.
On a side note: We might need a ForceFlush for TracerProvider too, will leave it for discussion and create an issue.
What
Runtime metrics emitted for .NET Framework and .NET Core are not the same. But, there are few common metrics name asserting on those to prove the runtime metrics is working as expected.
Tests
SubmitMetrics
test case toRunTimeMetricsTests
Checklist
[ ]CHANGELOG.md
is updated.[ ] Documentation is updated.[ ] New features are covered by tests.