Configurationedit

Configure the agent with AgentConfigBuilder passing the AgentConfiguration to the start function.

let config = AgentConfigBuilder()
                .withServerUrl(URL(string: "http://localhost:8200"))
                .withSecretToken("<Token>")
                .build()

Agent.start(with:config)

The AgentConfigBuilder can be configured with the following functions

Configuration optionsedit

withServerUrledit

  • Type: URL
  • Default: http://127.0.0.1:8200

    withSecretTokenedit

  • Type: String
  • Default: nil
  • Env: OTEL_EXPORTER_OTLP_HEADERS

Sets the secret token for connecting to an authenticated APM Server. If using the env-var, the whole header map must be defined per OpenTelemetry Protocol Exporter Config (e.g.: OTEL_EXPORTER_OTLP_HEADERS="Authorization=bearer <secret token>")

This setting is mutually exclusive with withApiKey

withApiKeyedit

  • Type: String
  • Default:* nil
  • Env: OTEL_EXPORTER_OTLP_HEADERS

Sets the API Token for connecting to an authenticated APM Server. If using the env-var, the whole header map must be defined per OpenTelemetry Protocol Exporter Config (e.g.: OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey <key>")

This setting is mutually exclusive with withSecretToken