opentelemetry_honeycomb v0.5.0-rc.1 OpenTelemetry.Honeycomb.Json behaviour View Source

JSON back end.

The OpenTelemetry Honeycomb Exporter uses a Jason-style JSON encoder via a behaviour so you can adapt it to your preferred JSON encoder or decode/encode options.

To use Poison, install it. The exporter defaults json_backend to OpenTelemetry.Honeycomb.Json.PoisonBackend, which adapts Poison to the subset of the Jason API we document with this behaviour.

To use Jason, install it and configure it as the json_backend:

config :opentelemetry,
  processors: [
    otel_batch_processor: %{
      exporter: OpenTelemetry.Honeycomb.Exporter,
      json_backend: Jason
    }
  ]

Link to this section Summary

Types

A term that we can encode to JSON, or decode from JSON.

Functions

Decode a term from JSON using the configured back end.

Return the default configuration for decode!/2 and encode_to_iodata!/2.

Encode a term to JSON using the configured back end.

Callbacks

Decode a term from JSON.

Encode a term to JSON.

Link to this section Types

Link to this type

config_opt()

View Source
config_opt() :: {:json_module, module()}

Configuration for decode!/2 and encode_to_iodata!/2:

  • json_module: the JSON back end module
Link to this type

encodable_term()

View Source
encodable_term() ::
  nil
  | boolean()
  | float()
  | integer()
  | String.t()
  | [encodable_term()]
  | %{optional(String.t()) => encodable_term()}

A term that we can encode to JSON, or decode from JSON.

Link to this section Functions

Link to this function

decode!(config, data)

View Source
decode!(config :: [config_opt()], data :: iodata()) ::
  encodable_term() | no_return()

Decode a term from JSON using the configured back end.

Return the default configuration for decode!/2 and encode_to_iodata!/2.

Link to this function

encode_to_iodata!(config, term)

View Source
encode_to_iodata!(config :: [config_opt()], term :: encodable_term()) ::
  iodata() | no_return()

Encode a term to JSON using the configured back end.

Link to this section Callbacks

Decode a term from JSON.

Link to this callback

encode_to_iodata!(encodable_term)

View Source
encode_to_iodata!(encodable_term()) :: iodata() | no_return()

Encode a term to JSON.