OpenTelemetry SDK
    Preparing search index...

    Function maybeAddAttribute

    • Maybe add the key/val attribute to the given attributes.

      • "Maybe" because this ensures the key is valid (the string is not empty), the val is an accepted spec AnyValue type (see isAnyValue below), and the attribute does not need to be dropped because of a count limit. Note that the TypeScript AnyValue type is looser than the spec AnyValue.
      • This also applies attribute count and value length limits.
      • This returns an AddAttributeDecision enum value indicating whether, why, and how the attribute was added. This can be relevant for the caller updating metrics (e.g. droppedAttributesCount).

      Parameters

      • opts: MaybeAddAttributeOpts

      Returns AddAttributeDecision