-
Notifications
You must be signed in to change notification settings - Fork 69
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
slo - capture plugin duration for http based plugins #998
Conversation
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.
Quick feedback. Will take a closer look tomorrow.
Yes, I think it make sense to make the middleware default. Would be good with tests of the wrapper and/or example how you would use it, plugin have to create it or SDK automatically provides it?
The middleware/duration doesn't look to be concurrency safe - that's something we probably have to have before making Middleware default. Tests for middleware would be good as well.
@marefr some updates from your pr review. addressed concurrency and tests |
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.
LGTM since experimental and want to unblock you. Some nits, feel free to address those or skip :)
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.
Nit. Couldn't these live in the package slo_test
as well?
Namespace: "plugins", | ||
Name: "plugin_request_duration_seconds", | ||
Help: "Duration of plugin execution", | ||
}, []string{"datasource_name", "datasource_type", "source", "endpoint", "status", "status_code"}) |
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.
Nit. Wonder if status_code
is really needed, leave that up to you. But in general, feels like logs could be more suitable for details following our discussion from last week.
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
What this PR does / why we need it:
We want to capture execution time of plugin requests for SLO duration.
Changes here based on our last slo discussion. The original plan was to capture 2 separate histogram metrics, then try to subtract them. The recommendation by the prometheus team was not to do that, but to instead calculate before storing the metric.
How it works:
This requires minimal changes in the plugin: