amazon-cloudwatch-agent icon indicating copy to clipboard operation
amazon-cloudwatch-agent copied to clipboard

Support Otel Prometheus receiver for AMP as a destination

Open movence opened this issue 1 year ago • 2 comments

Description of changes

Support Otel Prometheus receiver with a new pipeline to export to AMP

Related contrib change to add marshaler https://github.com/amazon-contributing/opentelemetry-collector-contrib/pull/239

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Started a python local server with test prom metrics:

prometheus_test_untyped{include="yes",prom_type="untyped"} 1
# TYPE prometheus_test_counter counter
prometheus_test_counter{include="yes",prom_type="counter"} 1
# TYPE prometheus_test_counter_exclude counter
prometheus_test_counter_exclude{include="no",prom_type="counter"} 1
# TYPE prometheus_test_summary summary
prometheus_test_summary_sum{include="yes",prom_type="summary"} 200
prometheus_test_summary_count{include="yes",prom_type="summary"} 50
prometheus_test_summary{include="yes",quantile="0",prom_type="summary"} 0.1
prometheus_test_summary{include="yes",quantile="0.5",prom_type="summary"} 0.25
prometheus_test_summary{include="yes",quantile="1",prom_type="summary"} 0.5
# TYPE prometheus_test_histogram histogram
prometheus_test_histogram_sum{include="yes",prom_type="histogram"} 200
prometheus_test_histogram_count{include="yes",prom_type="histogram"} 75
prometheus_test_histogram{include="yes",le="0",prom_type="histogram"} 1
prometheus_test_histogram{include="yes",le="0.5",prom_type="histogram"} 2
prometheus_test_histogram{include="yes",le="2.5",prom_type="histogram"} 3
prometheus_test_histogram{include="yes",le="5",prom_type="histogram"} 4
prometheus_test_histogram{include="yes",le="+Inf",prom_type="histogram"} 5

Tested the agent on EC2 to verify metrics being pushed to AMP

  • agent config:
{
  "agent": {
    "metric_collection_internal": 10,
    "run_as_user": "root",
    "debug": true
  },
  "metrics": {
    "metrics_destinations": {
      "amp": {
        "workspace_id": "[amp_ws_id]"
      }
    },
    "metrics_collected": {
      "prometheus": {
        "prometheus_config_path": "/home/ec2-user/prometheus.yaml"
      }
    }
  }
}
  • prometheus config:
global:
  scrape_interval: 60s
  scrape_timeout: 10s
scrape_configs:
  - job_name: 'prometheus_test_job'
    static_configs:
      - targets: ['localhost:8000']
        labels:
          label1: 'test1'

Screenshot 2024-10-11 at 4 50 02 PM

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

movence avatar Oct 11 '24 20:10 movence

Need to rebase on the target-allocator branch.

jefchien avatar Oct 15 '24 21:10 jefchien

Think you need to rebase onto target-allocator again.

jefchien avatar Oct 23 '24 19:10 jefchien