Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active March 28, 2021 22:12
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 pcolazurdo/53ea910ba670d50017a99dc0f177ef18 to your computer and use it in GitHub Desktop.
Save pcolazurdo/53ea910ba670d50017a99dc0f177ef18 to your computer and use it in GitHub Desktop.
OpenTelemetry Playground

On EC2, when updating Cloudwatch agent to a version > 1.247347.3 you get (OTEL support in the CloudWatch Agent)[https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-open-telemetry.html]

To setup a default config you just run:

sudo /usr/bin/amazon-cloudwatch-agent-ctl -a fetch-config -o default -s
# to check if the agent is succesfully configured just run:
netstat -an | grep 55681  # OTLP HTTP Receiver
netstat -an | grep 2000  # AWS X-Ray Receiver

Some important files:

  • /opt/aws/amazon-cloudwatch-agent/bin/cwagent-otel-collector
  • /opt/aws/amazon-cloudwatch-agent/cwagent-otel-collector/etc/cwagent-otel-collector.yaml
# Config file to add a Prometheus receiver - not fully as I can't make it scrape another process yet
extensions:
health_check:
receivers:
prometheus:
config:
scrape_configs:
- job_name: "otel-collector"
scrape_interval: 5s
static_configs:
- targets: ["localhost:8000"]
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:55680
http:
endpoint: 0.0.0.0:55681
awsxray:
endpoint: 0.0.0.0:2000
transport: udp
processors:
batch/traces:
timeout: 1s
send_batch_size: 50
batch/metrics:
timeout: 60s
exporters:
awsxray:
awsemf:
service:
pipelines:
traces:
receivers: [otlp,awsxray]
processors: [batch/traces]
exporters: [awsxray]
metrics:
receivers: [otlp, prometheus]
processors: [batch/metrics]
exporters: [awsemf]
extensions: [health_check]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment