DDTrace.Integrations.HTTP (dd_trace_ex v0.1.0)

Copy Markdown View Source

The HTTP tag keys, and the pieces every HTTP integration needs.

Datadog's UI reads these keys by name: http.status_code colours a span and feeds error rates, http.route is what endpoints aggregate by. They are ordinary string tags — the tracer does not intercept them, unlike the keys in DDTrace.Tags — so an integration writes them like any other tag and this module exists to spell them without a typo.

DDTrace.set_tag(DDTrace.Integrations.HTTP.status_code(), conn.status)

DDTrace.Integrations.Phoenix was the first consumer; client integrations are the next, which is why the destination host and port keys live here too. build_url/1 is here rather than in any one of them because it is about HTTP, not about Phoenix or a client: both sides build the same URL.

Examples

iex> DDTrace.Integrations.HTTP.route()
"http.route"

Summary

Functions

The port a client span talked to: "network.destination.port". A numeric metric, not a tag — write it with DDTrace.set_metric/2.

The request method: "http.method".

The host a client span talked to: "out.host". Shared with the database integrations, which name their server the same way.

The route pattern the request matched: "http.route".

The response status: "http.status_code". A string, like every meta value — Datadog reads it as one.

The request URL: "http.url".

The client's User-Agent: "http.useragent".

Functions

destination_port()

@spec destination_port() :: String.t()

The port a client span talked to: "network.destination.port". A numeric metric, not a tag — write it with DDTrace.set_metric/2.

method()

@spec method() :: String.t()

The request method: "http.method".

out_host()

@spec out_host() :: String.t()

The host a client span talked to: "out.host". Shared with the database integrations, which name their server the same way.

route()

@spec route() :: String.t()

The route pattern the request matched: "http.route".

status_code()

@spec status_code() :: String.t()

The response status: "http.status_code". A string, like every meta value — Datadog reads it as one.

url()

@spec url() :: String.t()

The request URL: "http.url".

useragent()

@spec useragent() :: String.t()

The client's User-Agent: "http.useragent".