Configurationedit

Configure the agent with AgentConfiguration in the agent’s start() function.

let config =  AgentConfiguration()
config.collectorHost = "192.168.0.1"
config.collectorPort = 8200
config.collectorTLS = true
config.secretToken = "<secret token>"
Agent.start(with:config)

Configuration optionsedit

collectorHostedit

  • Type: String
  • Default: 127.0.0.1

The APM Server host.

collectorPortedit

  • Type: Int
  • Default: 8200

The APM Server port.

collectorTLSedit

  • Type: Bool
  • Default: false

Flags whether the APM Server is secured with TLS.

secretTokenedit

  • 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 define per OpenTelemetry Protocol Exporter Config (e.g.: OTEL_EXPORTER_OTLP_HEADERS="Authorization=bearer <secret token>")