Spandex.Span (Spandex v3.1.0) View Source
A container for all span data and metadata.
Link to this section Summary
Functions
Create a new span.
Link to this section Types
Specs
t() :: %Spandex.Span{ completion_time: Spandex.timestamp() | nil, env: String.t() | nil, error: Keyword.t() | nil, http: Keyword.t() | nil, id: Spandex.id(), name: String.t(), parent_id: Spandex.id() | nil, private: Keyword.t(), resource: atom() | String.t(), service: atom(), services: Keyword.t() | nil, sql_query: Keyword.t() | nil, start: Spandex.timestamp(), tags: Keyword.t() | nil, trace_id: Spandex.id(), type: atom() }
Link to this section Functions
Specs
child_of(t(), String.t(), Spandex.id(), Spandex.timestamp(), Keyword.t()) :: {:ok, t()} | {:error, [Optimal.error()]}
Specs
new(Keyword.t()) :: {:ok, t()} | {:error, [Optimal.error()]}
Create a new span.
Opts
id
(:any
) Requiredname
(:string
) Requiredservice
(:atom
) Requiredstart
(:integer
) Requiredtrace_id
(:any
) Requiredcompletion_time
(:integer
)env
(:string
)error
(:keyword
)http
(:keyword
)parent_id
(:any
)private
(:keyword
) - Default: []resource
([:atom, :string]
)services
(:keyword
) - Default: []sql_query
(:keyword
)tags
(:keyword
) - Default: []type
(:atom
)
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: [private: [], services: [], tags: []], describe: [], extra_keys?: true, opts: [:completion_time, :env, :error, :http, :id, :name, :parent_id, :private, :resource, :service, :services, :sql_query, :start, :tags, :trace_id, :type], required: [:id, :name, :service, :start, :trace_id], types: [completion_time: :integer, env: :string, error: :keyword, http: :keyword, id: :any, name: :string, parent_id: :any, private: :keyword, resource: [:atom, :string], service: :atom, services: :keyword, sql_query: :keyword, start: :integer, tags: :keyword, trace_id: :any, type: :atom]}, :required, []))
View SourceSpecs
update(t() | nil, Keyword.t(), Optimal.Schema.t()) :: {:ok, t()} | {:error, [Optimal.error()]}
Update an existing span.
Opts
completion_time
(:integer
)env
(:string
)error
(:keyword
)http
(:keyword
)id
(:any
)name
(:string
)parent_id
(:any
)private
(:keyword
) - Default: []resource
([:atom, :string]
)service
(:atom
)services
(:keyword
) - Default: []sql_query
(:keyword
)start
(:integer
)tags
(:keyword
) - Default: []trace_id
(:any
)type
(:atom
)
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: __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: [
...
]
]