### Configure Erlang Extra Applications Source: https://hexdocs.pm/opengleametry/2.0.0 Specifies additional Erlang applications to be started for OpenTelemetry integration. This is typically added to the `gleam.toml` file. ```toml [erlang] extra_applications = ["inets", "ssl"] ``` -------------------------------- ### Basic Span Creation with Open Gleametry Source: https://hexdocs.pm/opengleametry/2.0.0 Demonstrates the fundamental usage of creating a span for a block of code. This span will automatically be bound to a trace and can be used for monitoring and debugging. ```gleam import opengleametry/span { use ctx <- span.with("example span", []) todo } ``` -------------------------------- ### Run Jaeger Collector Source: https://hexdocs.pm/opengleametry/2.0.0 Launches the Jaeger all-in-one Docker image to collect and visualize traces. This command sets up the collector on the host network. ```docker docker run --rm --name jaeger --network host \ cr.jaegertracing.io/jaegertracing/jaeger:2.10.0 ``` -------------------------------- ### Run Grafana OpenTelemetry Collector Source: https://hexdocs.pm/opengleametry/2.0.0 Launches the Grafana OpenTelemetry LGTM Docker image for collecting and visualizing telemetry data. This command sets up the collector on the host network. ```docker docker run --rm --network host -ti grafana/otel-lgtm ``` -------------------------------- ### Set OpenTelemetry Environment Variables (Zsh/Fish) Source: https://hexdocs.pm/opengleametry/2.0.0 Configures environment variables for the OpenTelemetry exporter, specifying the service name, endpoint, and headers. This is for use in Zsh or Fish shell environments before running the application. ```shell set -x OTEL_SERVICE_NAME "your_application" set -x OTEL_EXPORTER_OTLP_ENDPOINT "http://localhost:4318" set -x OTEL_EXPORTER_OTLP_HEADERS "x-service-api-key=12345" gleam run ``` -------------------------------- ### Configure Open Gleametry Handlers Source: https://hexdocs.pm/opengleametry/2.0.0 Replaces the default crash report handler with one that generates an OpenTelemetry span for crash reports. This aids in debugging by linking crashes to specific spans. ```gleam opengleametry.remove_default_handler() opengleametry.set_sasl_handler() ``` -------------------------------- ### Set OpenTelemetry Environment Variables (Bash) Source: https://hexdocs.pm/opengleametry/2.0.0 Configures environment variables for the OpenTelemetry exporter, specifying the service name, endpoint, and headers. This is for use in Bash environments before running the application. ```bash export OTEL_SERVICE_NAME="your_application" export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" export OTEL_EXPORTER_OTLP_HEADERS="x-service-api-key=12345" gleam run ``` -------------------------------- ### Create Nested Span with Links Source: https://hexdocs.pm/opengleametry/2.0.0 Demonstrates creating a nested span that includes a link to its parent span. This is useful for establishing relationships between spans in asynchronous operations or across processes. ```gleam // a link needs a current context; we create one here use ctx <- span.with("Main", []) let link = link.current() let _pid = process.spawn(fn() { use ctx <- span.with_links("nested", [link], []) echo ctx }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.