Skip to content
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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Hazel-Datastax
Copy link
Contributor

What this PR does:
Add metric for command processor latency

Which issue(s) this PR fixes:
Fixes #1501

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@Hazel-Datastax Hazel-Datastax requested a review from a team as a code owner October 11, 2024 00:52
@Hazel-Datastax
Copy link
Contributor Author

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",} 1.6777216
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.9",} 6.106906624
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.95",} 6.106906624
command_processor_latency_seconds{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.99",} 6.106906624
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001048576",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001398101",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001747626",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002097151",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002446676",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002796201",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003145726",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003495251",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003844776",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.004194304",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.005592405",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.006990506",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.008388607",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.009786708",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.011184809",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.01258291",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.013981011",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.015379112",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.016777216",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.022369621",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.027962026",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.033554431",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.039146836",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.044739241",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.050331646",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.055924051",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.061516456",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.067108864",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.089478485",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.111848106",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.134217727",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.156587348",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.178956969",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.20132659",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.223696211",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.246065832",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.268435456",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.357913941",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.447392426",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.536870911",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.626349396",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.715827881",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.805306366",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.894784851",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="0.984263336",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.073741824",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.431655765",} 0.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="1.789569706",} 1.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.147483647",} 1.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.505397588",} 1.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="2.863311529",} 2.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.22122547",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.579139411",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="3.937053352",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="4.294967296",} 3.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="5.726623061",} 3.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.748213416",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="17.179869184",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="22.906492245",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="28.633115306",} 4.0
command_processor_latency_seconds_bucket{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",le="30.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",} 13.416749582
command_processor_latency_seconds{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.5",} 0.0
command_processor_latency_seconds{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.9",} 0.0
command_processor_latency_seconds{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.95",} 0.0
command_processor_latency_seconds{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",quantile="0.99",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001048576",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001398101",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.001747626",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002097151",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002446676",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.002796201",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003145726",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003495251",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.003844776",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.004194304",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.005592405",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.006990506",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.008388607",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.009786708",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.011184809",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.01258291",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.013981011",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.015379112",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.016777216",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.022369621",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.027962026",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.033554431",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.039146836",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.044739241",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.050331646",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.055924051",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.061516456",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.067108864",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.089478485",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.111848106",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.134217727",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.156587348",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.178956969",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.20132659",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.223696211",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.246065832",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.268435456",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.357913941",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.447392426",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.536870911",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.626349396",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.715827881",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.805306366",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.894784851",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="0.984263336",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="1.073741824",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="1.431655765",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="1.789569706",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="2.147483647",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="2.505397588",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="2.863311529",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="3.22122547",} 0.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="3.579139411",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="3.937053352",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="4.294967296",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="5.726623061",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="7.158278826",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="8.589934591",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="10.021590356",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="11.453246121",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="12.884901886",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="14.316557651",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="15.748213416",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="17.179869184",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="22.906492245",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="28.633115306",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="30.0",} 1.0
command_processor_latency_seconds_bucket{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",le="+Inf",} 1.0
command_processor_latency_seconds_count{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",} 1.0
command_processor_latency_seconds_sum{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",} 3.513473
# HELP command_processor_latency_seconds_max  
# TYPE command_processor_latency_seconds_max gauge
command_processor_latency_seconds_max{command="InsertOneCommand",module="sgv2-jsonapi",tenant="unknown",} 6.107748333
command_processor_latency_seconds_max{command="CreateCollectionCommand",module="sgv2-jsonapi",tenant="unknown",} 3.513473

Comment on lines 330 to 342
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);
}
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

@Hazel-Datastax
Copy link
Contributor Author

image (1)
This is the latency data from dev kube 540. We need to adjust the bucket ranges accordingly.

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.

Add metric for command processor latency
2 participants