Opentelemetry 目标分配器不分配发现的 ServiceMonitors

问题描述 投票:0回答:1

我使用以下内容部署了 Opentelemetry 收集器:

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel-metrics
  namespace: otel-metrics
spec:
  mode: statefulset
  targetAllocator:
    enabled: true
    serviceAccount: opentelemetry-targetallocator-sa
    prometheusCR:
      enabled: true
  config: |
    receivers:
      prometheus:
        config:
          scrape_configs:
          - job_name: 'otel-metrics'
            scrape_interval: 30s
            static_configs:
            - targets: [ '0.0.0.0:8888' ]

    exporters:
      logging:
        verbosity: detailed
      prometheus:
        endpoint: "0.0.0.0:8889"
        send_timestamps: true
        metric_expiration: 180m

    service:
      pipelines:
        metrics:
          receivers:
          - prometheus
          processors: []
          exporters:
          - logging
          - prometheus
      telemetry:
        logs:
          level: "debug"

但是,当我查看收集器的配置映射时,我可以看到它创建的 URL 仅在寻找

otel-metrics
的作业:

receivers:
  prometheus:
    config:
      scrape_configs:
      - http_sd_configs:
        - url: http://otel-metrics-targetallocator:80/jobs/otel-metrics/targets?collector_id=$POD_NAME

如果我卷曲端点

http://otel-metrics-targetallocator:80/jobs
,我可以看到还有很多其他作业(例如以下),但这些显然不会被收集器拾取,因为 URL 的范围仅限于
otel-metrics
作业.

"serviceMonitor/monitoring/kube-state-metrics/0": {
  "_link": "/jobs/serviceMonitor%2Fmonitoring%2Fkube-state-metrics%2F0/targets"
},

如何让目标分配器将所有 serviceMonitor 置于一项作业下,以便可由一个收集器拾取它们?

prometheus metrics open-telemetry
1个回答
0
投票

您的普罗米修斯配置中似乎没有目标分配器块(参见此处的示例),添加这将告诉您的收集器发现那些服务监视器作业。我们还提供 alpha 支持,通过在操作员部署上设置功能门来自动执行此操作(示例)。我认为可能是时候将功能门转移到测试版了,我已经打开了一个问题来准确地说:)

© www.soinside.com 2019 - 2024. All rights reserved.