菜单
文档breadcrumb arrow Beylabreadcrumb arrow 配置breadcrumb arrow 过滤数据
Grafana Cloud

按属性值过滤指标和跟踪

您可能希望根据属性值将报告的指标和跟踪限制为非常具体的事件类型(例如,过滤网络指标以仅报告 TCP 流量)。

filter YAML 部分允许按属性值过滤应用和网络指标。其结构如下

yaml
filter:
  application:
    # map of attribute matches to restrict application metrics
  network:
    # map of attribute matches to restrict network metrics

有关应用和网络系列下的指标及其属性列表,请查阅Beyla 导出的指标文档。

每个 applicationnetwork 过滤部分都是一个映射,其中每个键都是一个属性名(可以是 Prometheus 或 OpenTelemetry 格式),带有 matchnot_match 属性。这两个属性都接受类似于 glob 的字符串(可以是完整值或包含通配符)。如果设置了 match 属性,Beyla 仅报告与给定属性的提供值匹配的指标和跟踪。not_match 属性与 match 相反。

以下示例报告了针对目标端口 53 的连接的网络指标,但不包括 UDP 协议

yaml
filter:
  network:
    transport:
      not_match: UDP
    dst_port:
      match: "53"