|
| 1 | +--- |
| 2 | +title: 'Target Allocator' |
| 3 | +description: |
| 4 | + This page provides an introduction to the Target Allocator |
| 5 | +path: '/docs/getting-started/adot-eks-add-on/target-allocator' |
| 6 | +--- |
| 7 | + |
| 8 | +Installing the EKS Add-on gives you access to the Target Allocator (TA). Enabling the Target Allocator for an |
| 9 | +OpenTelemetry Collector custom resource decouples Prometheus service discovery and metrics collection. When enabled, |
| 10 | +the Target Allocator manages the configuration of the Prometheus receiver. Specifically, |
| 11 | +the Target Allocator allows for distribution of Prometheus scrape targets across a pool of Collectors. This functionality can |
| 12 | +be used to avoid the manual sharding of Prometheus scrape targets that can be required when horizontally scaling |
| 13 | +a single Prometheus receiver configuration. |
| 14 | +Visit the [Target Allocator Readme](https://github.com/open-telemetry/opentelemetry-operator/blob/main/cmd/otel-allocator/README.md) |
| 15 | +for a deeper introduction. |
| 16 | + |
| 17 | +## Out of Order Samples |
| 18 | + |
| 19 | +In some cases the Target Allocator can be used to solve Prometheus remote write out of order sample errors. A common |
| 20 | +reason Collector users will see out of order sample erorrs is due to multiple collectors scraping the same metric |
| 21 | +endpoint. Collector users may experience this when horizontally scaling Collectors with Prometheus |
| 22 | +receivers or daemonset deployments without manually sharding scrape targets. Both of these scenarios can lead to |
| 23 | +out of order sample erorrs without sharding of Prometheus scrape targets. |
| 24 | + |
| 25 | +## Getting Started |
| 26 | + |
| 27 | +Enabling the target allocator requires setting `OpenTelemeteryCollector.spec.targetAllocator.enabled` to `true`. |
| 28 | +This will cause the Prometheus configuration within the Collector CRD to be rewritten to use an `http_sd_config` |
| 29 | +from the Target Allocator. The operator will also create a new deployment and service for this http_sd_config |
| 30 | +directive. |
| 31 | + |
| 32 | +``` |
| 33 | +apiVersion: opentelemetry.io/v1alpha1 |
| 34 | +kind: OpenTelemetryCollector |
| 35 | +metadata: |
| 36 | + name: collector-with-ta |
| 37 | +spec: |
| 38 | + mode: statefulset |
| 39 | + servicAccount: adot-collector |
| 40 | + targetAllocator: |
| 41 | + enabled: true |
| 42 | + config: | |
| 43 | + receivers: |
| 44 | + prometheus: |
| 45 | + config: |
| 46 | + scrape_configs: |
| 47 | + - job_name: 'otel-collector' |
| 48 | + scrape_interval: 10s |
| 49 | + static_configs: |
| 50 | + - targets: [ '0.0.0.0:8888' ] |
| 51 | + metric_relabel_configs: |
| 52 | + - action: labeldrop |
| 53 | + regex: (id|name) |
| 54 | + replacement: $$1 |
| 55 | + - action: labelmap |
| 56 | + regex: label_(.+) |
| 57 | + replacement: $$1 |
| 58 | + |
| 59 | + processors: |
| 60 | + batch: |
| 61 | +
|
| 62 | + exporters: |
| 63 | + prometheusremotewrite: |
| 64 | + endpoint: ${AMP_REMOTE_WRITE_URL} |
| 65 | + auth: |
| 66 | + authenticator: sigv4auth |
| 67 | + |
| 68 | + extensions: |
| 69 | + sigv4auth: |
| 70 | + region: ${AWS_REGION} |
| 71 | + service: "aps" |
| 72 | +
|
| 73 | +
|
| 74 | + service: |
| 75 | + pipelines: |
| 76 | + metrics: |
| 77 | + receivers: [prometheus] |
| 78 | + processors: [batch] |
| 79 | + exporters: [prometheusremotewrite] |
| 80 | +``` |
| 81 | + |
| 82 | +Please reference the [OpenTelemetry Operator documentation](https://github.com/open-telemetry/opentelemetry-operator/tree/main#target-allocator) |
| 83 | +for more information on using the Target Allocator. |
| 84 | + |
| 85 | +### Useful links |
| 86 | + |
| 87 | +[Target Allocator API Spec](https://github.com/open-telemetry/opentelemetry-operator/blob/main/docs/api.md#opentelemetrycollectorspectargetallocator) |
| 88 | + |
| 89 | +[Scaling OpenTelmetery Collectors](https://opentelemetry.io/docs/collector/scaling/) |
| 90 | + |
| 91 | +--- |
| 92 | +## [Previous Topic: Kubernetes Attributes Processor](/docs/getting-started/adot-eks-add-on/k8s-attr-processor) |
| 93 | + |
| 94 | +## Related Topics: |
| 95 | + |
| 96 | +### [Collector Configuration for Amazon Managed Prometheus](/docs/getting-started/adot-eks-add-on/config-amp) |
| 97 | + |
| 98 | +### [Collector Configuration for AWS CloudWatch](/docs/getting-started/adot-eks-add-on/config-cloudwatch) |
| 99 | + |
| 100 | +### [Advanced Collector Configuration for Amazon Managed Prometheus](/docs/getting-started/adot-eks-add-on/config-advanced) |
| 101 | + |
| 102 | +## [Next Topic: Updating and Cleanup](/docs/getting-started/adot-eks-add-on/update-and-cleanup) |
0 commit comments