Spandex v1.6.1 Spandex.Span View Source

A container for all span data and metadata.

Link to this section Summary

Link to this section Types

Link to this type t() View Source
t() :: %Spandex.Span{completion_time: timestamp, env: String.t, error: Keyword.t | nil, http: Keyword.t | nil, id: term, name: String.t, parent_id: term, private: Keyword.t, resource: String.t, service: atom, sql_query: Keyword.t | nil, start: timestamp, tags: Keyword.t | nil, trace_id: term, type: atom}
Link to this type timestamp() View Source
timestamp() :: term

Link to this section Functions

Link to this function child_of(parent, name, id, start, opts) View Source

Create a new span.


Opts

  • id(:any) Required
  • trace_id(:any) Required
  • name(:string) Required
  • env(:string) Required
  • service(:atom) Required
  • start(:any) Required
  • http(:keyword)
  • error(:keyword)
  • completion_time(:any)
  • parent_id(:any)
  • private(:keyword) - Default: []
  • resource([:atom, :string])
  • services(:keyword) - Default: []
  • sql_query(:keyword)
  • type(:atom)
  • tags(:keyword) - Default: []

Also accepts extra opts that are not named here.


Link to this function update(span, opts, schema \\ Map.put(%{__struct__: Optimal.Schema, annotations: [], custom: [], defaults: [tags: [], services: [], private: []], describe: [], extra_keys?: true, opts: [:id, :trace_id, :name, :http, :error, :completion_time, :env, :parent_id, :private, :resource, :service, :services, :sql_query, :start, :type, :tags], required: [:id, :trace_id, :name, :env, :service, :start], types: [id: :any, trace_id: :any, name: :string, http: :keyword, error: :keyword, completion_time: :any, env: :string, parent_id: :any, private: :keyword, resource: [:atom, :string], service: :atom, services: :keyword, sql_query: :keyword, start: :any, type: :atom, tags: :keyword]}, :required, [])) View Source

Update an existing span.


Opts

  • id(:any)
  • trace_id(:any)
  • name(:string)
  • http(:keyword)
  • error(:keyword)
  • completion_time(:any)
  • env(:string)
  • parent_id(:any)
  • private(:keyword) - Default: []
  • resource([:atom, :string])
  • service(:atom)
  • services(:keyword) - Default: []
  • sql_query(:keyword)
  • start(:any)
  • type(:atom)
  • tags(:keyword) - Default: []

Also accepts extra opts that are not named here.


Special Meta

[
  http: [
    url: "my_website.com?foo=bar",
    status_code: "400",
    method: "GET",
    query_string: "foo=bar",
    user_agent: "Mozilla/5.0...",
    request_id: "special_id"
  ],
  error: [
    exception: ArgumentError.exception("foo"),
    stacktrace: System.stacktrace(),
    error?: true # Used for specifying that a span is an error when there is no exception or stacktrace.
  ],
  sql_query: [
    rows: 100,
    db: "my_database",
    query: "SELECT * FROM users;"
  ],
  # Private has the same structure as the outer meta structure, but private metadata does not
  # transfer from parent span to child span.
  private: [
    ...
  ]
]