beam-telemetry / cowboy_telemetry

Telemetry instrumentation for Cowboy
Apache License 2.0
30 stars 9 forks source link

cowboy_telemetry

Hex.pm Version Erlang CI

Telemetry instrumentation for the Cowboy HTTP server.

This package contains a cowboy_stream handler that will instrument each request and emit telemetry events.

Usage

Configure your cowboy server with the cowboy_telemetry_h stream handler first.

cowboy:start_clear(http, [{port, Port}], #{
    env => #{dispatch => Dispatch},
    stream_handlers => [cowboy_telemetry_h, cowboy_stream_h]
}.

Telemetry Events

[cowboy, request, start]

A span event emitted at the beginning of a request.

[cowboy, request, stop]

A span event emitted at the end of a request.

If the request is terminated early - by the client or by the server - before a response is sent, the metadata will also contain an error:

[cowboy, request, exception]

A span event emitted if the request process exits.

[cowboy, request, early_error]

A single event emitted when Cowboy itself returns an early_error response before executing any handlers.

Types

Note: