Migrate apollo_router_session_count_total metric to an OTel gauge#6495
Migrate apollo_router_session_count_total metric to an OTel gauge#6495goto-bus-stop merged 1 commit intodevfrom
apollo_router_session_count_total metric to an OTel gauge#6495Conversation
Somehow missed this in #6476 <!-- [ROUTER-911] -->
✅ Docs Preview ReadyNo new or changed pages found. |
|
@goto-bus-stop, please consider creating a changeset entry in |
|
CI performance tests
|
|
Oh, there's a mistake in this PR. The guard for the total session count doesn't live long enough, so the value will be decremented too early. It's being fixed in #6527 |
| listener = &address | ||
| ); | ||
| } | ||
| let _guard = main_graphql_port.then(TotalSessionCountGuard::start); |
There was a problem hiding this comment.
Note this contains a mistake. The guard must be moved into the task::spawn call below, but it isn't, so the total session count metric is broken with this PR (it is immediately decremented before the next incoming request is handled.)
#6527 will fix this problem.
There was a problem hiding this comment.
That PR will be redone in a different way. #6539 fixes just this problem.
In #6495 I migrated this metric to an otel ObservableGauge. However the lifetime of the count guard was too short, so the value of the metric would almost always just be 0; and the lifetime of the instrument was too short, so even the wrong value of 0 would not actually be reported. Now the lifetime of the instrument is captured by all requests, so the instrument is kept even post-reload if a request is still being completed from the old schema. Also, a test verifies that the count increments and decrements as expected.
Somehow missed this in #6476
No changeset because it's in #6476 : )