ExInsights v0.5.2 ExInsights View Source
Exposes methods for POST events & metrics to Azure Application Insights. For more information on initialization and usage consult the README.md
Link to this section Summary
Types
A map of [name -> number]
to add measurement data to a tracking request
Measurement name. Will be used extensively in the app insights UI
A map of [name -> string]
to add metadata to a tracking request
Defines the level of severity for the event.
Represents the exception's stack trace.
Functions
Log a dependency, for example requests to an external service or SQL calls.
Log a user action or other occurrence.
Log an exception you have caught.
Log a numeric value that is not associated with a specific event.
Log a request, for example incoming HTTP requests
Link to this section Types
A map of [name -> number]
to add measurement data to a tracking request
Measurement name. Will be used extensively in the app insights UI
A map of [name -> string]
to add metadata to a tracking request
severity_level()
View Sourceseverity_level() :: :verbose | :info | :warning | :error | :critical
Defines the level of severity for the event.
Represents the exception's stack trace.
Link to this section Functions
track_dependency(name, command_name, elapsed_time_ms, success, dependency_type_name \\ "", target \\ nil, properties \\ %{}, instrumentation_key \\ nil)
View Sourcetrack_dependency( name :: name(), String.t(), number(), boolean(), String.t(), String.t() | nil, properties :: properties(), instrumentation_key :: instrumentation_key() ) :: :ok
Log a dependency, for example requests to an external service or SQL calls.
Parameters:
name: String that identifies the dependency.
command_name: String of the name of the command made against the dependency (eg. full URL with querystring or SQL command text).
elapsed_time_ms: Number for elapsed time in milliseconds of the command made against the dependency.
success: Boolean which indicates success.
dependency_type_name: String which denotes dependency type. Defaults to nil.
target: String of the target host of the dependency.
properties (optional): map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)
track_event(name, properties \\ %{}, measurements \\ %{}, instrumentation_key \\ nil)
View Sourcetrack_event( name :: name(), properties :: properties(), measurements :: measurements(), instrumentation_key :: instrumentation_key() ) :: :ok
Log a user action or other occurrence.
Parameters:
name: name of the event (string)
properties (optional): a map of [string -> string] pairs for adding extra properties to this event
measurements (optional): a map of [string -> number] values associated with this event that can be aggregated/sumed/etc. on the UI
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)
track_exception(exception, stack_trace, handle_at \\ nil, properties \\ %{}, measurements \\ %{}, instrumentation_key \\ nil)
View Sourcetrack_exception( String.t(), stack_trace :: stack_trace(), String.t() | nil, properties :: properties(), measurements :: measurements(), instrumentation_key :: instrumentation_key() ) :: :ok
Log an exception you have caught.
Parameters:
exception: An Error from a catch clause, or the string error message.
stack_trace: An erlang stacktrace.
properties: map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
measurements: map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)
track_metric(name, value, properties \\ %{}, instrumentation_key \\ nil)
View Sourcetrack_metric( name :: name(), number(), properties :: properties(), instrumentation_key :: instrumentation_key() ) :: :ok
Log a numeric value that is not associated with a specific event.
Typically used to send regular reports of performance indicators.
Parameters:
name: name of the metric
value: the value of the metric (number)
properties (optional): a map of [string -> string] pairs for adding extra properties to this event
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)
track_request(name, url, source, elapsed_time_ms, result_code, success, properties \\ %{}, measurements \\ %{}, id \\ nil, instrumentation_key \\ nil)
View Sourcetrack_request( name :: name(), url :: String.t(), source :: String.t() | nil, elapsed_time_ms :: number(), result_code :: String.t() | number(), success :: boolean(), properties :: properties(), measurements :: measurements(), id :: String.t() | nil, instrumentation_key :: instrumentation_key() ) :: :ok
Log a request, for example incoming HTTP requests
Parameters:
name: String that identifies the request
url: Request URL
source: Request Source. Encapsulates info about the component that initiated the request (can be nil)
elapsed_time_ms: Number for elapsed time in milliseconds
result_code: Result code reported by the application
success: whether the request was successfull
properties (optional): map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
measurements (optional): a map of [string -> number] values associated with this event that can be aggregated/sumed/etc. on the UI
id (optional): a unique identifier representing the request.
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)
track_trace(message, severity_level \\ :info, properties \\ %{}, instrumentation_key \\ nil)
View Sourcetrack_trace( String.t(), severity_level :: severity_level(), properties :: properties(), instrumentation_key :: instrumentation_key() ) :: :ok
Log a trace message.
Parameters:
message: A string to identify this event in the portal.
severity_level: The level of severity for the event.
properties: map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
instrumentation_key (optional): Azure application insights API key. If not set it will be read from the configuration (see README.md)