Skip to content

Commit

Permalink
Add Nomad examples on "Getting Started"
Browse files Browse the repository at this point in the history
  • Loading branch information
lgfa29 committed Jun 28, 2021
1 parent a77ce75 commit 1bfaf5b
Show file tree
Hide file tree
Showing 4 changed files with 801 additions and 0 deletions.
125 changes: 125 additions & 0 deletions examples/nomad/otel-agent.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
job "otel-agent" {
datacenters = ["dc1"]
type = "system"

group "otel-agent" {
network {
port "metrics" {
to = 8888
}

# Receivers
port "otlp" {
to = 4317
}

# Extensions
port "health-check" {
to = 13133
}

port "zpages" {
to = 55679
}
}

service {
name = "otel-agent"
port = "health-check"
tags = ["health"]

check {
type = "http"
port = "health-check"
path = "/"
interval = "5s"
timeout = "2s"
}
}

service {
name = "otel-agent"
port = "otlp"
tags = ["otlp"]
}

service {
name = "otel-agent"
port = "metrics"
tags = ["metrics"]
}

service {
name = "otel-agent"
port = "zpages"
tags = ["zpages"]
}

task "otel-agent" {
driver = "docker"

config {
image = "otel/opentelemetry-collector-dev:latest"

entrypoint = [
"/otelcol",
"--config=local/config/otel-agent-config.yaml",
# Memory Ballast size should be max 1/3 to 1/2 of memory.
"--mem-ballast-size-mib=165"
]

ports = [
"metrics",
"otlp",
"health-check",
"zpages",
]
}

resources {
cpu = 500
memory = 500
}

template {
data = <<EOF
receivers:
otlp:
protocols:
grpc:
http:
exporters:
otlp:
endpoint: "{{ with service "otel-collector" }}{{ with index . 0 }}{{ .Address }}:{{ .Port }}{{ end }}{{ end }}"
insecure: true
sending_queue:
num_consumers: 4
queue_size: 100
retry_on_failure:
enabled: true
processors:
batch:
memory_limiter:
# Same as --mem-ballast-size-mib CLI argument
ballast_size_mib: 165
# 80% of maximum memory up to 2G
limit_mib: 400
# 25% of limit up to 2G
spike_limit_mib: 100
check_interval: 5s
extensions:
health_check: {}
zpages: {}
service:
extensions: [health_check, zpages]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp]
EOF
destination = "local/config/otel-agent-config.yaml"
}
}
}
}
166 changes: 166 additions & 0 deletions examples/nomad/otel-collector.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
job "otel-collector" {
datacenters = ["dc1"]
type = "service"

group "otel-collector" {
count = 1

network {
port "metrics" {
to = 8888
}

# Receivers
port "otlp" {
to = 4317
}

port "jaeger-grpc" {
to = 14250
}

port "jaeger-thrift-http" {
to = 14268
}

port "zipkin" {
to = 9411
}

# Extensions
port "health-check" {
to = 13133
}

port "zpages" {
to = 55679
}
}

service {
name = "otel-collector"
port = "health-check"
tags = ["health"]

check {
type = "http"
port = "health-check"
path = "/"
interval = "5s"
timeout = "2s"
}
}

service {
name = "otel-collector"
port = "otlp"
tags = ["otlp"]
}

service {
name = "otel-collector"
port = "jaeger-grpc"
tags = ["jaeger-grpc"]
}

service {
name = "otel-collector"
port = "jaeger-thrift-http"
tags = ["jaeger-thrift-http"]
}

service {
name = "otel-collector"
port = "zipkin"
tags = ["zipkin"]
}

service {
name = "otel-agent"
port = "metrics"
tags = ["metrics"]
}

service {
name = "otel-agent"
port = "zpages"
tags = ["zpages"]
}

task "otel-collector" {
driver = "docker"

config {
image = "otel/opentelemetry-collector-dev:latest"

entrypoint = [
"/otelcol",
"--config=local/config/otel-collector-config.yaml",
# Memory Ballast size should be max 1/3 to 1/2 of memory.
"--mem-ballast-size-mib=683"
]

ports = [
"metrics",
"otlp",
"jaeger-grpc",
"jaeger-thrift-http",
"zipkin",
"health-check",
"zpages",
]
}

resources {
cpu = 500
memory = 2048
}

template {
data = <<EOF
receivers:
otlp:
protocols:
grpc:
http:
jaeger:
protocols:
grpc:
thrift_http:
zipkin: {}
processors:
batch:
memory_limiter:
# Same as --mem-ballast-size-mib CLI argument
ballast_size_mib: 683
# 80% of maximum memory up to 2G
limit_mib: 1500
# 25% of limit up to 2G
spike_limit_mib: 512
check_interval: 5s
extensions:
health_check: {}
zpages: {}
exporters:
zipkin:
endpoint: "http://somezipkin.target.com:9411/api/v2/spans" # Replace with a real endpoint.
jaeger:
endpoint: "somejaegergrpc.target.com:14250" # Replace with a real endpoint.
insecure: true
service:
extensions: [health_check, zpages]
pipelines:
traces/1:
receivers: [otlp, zipkin]
processors: [memory_limiter, batch]
exporters: [zipkin]
traces/2:
receivers: [otlp, jaeger]
processors: [memory_limiter, batch]
exporters: [jaeger]
EOF
destination = "local/config/otel-collector-config.yaml"
}
}
}
}
Loading

0 comments on commit 1bfaf5b

Please sign in to comment.