OpentelemetryBreathalyzer (opentelemetry_breathalyzer v0.1.0)

Breathalyzer is an OpenTelemetry tracker for Absinthe.

  • Add it to your dependencies:
defp deps do
  [
    ...,
    {:opentelemetry_breathalyzer, "~> 0.1.0"}
  ]
end
  • Configure it:
config :opentelemetry_breathalyzer, :track,
  execute_operation: [
    request_document: true,
    request_schema: true,
    request_selections: false,
    request_variables: true,
    request_complexity: false,
    response_errors: true,
    response_result: false,
    request_context: [[:current_user, :id]]
  ]
  • And setup it just before your application supervisor starts:
  defmodule MyApplication do
    def start(_type, args) do
      opts = [strategy: :one_for_one, name: MySupervisor]
      OpentelemetryBreathalyzer.setup()
      Supervisor.start_link(children(args), opts)
  end
end
  • There you go. You should start seeing traces popping into your OpenTelemetry store.

Summary

Functions

Link to this function

attach_execute_middleware_handler(config)

Link to this function

attach_execute_operation_handler(config)

Link to this function

attach_resolve_field_handler(config)

Link to this function

detach_execute_middleware_handler()

Link to this function

detach_execute_operation_handler()

Link to this function

detach_resolve_field_handler()

Link to this function

setup(instrumentation_opts \\ [])