mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-03 22:52:30 +02:00
Comments
This commit is contained in:
parent
48a8a869fe
commit
3d2493463c
@ -354,6 +354,11 @@ func (c *collector) toDesc(record export.Record, labelKeys []string) *prometheus
|
||||
return prometheus.NewDesc(sanitize(desc.Name()), desc.Description(), labelKeys, nil)
|
||||
}
|
||||
|
||||
// mergeLabels merges the export.Record's labels and resources into a
|
||||
// single set, giving precedence to the record's labels in case of
|
||||
// duplicate keys. This outputs one or both of the keys and the
|
||||
// values as a slice, and either argument may be nil to avoid
|
||||
// allocating an unnecessary slice.
|
||||
func mergeLabels(record export.Record, keys, values *[]string) {
|
||||
if keys != nil {
|
||||
*keys = make([]string, 0, record.Labels().Len()+record.Resource().Len())
|
||||
|
@ -99,9 +99,8 @@ func Merge(a, b *Resource) *Resource {
|
||||
return a
|
||||
}
|
||||
|
||||
// Note: 'b' is listed first so that 'a' will overwrite with
|
||||
// last-value-wins in label.Key()
|
||||
// combine := append(b.Attributes(), a.Attributes()...)
|
||||
// Note: 'a' labels will overwrite 'b' with last-value-wins in label.Key()
|
||||
// Meaning this is equivalent to: append(b.Attributes(), a.Attributes()...)
|
||||
mi := label.NewMergeIterator(a.LabelSet(), b.LabelSet())
|
||||
combine := make([]kv.KeyValue, 0, a.Len()+b.Len())
|
||||
for mi.Next() {
|
||||
|
Loading…
Reference in New Issue
Block a user