Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: crowu y.wu4515@gmail.com
Description
This PR adds a hook interface for different backend to register timing and histogram metrics.
The main motivation comes from the integration with statsd:
the statsd API for timing / histogram takes a name and value, and it will aggregate the percentile metrics for us. This makes it really hard to parse the histogram data from vitess as latency in statsd.
We currently just represent them as a plain gauges with bucket suffix - this is not a very helpful metrics to understand the latency performance.
This PR adds a statsdHook, different stats backend can choose to add different hooks for timing and histogram, and when we add timing / histogram, Vitess will also try to invoke the hook function as well.
One caveat: this setup only applies to stats that published after the register functions in servenv.OnRun being called. For metrics that published before vitess server starts, we will just ignore them since we haven't register the hook yet
Although we are plan to integrate with OpenTelemetry , I feel there is still value to add this support to unblock any existing statsd use case.
Related Issue(s)
Checklist
Deployment Notes
NA
Impacted Areas in Vitess
Components that this PR will affect: