Skip to content

Instantly share code, notes, and snippets.

@zimbatm
Created March 1, 2022 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zimbatm/5168c5a6d985286137cc67e7eab91ae0 to your computer and use it in GitHub Desktop.
Save zimbatm/5168c5a6d985286137cc67e7eab91ae0 to your computer and use it in GitHub Desktop.
variable "honeycomb_dataset" {}
variable "honeycomb_api_key" { default = "1ae3cea44e0026bf01627c6bab6f5227" }
variable "region" {}
resource "helm_release" "opentelemetry_collector" {
atomic = true
chart = "opentelemetry-collector"
name = "opentelemetry-collector"
repository = "https://open-telemetry.github.io/opentelemetry-helm-charts"
verify = false
version = "0.8.1"
wait = true
values = [<<-EOT
agentCollector:
enabled: true
configOverride:
processors:
attributes:
actions:
- key: region
value: "${var.region}"
action: insert
exporters:
otlp:
endpoint: "api.honeycomb.io:443"
headers:
"x-honeycomb-team": "${var.honeycomb_api_key}"
"x-honeycomb-dataset": "${var.honeycomb_dataset}"
service:
extensions:
health_check: {}
pipelines:
traces:
receivers: [zipkin, jaeger]
processors: [attributes, batch]
exporters: [otlp]
containerLogs:
enabled: false
EOT
]
}
// We disguise the the OTEL collector as grafana_agent_traces so that
// we don't have to change any endpoints in our configurations.
resource "kubernetes_service" "grafana_agent_traces" {
metadata {
name = "grafana-agent-traces"
namespace = "default"
labels = {
name = "grafana-agent-traces"
}
}
spec {
port {
name = "agent-http-metrics"
port = 8080
target_port = "8080"
}
port {
name = "agent-thrift-compact"
protocol = "UDP"
port = 6831
target_port = "6831"
}
port {
name = "agent-thrift-binary"
protocol = "UDP"
port = 6832
target_port = "6832"
}
port {
name = "agent-thrift-http"
protocol = "TCP"
port = 14268
target_port = "14268"
}
port {
name = "agent-thrift-grpc"
protocol = "TCP"
port = 14250
target_port = "14250"
}
port {
name = "agent-zipkin"
protocol = "TCP"
port = 9411
target_port = "9411"
}
port {
name = "agent-otlp"
protocol = "TCP"
port = 55680
target_port = "55680"
}
port {
name = "agent-opencensus"
protocol = "TCP"
port = 55678
target_port = "55678"
}
selector = {
"app.kubernetes.io/name" = "opentelemetry-collector"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment