// BenchmarkLabels_Get was written to check whether a binary search can improve the performance vs the linear search implementation
// The results have shown that binary search would only be better when searching last labels in scenarios with more than 10 labels.
// In the following list, `old` is the linear search while `new` is the binary search implementation (without calling sort.Search, which performs even worse here)
// The map to translate OTLP units to Prometheus units
// The map to translate OTLP units to Prometheus units.
// OTLP metrics use the c/s notation as specified at https://ucum.org/ucum.html
// (See also https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/README.md#instrument-units)
// Prometheus best practices for units: https://prometheus.io/docs/practices/naming/#base-units
@ -57,8 +57,8 @@ var unitMap = map[string]string{
"$":"dollars",
}
// The map that translates the "per" unit
// Example: s => per second (singular)
// The map that translates the "per" unit.
// Example: s => per second (singular).
varperUnitMap=map[string]string{
"s":"second",
"m":"minute",
@ -69,7 +69,7 @@ var perUnitMap = map[string]string{
"y":"year",
}
// Build a Prometheus-compliant metric name for the specified metric
// Build a Prometheus-compliant metric name for the specified metric.
//
// Metric name is prefixed with specified namespace and underscore (if any).
// Namespace is not cleaned up. Make sure specified namespace follows Prometheus
funcvalOdd(posint)int{returnpos*2+1}// s[0]=1, s[1]=3, s[2]=5, ..., s[31]=63 - New values will interject at chosen position because they sort before the pre-existing vals.