-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add metric for command processor latency #1529
base: main
Are you sure you want to change the base?
Conversation
The metrics will be like:
|
if (id.getName().startsWith(jsonApiMetricsConfig.commandProcessorLatencyMetrics())) { | ||
return DistributionStatisticConfig.builder() | ||
.percentiles(0.5, 0.90, 0.95, 0.99) | ||
.percentilesHistogram(true) | ||
.minimumExpectedValue( | ||
TimeUnit.MILLISECONDS.toNanos( | ||
jsonApiMetricsConfig.MinExpectedCommandProcessorLatency())) // 0.1 seconds | ||
.maximumExpectedValue( | ||
TimeUnit.MILLISECONDS.toNanos( | ||
jsonApiMetricsConfig.MaxExpectedCommandProcessorLatency())) // 15 seconds | ||
.build() | ||
.merge(config); | ||
} |
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.
To address the potential high cardinality issue in Grafana, I adjusted the bucket range by increasing the minimum value (from 0.001 sec to 0.1 sec) and decreasing the maximum value (from 30 sec to 15 sec). This change reduces the number of buckets from 69 to 36.
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.
While this makes sense wrt cardinality, 0.1 secs is 100 msec which is quite coarse. This might be ok when trying to find slowest queries, but we need to make sure it is useful for us in general. Could see what using 0.05 (for example) would give for number of buckets.
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.
Changed to 0.05 and there are 41 buckets. The metrics will be like:
# HELP command_processor_latency_seconds
# TYPE command_processor_latency_seconds histogram
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.5",} 0.012058624
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.9",} 0.200802304
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.95",} 0.200802304
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.99",} 0.200802304
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.05",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.050331646",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.055924051",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.061516456",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.067108864",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.089478485",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.111848106",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.134217727",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.156587348",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.178956969",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.20132659",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.223696211",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.246065832",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.268435456",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.357913941",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.447392426",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.536870911",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.626349396",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.715827881",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.805306366",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.894784851",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.984263336",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.073741824",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.431655765",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.789569706",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.147483647",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.505397588",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.863311529",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.22122547",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.579139411",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.937053352",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="4.294967296",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="5.726623061",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="7.158278826",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="8.589934591",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="10.021590356",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="11.453246121",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="12.884901886",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="14.316557651",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="15.0",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="+Inf",} 4.0
command_processor_latency_seconds_count{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",} 4.0
command_processor_latency_seconds_sum{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",} 0.253723748
The numbers are from my local laptop so it's not accurate, will deploy this to dev to see if 0.05 makes sense and if Grafana could work
What this PR does:
Add metric for command processor latency
Which issue(s) this PR fixes:
Fixes #1501
Checklist