首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在otel-fargate-容器-inghts.yaml的过滤部分访问荚名/lable

如何在otel-fargate-容器-inghts.yaml的过滤部分访问荚名/lable
EN

Stack Overflow用户
提问于 2022-06-16 23:08:37
回答 1查看 93关注 0票数 0

我遵循了https://aws.amazon.com/blogs/containers/introducing-amazon-cloudwatch-container-insights-for-amazon-eks-fargate-using-aws-distro-for-opentelemetry/中的指令,我只想向CloudWatch发送一些度量。我不知道如何访问豆荚的名称/标签,所以我使用了PodName。我搞错了。以下是过滤器部分:

代码语言:javascript
复制
 filter:
        metrics:
          include:
            match_type: expr
            expressions:
            - MetricName startsWith "pod_cpu" 
          exclude:
            match_type: expr
            expressions:
            - not (PodName startsWith "abcd")

部署之后,我检查了日志:

代码语言:javascript
复制
 github.com/prometheus/prometheus@v1.8.2-0.20210621150501-ff58416a0b02/scrape/scrape.go:1148
2022-06-16T22:20:35.131Z        error   filterprocessor@v0.39.0/filter_processor.go:127 shouldKeepMetric failed {"kind": "processor", "name": "filter", "error": "cannot fetch PodName from *filterexpr.env (1:6)\n | not (PodName startsWith \"abcd\")\n | .....^"}
github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor.(*filterMetricProcessor).processMetrics.func1.1.1
        github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor@v0.39.0/filter_processor.go:127
go.opentelemetry.io/collector/model/pdata.MetricSlice.RemoveIf
        go.opentelemetry.io/collector/model@v0.39.0/pdata/generated_metrics.go:538

谢谢你提前帮忙,朱莉

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-17 06:57:18

请参阅https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor#using-an-expr-match_type

Podname是标签,所以它应该是:

代码语言:javascript
复制
          exclude:
            match_type: expr
            expressions:
            - not (Label("PodName") startsWith "abcd")
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72652768

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档