GcpCompute.Telemetry (GcpCompute v0.2.0)

Copy Markdown View Source

Telemetry events emitted by the library.

Every HTTP call to the Compute API is wrapped in a :telemetry.span/3, so you get the standard :start / :stop / :exception trio.

Events

  • [:gcp_compute, :request, :start] — measurements: %{system_time, monotonic_time}; metadata: %{method, path, project}.

  • [:gcp_compute, :request, :stop] — measurements: %{duration, monotonic_time}; metadata: %{method, path, project, result, http_status} (result is :ok or :error; http_status is present on API errors).

  • [:gcp_compute, :request, :exception] — measurements: %{duration, monotonic_time}; metadata: %{method, path, project, kind, reason, stacktrace}.

Attaching a quick logger

GcpCompute.Telemetry.attach_default_logger()

or wire the events into Telemetry.Metrics / your reporter of choice.

Summary

Functions

Attach a simple Logger handler for request stops/exceptions.

The list of telemetry events this library emits.

Functions

attach_default_logger(level \\ :debug)

@spec attach_default_logger(Logger.level()) :: :ok | {:error, :already_exists}

Attach a simple Logger handler for request stops/exceptions.

Intended for development. In production prefer Telemetry.Metrics + a reporter.

events()

@spec events() :: [[atom()]]

The list of telemetry events this library emits.