-
Notifications
You must be signed in to change notification settings - Fork 12
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
[ffresty] [metric] HTTP Response Time and Complete Gauge Support #160
base: main
Are you sure you want to change the base?
Conversation
metricsManager.NewCounterMetricWithLabels(ctx, "network_error", "Network error", []string{"host", "method"}, false) | ||
metricsManager.NewCounterMetricWithLabels(ctx, metricsHTTPResponsesTotal, "HTTP response", []string{"status", "error", "host", "method"}, false) | ||
metricsManager.NewCounterMetricWithLabels(ctx, metricsNetworkErrorsTotal, "Network error", []string{"host", "method"}, false) | ||
metricsManager.NewSummaryMetricWithLabels(ctx, metricsHTTPResponseTime, "HTTP response time", []string{"status", "host", "method"}, false) |
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.
@onelapahead what's your consideration between Histogram
and Summary
for this timing metrics?
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.
Histogram is more costly in terms of cardinality bc of all the buckets you make. So this felt light enough to only calculate average response time across a few basic dimensions.
Would love to toggle btwn histogram and summaries based on certain settings eventually, but that was a bigger change than I had an appetite for.
const ( | ||
metricsHTTPResponsesTotal = "http_responses_total" | ||
metricsNetworkErrorsTotal = "network_errors_total" | ||
metricsHTTPResponseTime = "http_response_time_seconds" |
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.
Some size metrics for data transmitted would be useful to add as well.
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.
That is a great step forward, thanks @onelapahead .
I asked a question about the metrics type for the response time. Switching to histogram will have the following benefits, which could be compelling:
- reduce observation costs on the client
- enable aggregation across instances
To clarify - this is still entirely possible with summaries. They are similar to a histogram but less counters:
Histograms are great/preferred for aggregate percentiles and therefore performance engineering. Summaries are great for aggregated averages and therefore reliability engineering. Quantiles are a special version of summary, which to your point are basically worthless at any real scale bc they cannot be aggregated. However, they are less expensive cardinality than histograms. So if you care about individual "thing's" performance they are useful. Do hope ff-common can offer histograms as an option, but not by default since they are quite expensive. But will save that for a future contributor. |
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
Signed-off-by: hfuss <hayden.fuss@kaleido.io>
3d55fdd
to
8180cc5
Compare
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.
This looks good @onelapahead
Getting Error: pkg/ffresty/ffresty.go:201:1: cyclomatic complexity 37 of func
NewWithConfig is high (> 30) (gocyclo)
from build, given this function is doing a lot of just configuration we can probably ignore this complexity warning by adding the ignore comment. Or if you are up for it we can break it down.
We could split adding the onBeforeRequest
to another function but it might be messy
For Resty, we enhance the existing before/after hooks so that we record the elapsed time on responses. And use more labels and smarter context's for consistently deriving any request metadata like the host.
Then, within the metric manager itself, we didn't offer the ability to use gauge inc/dec which can be very useful rather than using set.