Skip to content

Latest commit

 

History

History

python

README.md

Sentry

Sentry Conventions

The Sentry Conventions are a set of semantic conventions for naming and describing events in Sentry.

PyPI version PyPI pyversions Discord Chat

GitHub Actions Codecov

The package exports:

  • attributes.ATTRIBUTE_NAMES: contains constants for all attribute names and their types, as defined in the Sentry semantic conventions
  • attributes.Attributes: represents a bag of typed attributes
  • attributes.ATTRIBUTE_METADATA: provides metadata about attributes, such as their type, scrubbing definition, deprecation info, and lookup keys

Attribute Key Chains

An attribute's value may be readable under several keys: its own, the names Sentry search exposes it as, and the deprecated attributes it replaces. ATTRIBUTE_METADATA[key].keys lists all of them, most preferred first:

from sentry_conventions.attributes import ATTRIBUTE_METADATA, ATTRIBUTE_NAMES

ATTRIBUTE_METADATA[ATTRIBUTE_NAMES.HTTP_REQUEST_METHOD].keys
# ("http.request.method", "http.method", "http.request_method", "method")

The order within a chain is:

  1. the attribute heading the chain, followed by the names it is exposed as in Sentry search
  2. its non-deprecated aliases, each followed by their own search names
  3. the deprecated attributes it replaces, in alphabetical order, each followed by their own search names

Deprecated attributes are only added to a chain if their status is normalize or backfill. If an attribute is deprecated with another status or status null, it's own keys array will not contain any replacing attribute. Therefore, there's no guarantee for a stable attribute in a key chain.