opentelemetry_honeycomb v0.5.0-rc.1 OpenTelemetry.Honeycomb.Attributes View Source

Attribute cleaning and flattening.

OpenTelemetry supports a flat map of attribute keys to string, number, and boolean values (see t.OpenTelemetry.attribute_value/0). The API does not enforce this, implicitly supporting other attribute value types eg. maps until export time.

Honeycomb expects a flat JSON-serialisable object, but can be configured to flatten maps and stringify arrays at import time.

The data models being quite similar, we:

  • Pass string, number, and boolean values through unmodified
  • Flatten map values as described below
  • Convert most other values to strings using inspect/1 with a short limit
  • Trim string values longer than 49127 bytes

When trimming strings, we replace the last 3-7 characters of the trimmed string or so with an ellipsis ("...") of equal length. We choose the length of the ellipsis to avoid ending the trimmed string with a high-bit character, eg. splitting a UTF-8 code point.

We drop:

  • Entire attribute lists that don't start as a list or map
  • Entire list members that don't resemble key/value pairs

When flattening maps, we use periods (.) to delimit keys, for example this input:

%{
  http: %{
    host:  "localhost",
    method: "POST",
    path: "/api"
  }
}

... to this output:

%{
  "http.host" => "localhost",
  "http.method" => "POST",
  "http.path" => "/api",
}

Link to this section Summary

Types

A key/value list that has been cleaned.

A key/value pair that has been cleaned.

A key/value list that hasn't been cleaned.

A map that hasn't been cleaned.

A key/value pair that hasn't been cleaned.

Functions

Clean and flatten span attributes, dropping data that can't be cleaned.

Merge two sorted attribute lists, eliminating duplicate keys.

Sort an attribute list, eliminating duplicate keys.

Trim strings longer than 49127 bytes.

Link to this section Types

A key/value list that has been cleaned.

A key/value pair that has been cleaned.

Link to this type

dirty_list()

View Source
dirty_list() :: [dirty_pair() | term()]

A key/value list that hasn't been cleaned.

Link to this type

dirty_map()

View Source
dirty_map() :: map()

A map that hasn't been cleaned.

Link to this type

dirty_pair()

View Source
dirty_pair() :: {term(), term()}

A key/value pair that hasn't been cleaned.

Link to this section Functions

Clean and flatten span attributes, dropping data that can't be cleaned.

Merge two sorted attribute lists, eliminating duplicate keys.

Drops members of the second list that duplicate keys from the first.

Sort an attribute list, eliminating duplicate keys.

Drops members that duplicate already-seen keys.

Trim strings longer than 49127 bytes.

When trimming strings, we replace the last 3-7 characters of the trimmed string or so with an ellipsis ("...") of equal length. We choose the length of the ellipsis to avoid ending the trimmed string with a high-bit character, eg. splitting a UTF-8 code point.