OtlpShipper.Resource (otlp_shipper v0.1.1)

Copy Markdown View Source

Builds a shared OTLP Resource with an explicit service identity.

Summary

Functions

Resolves resource attributes from explicit options over an environment map.

Functions

new(opts, env \\ %{})

@spec new(keyword(), map()) :: {:ok, map()} | {:error, atom()}

Resolves resource attributes from explicit options over an environment map.

:resource is a map of string/atom keys. :service_name, :service_version, and :service_instance_id override its identity attributes. OTEL_SERVICE_NAME overrides service.name in OTEL_RESOURCE_ATTRIBUTES. No environment is read implicitly. A missing or blank service name is an initialization error.

iex> {:ok, resource} = OtlpShipper.Resource.new([service_name: "checkout"], %{})
iex> resource.attributes
[%{key: "service.name", value: %{value: {:string_value, "checkout"}}}]