Skip to content

Initialize all handlers metrics#547

Merged
saswatamcode merged 3 commits intoobservatorium:mainfrom
douglascamata:initialize-handler-mtrics
Jul 31, 2023
Merged

Initialize all handlers metrics#547
saswatamcode merged 3 commits intoobservatorium:mainfrom
douglascamata:initialize-handler-mtrics

Conversation

@douglascamata
Copy link
Copy Markdown
Member

@douglascamata douglascamata commented Jul 28, 2023

This PR initializes all the metrics from the metrics APIs (v1 and legacy) to ensure they are present on a restart of the application, even without traffic.

We were having issues with the Pyrra SLOs firing the SLOMetricAbsent in these scenarios. This should prevent these alerts.

A small refactor was done to stop trying to guess the group and handler based on the URL path at request time. Instead, these are added through handler wrappers that store the group and handler in the context. The list of groups and handlers are used to initialize the metrics.

A bigger refactor can be done to improve this further, making the registration of the group and handler names of an endpoint initialize the metric. This will require many more changes, including changing interfaces in the code, so I didn't do it in this PR.

Signed-off-by: Douglas Camata 159076+douglascamata@users.noreply.github.com

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
@douglascamata douglascamata marked this pull request as ready for review July 28, 2023 12:42
Copy link
Copy Markdown
Contributor

@philipgough philipgough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown
Member

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

3 participants