OpenTelemetry 和 OpenSearch 集成

强大的性能和简单的集成,由 InfluxData 构建的开源数据连接器 Telegraf 提供支持。

info

这不是大规模实时查询的推荐配置。为了优化查询和压缩、高速摄取和高可用性,您可能需要考虑 OpenTelemetry 和 InfluxDB

5B+

Telegraf 下载量

#1

时序数据库
来源:DB Engines

1B+

InfluxDB 下载量

2,800+

贡献者

目录

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。InfluxDB 是排名第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

输入和输出集成概述

此插件通过 gRPC 接收来自 OpenTelemetry 客户端和代理的跟踪、指标和日志,从而实现对应用程序的全面可观测性。

OpenSearch 输出插件允许用户使用 HTTP 将指标直接发送到 OpenSearch 实例,从而促进 OpenSearch 生态系统内有效的数据管理和分析。

集成详情

OpenTelemetry

OpenTelemetry 插件旨在通过 gRPC 接收来自客户端和代理的遥测数据,例如跟踪、指标和日志,这些客户端和代理实现了 OpenTelemetry。此插件启动一个 gRPC 服务,监听传入的遥测数据,这使其与以定义的时间间隔收集指标的标准插件不同。OpenTelemetry 生态系统通过提供一种供应商中立的方式来检测、生成、收集和导出遥测数据,帮助开发人员观察和理解其应用程序的性能。此插件的关键功能包括可自定义的连接超时、可调整的传入数据最大消息大小,以及用于指定 span、log 和 profile 维度以标记传入指标的选项。凭借这种灵活性,组织可以根据精确的可观测性要求定制其遥测数据收集,并确保将数据无缝集成到 InfluxDB 等系统中。

OpenSearch

OpenSearch Telegraf 插件通过 HTTP 与 OpenSearch 数据库集成,从而可以简化指标的收集和存储。作为一个专为 OpenSearch 2.x 版本设计的强大工具,该插件提供了强大的功能,同时通过原始的 Elasticsearch 插件与 1.x 版本兼容。此插件有助于在 OpenSearch 中创建和管理索引,自动管理模板并确保数据结构化以进行有效分析。该插件支持各种配置选项,例如索引名称、身份验证、健康检查和值处理,使其可以根据不同的操作要求进行定制。其功能使其对于希望利用 OpenSearch 的强大功能进行指标存储和查询的组织至关重要。

配置

OpenTelemetry

[[inputs.opentelemetry]]
  ## Override the default (0.0.0.0:4317) destination OpenTelemetry gRPC service
  ## address:port
  # service_address = "0.0.0.0:4317"

  ## Override the default (5s) new connection timeout
  # timeout = "5s"

  ## gRPC Maximum Message Size
  # max_msg_size = "4MB"

  ## Override the default span attributes to be used as line protocol tags.
  ## These are always included as tags:
  ## - trace ID
  ## - span ID
  ## Common attributes can be found here:
  ## - https://github.com/open-telemetry/opentelemetry-collector/tree/main/semconv
  # span_dimensions = ["service.name", "span.name"]

  ## Override the default log record attributes to be used as line protocol tags.
  ## These are always included as tags, if available:
  ## - trace ID
  ## - span ID
  ## Common attributes can be found here:
  ## - https://github.com/open-telemetry/opentelemetry-collector/tree/main/semconv
  ## When using InfluxDB for both logs and traces, be certain that log_record_dimensions
  ## matches the span_dimensions value.
  # log_record_dimensions = ["service.name"]

  ## Override the default profile attributes to be used as line protocol tags.
  ## These are always included as tags, if available:
  ## - profile_id
  ## - address
  ## - sample
  ## - sample_name
  ## - sample_unit
  ## - sample_type
  ## - sample_type_unit
  ## Common attributes can be found here:
  ## - https://github.com/open-telemetry/opentelemetry-collector/tree/main/semconv
  # profile_dimensions = []

  ## Override the default (prometheus-v1) metrics schema.
  ## Supports: "prometheus-v1", "prometheus-v2"
  ## For more information about the alternatives, read the Prometheus input
  ## plugin notes.
  # metrics_schema = "prometheus-v1"

  ## Optional TLS Config.
  ## For advanced options: https://github.com/influxdata/telegraf/blob/v1.18.3/docs/TLS.md
  ##
  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections.
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
  ## Add service certificate and key.
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

OpenSearch

[[outputs.opensearch]]
  ## URLs
  ## The full HTTP endpoint URL for your OpenSearch instance. Multiple URLs can
  ## be specified as part of the same cluster, but only one URLs is used to
  ## write during each interval.
  urls = ["http://node1.os.example.com:9200"]

  ## Index Name
  ## Target index name for metrics (OpenSearch will create if it not exists).
  ## This is a Golang template (see https://pkg.go.dev/text/template)
  ## You can also specify
  ## metric name (`{{.Name}}`), tag value (`{{.Tag "tag_name"}}`), field value (`{{.Field "field_name"}}`)
  ## If the tag does not exist, the default tag value will be empty string "".
  ## the timestamp (`{{.Time.Format "xxxxxxxxx"}}`).
  ## For example: "telegraf-{{.Time.Format \"2006-01-02\"}}-{{.Tag \"host\"}}" would set it to telegraf-2023-07-27-HostName
  index_name = ""

  ## Timeout
  ## OpenSearch client timeout
  # timeout = "5s"

  ## Sniffer
  ## Set to true to ask OpenSearch a list of all cluster nodes,
  ## thus it is not necessary to list all nodes in the urls config option
  # enable_sniffer = false

  ## GZIP Compression
  ## Set to true to enable gzip compression
  # enable_gzip = false

  ## Health Check Interval
  ## Set the interval to check if the OpenSearch nodes are available
  ## Setting to "0s" will disable the health check (not recommended in production)
  # health_check_interval = "10s"

  ## Set the timeout for periodic health checks.
  # health_check_timeout = "1s"
  ## HTTP basic authentication details.
  # username = ""
  # password = ""
  ## HTTP bearer token authentication details
  # auth_bearer_token = ""

  ## Optional TLS Config
  ## Set to true/false to enforce TLS being enabled/disabled. If not set,
  ## enable TLS only if any of the other options are specified.
  # tls_enable =
  ## Trusted root certificates for server
  # tls_ca = "/path/to/cafile"
  ## Used for TLS client certificate authentication
  # tls_cert = "/path/to/certfile"
  ## Used for TLS client certificate authentication
  # tls_key = "/path/to/keyfile"
  ## Send the specified TLS server name via SNI
  # tls_server_name = "kubernetes.example.com"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## Template Config
  ## Manage templates
  ## Set to true if you want telegraf to manage its index template.
  ## If enabled it will create a recommended index template for telegraf indexes
  # manage_template = true

  ## Template Name
  ## The template name used for telegraf indexes
  # template_name = "telegraf"

  ## Overwrite Templates
  ## Set to true if you want telegraf to overwrite an existing template
  # overwrite_template = false

  ## Document ID
  ## If set to true a unique ID hash will be sent as
  ## sha256(concat(timestamp,measurement,series-hash)) string. It will enable
  ## data resend and update metric points avoiding duplicated metrics with
  ## different id's
  # force_document_id = false

  ## Value Handling
  ## Specifies the handling of NaN and Inf values.
  ## This option can have the following values:
  ##    none    -- do not modify field-values (default); will produce an error
  ##               if NaNs or infs are encountered
  ##    drop    -- drop fields containing NaNs or infs
  ##    replace -- replace with the value in "float_replacement_value" (default: 0.0)
  ##               NaNs and inf will be replaced with the given number, -inf with the negative of that number
  # float_handling = "none"
  # float_replacement_value = 0.0

  ## Pipeline Config
  ## To use a ingest pipeline, set this to the name of the pipeline you want to use.
  # use_pipeline = "my_pipeline"

  ## Pipeline Name
  ## Additionally, you can specify a tag name using the notation (`{{.Tag "tag_name"}}`)
  ## which will be used as the pipeline name (e.g. "{{.Tag \"os_pipeline\"}}").
  ## If the tag does not exist, the default pipeline will be used as the pipeline.
  ## If no default pipeline is set, no pipeline is used for the metric.
  # default_pipeline = ""

输入和输出集成示例

OpenTelemetry

  1. 跨服务统一监控:使用 OpenTelemetry 插件收集和整合来自 Kubernetes 环境中各种微服务的遥测数据。通过使用 OpenTelemetry 检测每个服务,您可以利用此插件实时收集应用程序性能和依赖关系的整体视图,从而更快地排除故障并提高复杂系统的可靠性。

  2. 使用跟踪增强调试:实施此插件以捕获流经多个服务的请求的端到端跟踪。例如,当用户发起一个事务,触发多个后端服务时,OpenTelemetry 插件可以记录详细的跟踪,突出显示性能瓶颈,为开发人员提供调试问题和优化代码所需的见解。

  3. 动态负载测试和性能监控:在负载测试阶段,通过在模拟更高负载下收集实时指标和跟踪,来利用此插件的功能。这种方法有助于评估应用程序组件的弹性,并预先识别潜在的性能下降,从而确保在生产环境中获得流畅的用户体验。

  4. 用于实时监控的集成日志记录和指标:将 OpenTelemetry 插件与日志框架结合使用,以收集实时日志以及指标数据,从而创建一个强大的可观测性平台。例如,将其集成到 CI/CD 管道中以监控构建和部署,同时收集有助于实时诊断故障或性能问题的日志。

OpenSearch

  1. 时序数据的动态索引:利用 OpenSearch Telegraf 插件为时序指标动态创建索引,确保数据以有组织的方式存储,有利于基于时间的查询。通过使用 Go 模板定义索引模式,用户可以利用该插件创建每日或每月索引,这可以大大简化数据管理和长期检索,从而提高分析性能。

  2. 多租户应用程序的集中式日志记录:在多租户应用程序中实施 OpenSearch 插件,其中每个租户的日志都发送到单独的索引。这使得可以对每个租户进行有针对性的分析和监控,同时保持数据隔离。通过利用索引名称模板功能,用户可以自动创建租户特定的索引,这不仅简化了流程,还增强了租户数据的安全性和可访问性。

  3. 与机器学习集成以进行异常检测:将 OpenSearch 插件与机器学习工具结合使用,以自动检测指标数据中的异常。通过配置插件将实时指标发送到 OpenSearch,用户可以将机器学习模型应用于传入的数据流,以识别异常值或异常模式,从而促进主动监控和快速补救措施。

  4. 使用 OpenSearch 增强监控仪表板:使用从 OpenSearch 收集的指标创建实时仪表板,以深入了解系统性能。通过将指标馈送到 OpenSearch,组织可以利用 OpenSearch Dashboards 可视化关键绩效指标,使运营团队能够快速评估健康状况和性能,并做出数据驱动的决策。

反馈

感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。

强大的性能,无限的扩展

收集、组织和处理海量高速数据。当您将任何数据视为时序数据时,它都更有价值。InfluxDB 是排名第一的时序平台,旨在与 Telegraf 一起扩展。

查看入门方法

相关集成

HTTP 和 InfluxDB 集成

HTTP 插件从一个或多个 HTTP(S) 端点收集指标。它支持各种身份验证方法和数据格式的配置选项。

查看集成

Kafka 和 InfluxDB 集成

此插件从 Kafka 读取消息,并允许基于这些消息创建指标。它支持各种配置,包括不同的 Kafka 设置和消息处理选项。

查看集成

Kinesis 和 InfluxDB 集成

Kinesis 插件允许从 AWS Kinesis 流中读取指标。它支持多种输入数据格式,并提供使用 DynamoDB 的检查点功能,以实现可靠的消息处理。

查看集成