Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

attrnorm

v1.47.0
go.opentelemetry.io/otel/sdk/metric/internal/attrnorm

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

6 matches

Top ↑

Package attrnorm normalizes attribute values.

Functions

KeyValueDedup

func KeyValueDedup(kv attribute.KeyValue) (attribute.KeyValue, bool)

KeyValueDedup returns kv with all map values deduplicated and whether it changed.

KeyValuesDedup

func KeyValuesDedup(kvs []attribute.KeyValue) ([]attribute.KeyValue, bool)

KeyValuesDedup returns kvs with all map values deduplicated and whether they changed.

The returned slice is the original kvs slice if no value needs deduplication. Top-level keys in kvs are not deduplicated.

NewDistinct

func NewDistinct(kvs []attribute.KeyValue, filter attribute.Filter) attribute.Distinct

NewDistinct returns the identity of kvs after normalization and filtering. It does not retain or modify kvs. Duplicate keys use the last value supplied. The filter is called once for each unique normalized attribute in ascending key order.

SetDedup

func SetDedup(set attribute.Set) (attribute.Set, bool)

SetDedup returns set with all map values deduplicated and whether it changed.

The returned Set is the original set if no value needs deduplication. Top-level key uniqueness remains attribute.Set's responsibility; this only normalizes map attribute values.

ValueDedup

func ValueDedup(value attribute.Value) (attribute.Value, bool)

ValueDedup returns value with all map values deduplicated and whether it changed.

Duplicate map keys are resolved using last-value-wins semantics.

Dependency graph