Highlight (highlight v0.1.0)

Documentation for Highlight.

Install SDK

In your mix.exs file:

  defp deps do
    [
      ...
      {:highlight, "~> 0.1"}
    ]
  end

Summary

Functions

Initialize the Highlight SDK with the given configuration. This sets up Elixir for automatic log collection.

Records an exception and captures relevant contextual information.

Functions

handle_logger_event(event_name, measurements, metadata, config)

init()

Initialize the Highlight SDK with the given configuration. This sets up Elixir for automatic log collection.

Examples

iex> Highlight.init()

record_exception(e, config, session_id \\ nil, request_id \\ nil)

Records an exception and captures relevant contextual information.

This function integrates with OpenTelemetry to report exceptions according to the OpenTelemetry exception reporting specification. It allows you to manually record exceptions in your application, attaching additional context like session and request IDs if available. This is useful for tracking errors across distributed systems and associating them with specific user sessions or requests.

Parameters

  • e: The exception to be recorded. This can be an exception struct, an error tuple, or any Elixir term that represents an error.
  • config: A %Highlight.Config{} struct containing the configuration for the Highlight SDK. This includes the project ID, and optionally, the service name and service version.
  • session_id (optional): A string representing the session ID associated with this exception, which can be used to trace the error back to a specific user session. Defaults to nil.
  • request_id (optional): A string representing the request ID associated with this exception, which can be used to trace the error back to a specific HTTP request. Defaults to nil.

Examples

  try do
    # some code that may raise an error
  rescue
    exception ->
      Highlight.record_exception(exception, %Highlight.Config{
        project_id: "your_project_id",
        service_name: "your_service_name",
        service_version: "1.0.0"
      }, "session_12345", "request_67890")
  end