# `RTMP.Telemetry`
[🔗](https://github.com/Adeyeye93/rtmp/blob/v0.1.0/lib/rtmp/telemetry.ex#L1)

Telemetry events emitted by the server.

All events share a base metadata map:

  * `:pid` — the connection process
  * `:remote_address`, `:remote_port` — the peer

Stream keys are secrets, so they never appear in telemetry metadata.

## Events

### `[:rtmp, :connection, :start]`

A TCP connection was accepted.

  * Measurements: `%{system_time: integer}`

### `[:rtmp, :connection, :stop]`

A connection ended.

  * Measurements: `%{duration: native_time, bytes_in: integer}`
  * Metadata: `:reason` — the same reason given to `c:RTMP.Handler.handle_disconnect/2`

### `[:rtmp, :connection, :rejected]`

A connection was refused — by your handler, or because the client asked
for something unsupported.

  * Measurements: `%{}`
  * Metadata: `:stage` (`:init`, `:connect`, `:publish`, `:play` or
    `:codec`) and `:reason`

### `[:rtmp, :publish, :start]`

A publish was accepted.

  * Measurements: `%{system_time: integer}`
  * Metadata: `:app`

### `[:rtmp, :publish, :stop]`

A publish ended.

  * Measurements: `%{duration: native_time}`
  * Metadata: `:app`, `:reason`

### `[:rtmp, :bytes, :in]`

Bytes received from the client, emitted per socket read.

  * Measurements: `%{bytes: integer}`

### `[:rtmp, :protocol, :error]`

The client sent something invalid.

  * Measurements: `%{}`
  * Metadata: `:reason`, and `:fatal?` — `true` when the connection is
    being closed because of it, `false` when only one frame was dropped
    (e.g. a malformed H.264 payload) and the stream continues.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
