You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: receiver/receivercreator/README.md
+188Lines changed: 188 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -439,3 +439,191 @@ service:
439
439
440
440
The full list of settings exposed for this receiver are documented [here](./config.go)
441
441
with detailed sample configurations [here](./testdata/config.yaml).
442
+
443
+
444
+
## Generate receiver configurations from provided Hints
445
+
446
+
Note: When hints feature is enabled if hints are present for an endpoint no receiver templates will be evaluated.
447
+
448
+
Currently this feature is only supported for K8s environments and the `k8sobserver`.
449
+
450
+
The discovery feature for K8s is enabled with the following setting:
451
+
452
+
```yaml
453
+
receiver_creator/metrics:
454
+
watch_observers: [ k8s_observer ]
455
+
discovery:
456
+
enabled: true
457
+
# Define which receivers should be ignored when provided through annotations
458
+
# ignore_receivers: []
459
+
```
460
+
461
+
Find bellow the supported annotations that user can define to automatically enable receivers to start collecting metrics signals from the target Pods/containers.
462
+
463
+
### Supported metrics annotations
464
+
465
+
#### Enable/disable discovery
466
+
467
+
`io.opentelemetry.discovery.metrics/enabled`(Required. `"true"` or `"false"`)
where `80` is the port that the target container exposes.
506
+
507
+
If a Pod is annotated with both container level hints and pod level hints the container level hints have priority and
508
+
the Pod level hints are used as a fallback (see detailed example bellow).
509
+
510
+
The current implementation relies on the implementation of `k8sobserver` extension and specifically
511
+
the [pod_endpoint](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.111.0/extension/observer/k8sobserver/pod_endpoint.go).
512
+
The hints are evaluated per container by extracting the annotations from each [`Port` endpoint](#Port) that is emitted.
513
+
514
+
515
+
516
+
### Examples
517
+
518
+
#### Metrics example
519
+
520
+
Collector's configuration:
521
+
```yaml
522
+
receivers:
523
+
receiver_creator/metrics:
524
+
watch_observers: [ k8s_observer ]
525
+
discovery:
526
+
enabled: true
527
+
receivers:
528
+
529
+
service:
530
+
extensions: [ k8s_observer]
531
+
pipelines:
532
+
metrics:
533
+
receivers: [ receiver_creator ]
534
+
processors: []
535
+
exporters: [ debug ]
536
+
```
537
+
538
+
Target Pod annotated with hints:
539
+
540
+
```yaml
541
+
apiVersion: v1
542
+
kind: ConfigMap
543
+
metadata:
544
+
name: nginx-conf
545
+
data:
546
+
nginx.conf: |
547
+
user nginx;
548
+
worker_processes 1;
549
+
error_log /dev/stderr warn;
550
+
pid /var/run/nginx.pid;
551
+
events {
552
+
worker_connections 1024;
553
+
}
554
+
http {
555
+
include /etc/nginx/mime.types;
556
+
default_type application/octet-stream;
557
+
558
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
0 commit comments