open-telemetry / opentelemetry-erlang

OpenTelemetry Erlang SDK
https://opentelemetry.io
Apache License 2.0
327 stars 103 forks source link

Use a sorted list for attributes in metrics #704

Open tsloughter opened 6 months ago

tsloughter commented 6 months ago

Because a key in a matchspec acts as a match and not an equality check the ets lookups based on keys using attributes in metrics will result in incorrect results. For example, an empty set of attributes #{} would match any metric, no matter the attributes it has, when used in an ets match/select.

I believe moving to a guard check will slow the key lookup down so we must convert attributes to a list when used in a metric key.

tsloughter commented 6 months ago

Renaming this because the more important issue issue is normalizing attribute keys since right now a and <<"a">> would make different metric streams.