-
Notifications
You must be signed in to change notification settings - Fork 428
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
base: main
Are you sure you want to change the base?
Conversation
- Added support for histogram metrics - Upgraded all dependencies.
// 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, | ||
// }, | ||
// } | ||
// } |
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.
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.
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
Co-authored-by: Nurlan Moldomurov <bupychuk1989@gmail.com>
…:percona/mongodb_exporter into PMM-9568_mdb_exporter_histograms
@BupycHuk
|
@@ -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 { |
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.
can we rename value
here to something else, there might be collisions between the value inside the loop and outside.
histogramLabel{key: "lowerBound", value: "0"}: []float64{0}, | ||
histogramLabel{key: "lowerBound", value: "128"}: []float64{0}, | ||
histogramLabel{key: "lowerBound", value: "256"}: []float64{0}, |
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.
let's set different values for a count value to actually test values.
value string | ||
} | ||
|
||
func extractHistograms(v []interface{}) map[histogramLabel][]float64 { |
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.
I think the value of the map should be just a float64, not an array of floats
PMM-9568