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

PMM-9586 Added support for histogram metrics #531

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

Conversation

percona-csalguero
Copy link
Contributor

  • Added support for histogram metrics
  • Upgraded all dependencies.

PMM-9568

- Added support for histogram metrics
- Upgraded all dependencies.
@percona-csalguero percona-csalguero requested a review from a team as a code owner July 21, 2022 18:01
@percona-csalguero percona-csalguero requested review from ShashankSinha252 and tshcherban and removed request for a team July 21, 2022 18:01
exporter/metrics.go Outdated Show resolved Hide resolved
exporter/metrics.go Outdated Show resolved Hide resolved
Comment on lines +339 to +355
// If all the items have the same number of fields, it is a histogram:
// "histograms": primitive.M{
// "classicWorks": primitive.A{
// primitive.M{
// "count": 0,
// "lowerBound": 0,
// },
// primitive.M{
// "lowerBound": 128,
// "count": 0,
// },
// primitive.M{
// "lowerBound": 256,
// "count": 0,
// },
// }
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked some histogram examples and I found out that each primitive.M contains two fields: some key and count. So I think that the key should be used as a label and count as a value.

exporter/metrics_test.go Outdated Show resolved Hide resolved
percona-csalguero and others added 2 commits July 25, 2022 07:50
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
Makefile Show resolved Hide resolved
percona-csalguero and others added 3 commits July 27, 2022 06:34
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
…:percona/mongodb_exporter into PMM-9568_mdb_exporter_histograms
@percona-csalguero
Copy link
Contributor Author

@BupycHuk
I've updated histograms. Now we have labels for buckets:

# TYPE mongodb_ss_wt_perf untyped
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 1) - 10-49ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 2) - 50-99ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 3) - 100-249ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 4) - 250-499ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 5) - 500-999ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system read latency histogram (bucket 6) - 1000ms+",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 1) - 10-49ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 2) - 50-99ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 3) - 100-249ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 4) - 250-499ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 5) - 500-999ms",rs_state="0"} 0
mongodb_ss_wt_perf{cl_id="",cl_role="",perf_bucket="file system write latency histogram (bucket 6) - 1000ms+",rs_state="0"} 0

@@ -321,7 +326,8 @@ func extractHistograms(v []interface{}) map[string][]float64 {
}

var value float64
var label string
var label histogramLabel
var hasCount bool

for key, value := range s {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename value here to something else, there might be collisions between the value inside the loop and outside.

Comment on lines +237 to +239
histogramLabel{key: "lowerBound", value: "0"}: []float64{0},
histogramLabel{key: "lowerBound", value: "128"}: []float64{0},
histogramLabel{key: "lowerBound", value: "256"}: []float64{0},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's set different values for a count value to actually test values.

value string
}

func extractHistograms(v []interface{}) map[histogramLabel][]float64 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the value of the map should be just a float64, not an array of floats

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.

None yet

3 participants