View Source Appsignal.Span (AppSignal v2.5.1)
Link to this section Summary
Functions
Add an error to an Appsignal.Span
by passing an exception from a rescue
block, and a stack trace.
Add an error to an Appsignal.Span
by passing a kind
and reason
from a
catch
block, and a stack trace.
Close an Appsignal.Span
.
Close an Appsignal.Span
with an explicit end time.
Create a child Appsignal.Span
.
Create a child Appsignal.Span
with an explicit start time.
Create a root Appsignal.Span
with a namespace and a pid.
Create a root Appsignal.Span
with a namespace, a pid and an explicit start time.
Sets an Appsignal.Span
attribute.
Sets an Appsignal.Span
's name.
Sets an Appsignal.Span
's namespace. The namespace is "http_request"
or
"background_job'
to add the span to the "web" and "background" namespaces
respectively. Passing another string creates a custom namespace to store the
Appsignal.Span
's samples in.
Sets sample data for an Appsignal.Span
.
Sets the "appsignal:body"
attribute with an SQL query string.
Link to this section Types
Link to this section Functions
@spec add_error(t() | nil, Exception.t(), Exception.stacktrace()) :: t() | nil
Add an error to an Appsignal.Span
by passing an exception from a rescue
block, and a stack trace.
example
Example
span = Appsignal.Tracer.root_span()
try
raise "Exception!"
rescue
exception ->
Appsignal.Span.add_error(span, exception, __STACKTRACE__)
end
@spec add_error(t() | nil, Exception.kind(), any(), Exception.stacktrace()) :: t() | nil
Add an error to an Appsignal.Span
by passing a kind
and reason
from a
catch
block, and a stack trace.
example
Example
span = Appsignal.Tracer.root_span()
try
raise "Exception!"
catch
kind, reason ->
Appsignal.Span.add_error(span, kind, reason, __STACKTRACE__)
end
Close an Appsignal.Span
.
example
Example
Appsignal.Tracer.root_span()
|> Span.close()
Close an Appsignal.Span
with an explicit end time.
example
Example
Appsignal.Tracer.root_span()
|> Span.close(span, :os.system_time())
Create a child Appsignal.Span
.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.create_child(self())
Create a child Appsignal.Span
with an explicit start time.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.create_child(self(), :os.system_time())
Create a root Appsignal.Span
with a namespace and a pid.
For a description of namespaces, see set_namespace/2
.
example
Example
Appsignal.Span.create_root("http_request", self())
Create a root Appsignal.Span
with a namespace, a pid and an explicit start time.
For a description of namespaces, see set_namespace/2
.
example
Example
Appsignal.Span.create_root("http_request", self(), :os.system_time())
@spec set_attribute( t() | nil, String.t(), String.t() | integer() | boolean() | float() ) :: t() | nil
Sets an Appsignal.Span
attribute.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_attribute("appsignal:category", "query.ecto")
Sets an Appsignal.Span
's name.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_name("PageController#index")
Sets an Appsignal.Span
's namespace. The namespace is "http_request"
or
"background_job'
to add the span to the "web" and "background" namespaces
respectively. Passing another string creates a custom namespace to store the
Appsignal.Span
's samples in.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_namespace("http_request")
Sets sample data for an Appsignal.Span
.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_sample_data("environment", %{"method" => "GET"})
Sets the "appsignal:body"
attribute with an SQL query string.
example
Example
Appsignal.Tracer.root_span()
|> Appsignal.Span.set_sql("SELECT * FROM users")