View Source Datadog.DataStreams.Config (Data Streams Ex v1.2.2)

Responsible for parsing application configuration to usable chunks in the application.

Summary

Functions

Checks if the Datadog agent is enabled. By default it is disabled. Disabling will cause the Datadog.DataStreams.Aggregator process to not start or send data to the agent.

Returns a full path to the Datadog agent, joining the given path string. If this configuration is not set, we default to "localhost:8126".

Returns the configured environment tag for this application.

Returns the configured primary tag for all Datadog.DataStreams.Pathways.

Returns the configured service for this application.

Functions

@spec agent_enabled?() :: bool()

Checks if the Datadog agent is enabled. By default it is disabled. Disabling will cause the Datadog.DataStreams.Aggregator process to not start or send data to the agent.

Examples

iex> Config.agent_enabled?
false

iex> Application.put_env(:data_streams, :agent, enabled?: true)
...> Config.agent_enabled?
true
@spec agent_url(String.t()) :: String.t()

Returns a full path to the Datadog agent, joining the given path string. If this configuration is not set, we default to "localhost:8126".

Examples

iex> Config.agent_url("/info")
"http://localhost:8126/info"

iex> Application.put_env(:data_streams, :agent, [host: "my-agent.local", port: 1234])
...> Config.agent_url("/info")
"http://my-agent.local:1234/info"
@spec env() :: String.t()

Returns the configured environment tag for this application.

First, it will try accessing the configured service for :open_telemetry. If that is not set, it tries to use the service configured for :data_streams. If that is not set, it falls back to an empty string.

Note, this will not pull open telemetry attributes set via environment variables.

Examples

iex> Application.put_env(:opentelemetry, :resource, service: %{env: "production"})
...> Config.env()
"production"

iex> Application.put_env(:data_streams, :metadata, env: "staging")
...> Config.env()
"staging"

iex> Config.env()
""
@spec primary_tag() :: String.t()

Returns the configured primary tag for all Datadog.DataStreams.Pathways.

Usually this reflects a data center or some other top level partition for metrics.

If this is not set, it will fall back to an empty string.

Examples

iex> Application.put_env(:data_streams, :metadata, primary_tag: "datacenter:d1")
...> Config.primary_tag()
"datacenter:d1"

iex> Config.primary_tag()
""
@spec service() :: String.t()

Returns the configured service for this application.

First, it will try accessing the configured service for :open_telemetry. If that is not set, it tries to use the service configured for :data_streams. If that is not set, it falls back to "unnamed-elixir-service".

Note, this will not pull open telemetry attributes set via environment variables.

Examples

iex> Application.put_env(:opentelemetry, :resource, service: %{name: "my-elixir-service"})
...> Config.service()
"my-elixir-service"

iex> Application.put_env(:data_streams, :metadata, service: "my-data-streams-service")
...> Config.service()
"my-data-streams-service"

iex> Config.service()
"unnamed-elixir-service"