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

Try to stop OTLP controllers when Telemetry is dropped #3143

Merged
merged 6 commits into from
Aug 22, 2023

Conversation

garypen
Copy link
Contributor

@garypen garypen commented May 25, 2023

We already have code to specifically drop tracers and we are adding some additional logic to do the same thing with metrics exporters.

fixes: #3140

Checklist

Complete the checklist (and note appropriate exceptions) before a final PR is raised.

  • Changes are compatible[^1]
  • Documentation[^2] completed
  • Performance impact assessed and acceptable
  • Tests added and passing[^3]
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

[^1]. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.
[^2]. Configuration is an important part of many changes. Where applicable please try to document configuration examples.
[^3]. Tick whichever testing boxes are applicable. If you are adding Manual Tests:
- please document the manual testing (extensively) in the Exceptions.
- please raise a separate issue to automate the test and label it (or ask for it to be labeled) as manual test

@garypen garypen requested review from BrynCooke and a team May 25, 2023 15:32
@garypen garypen self-assigned this May 25, 2023
@garypen garypen requested review from Geal and SimonSapin May 25, 2023 15:32
@github-actions

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented May 25, 2023

CI performance tests

  • const - Basic stress test that runs with a constant number of users
  • no-graphos - Basic stress test, no GraphOS.
  • step - Basic stress test that steps up the number of users over time
  • reload - Reload test over a long period of time at a constant rate of users
  • xlarge-request - Stress test with 10Mb request payload
  • large-request - Stress test with a 1Mb request payload
  • xxlarge-request - Stress test with 100Mb request payload

garypen added 3 commits May 30, 2023 13:01
We already have code to specifically drop tracers and we are adding some
additional logic to do the same thing with metrics exporters.

fixes: #3140
I'm not sure if this is a useful metric to maintain long-term, but it's
useful right now.
@garypen garypen force-pushed the garypen/3140-flush-otlp-metrics branch from 1bb1825 to 11bf9b9 Compare May 30, 2023 12:01
@garypen
Copy link
Contributor Author

garypen commented Aug 18, 2023

I've figured out a way of testing this on my local machine and this change does improve the story for OTLP metrics in the router.
Test description:
I have a load injector configured to send a specific number of requests to the router over a specified period of time. (200 requests, 20 req/s, for 10 seconds
I have configured the otel collector to receive OTLP metrics and log details out so I can see what metrics are sent
I then run the router and start the load injector.
I wait until those metrics appear in my otel collector log (sometimes there is an off by one error, which I think is related to bugs in the opentelemetry crate which will be fixed when we move to 0.20.0).
I then start the load injector again, but this time as soon as the load injector terminates, I stop (Ctrl-C) the router.

If I do this with the current dev router, then I never see that 400 http requests are counted. I usually get about 300, but clearly the metrics associated with the last few requests are being dropped at router shutdown.
If I do it with my modified router, then I see the original 200 requests and the final set of 200 requests which arrived just before the router shutdown (along with my debug message which confirms that the exporter has been stopped).

Aside: In both implementations no metrics are lost during router reload.

Summary: In order to avoid losing metrics during router shutdown we should make this change. It's probably an edge case, since losing metrics during shutdown shouldn't substantially affect many users, but it's a small improvement and worth making.

@garypen garypen marked this pull request as ready for review August 18, 2023 10:36
@garypen garypen merged commit 5c8b82c into dev Aug 22, 2023
@garypen garypen deleted the garypen/3140-flush-otlp-metrics branch August 22, 2023 11:04
@BrynCooke BrynCooke mentioned this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

are all otel metrics being written correctly flushed when the state machine restarts
4 participants