A OpenTelemetry Protocol adapter for the Spandex library.
Add spandex_otlp
to your list of dependencies in mix.exs
:
def deps do
[
{:spandex_otlp, "~> 0.1.0-rc.2"}
]
end
You must first follow the steps in the Spandex guide to get Spandex setup while substituting SpandexOTLP.Adapter
for SpandexDatadog.Adapter
.
config :my_app, MyApp.Tracer,
adapter: SpandexOTLP.Adapter
Then make the following changes to your config.exs
to configure this adapter.
config :spandex_otlp, SpandexOTLP,
otp_app: :my_app,
endpoint: "<host:port>",
ca_cert_file: "./tls/ca.pem", # Path to your PEM file in your priv directory. Only if you plan on using HTTPS.
headers: %{},
resources: %{
"service.name" => "<Your Service Name>",
"service.namespace" => "<Your Service Namespace>"
}
Then add SpandexOTLP.Sender
to your application supervision tree.
children = [
SpandexOTLP.Sender
]
If you plan on using Lightstep with this adapter. You can follow this example config to get started.
config :spandex_otlp, SpandexOTLP,
otp_app: :my_app,
endpoint: "ingest.lightstep.com:443",
ca_cert_file: "./tls/ca.pem", # It's required to use HTTPS with Lightstep
headers: %{
"lightstep-access-token": "<your lightstep access token>"
},
resources: %{
"service.name" => "<Your Service Name>", # Required by Lightstep
"service.namespace" => "<Your Service Namespace>" # Required by Lightstep
}
protoc -I opentelemetry-proto --elixir_out=plugins=grpc:./lib/spandex_otlp opentelemetry-proto/**/*/*.proto