前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用 OpenTelemetry 提升 Elastic Observability 中的基础设施监控

使用 OpenTelemetry 提升 Elastic Observability 中的基础设施监控

原创
作者头像
点火三周
发布2024-07-31 10:46:01
1110
发布2024-07-31 10:46:01
举报
文章被收录于专栏:Elastic Stack专栏

将 OpenTelemetry 集成到 Elastic Observability 中,用于应用程序和基础设施监控解决方案。

在 Elastic,我们最近决定全面采用 OpenTelemetry 作为主要的数据收集框架。作为一名可观测性工程师,我坚信供应商中立对于为客户提供最大价值至关重要。通过承诺使用 OpenTelemetry,我们不仅保持技术的前沿,还推动其发展。这项投资使我们处于行业的前沿,倡导更开放和灵活的可观测性方法。

Elastic 已将 Elastic Common Schema (ECS) 捐赠给 OpenTelemetry,并积极致力于 融合 其与语义约定。同时,我们致力于支持用户,确保他们不必面对不同标准的困扰。我们的目标是提供无缝的端到端体验,让用户在使用 OpenTelemetry 进行应用程序和基础设施监控时,能够毫无障碍地享受两者的优势。

在本博客中,我们将探讨如何使用 OpenTelemetry (OTel) 收集器从 AWS EC2、Google Compute、Kubernetes 集群以及运行 Linux 或 MacOS 的单个系统中捕获核心系统指标。

通过两种数据摄取路径驱动基础设施 UI

希望使用 OpenTelemetry 作为数据收集机制的 Elastic 用户现在可以使用 Elastic Observability 中的主机和库存 UI 监控部署 OpenTelemetry 收集器的主机健康状况。

Elastic 提供了两条不同的摄取路径来驱动基础设施 UI:ElasticsearchExporter 摄取路径和 OTLP Exporter 摄取路径。

摄取路径
摄取路径

ElasticsearchExporter 摄取路径:

在 OpenTelemetry 中,hostmetrics receiver 收集系统级指标,如 CPU、内存和磁盘使用情况,并以 OTel Schema 表示。ElasticsearchExporter 摄取路径利用 Hostmetrics Receiver 生成 OTel Schema 格式的主机指标。我们开发了 ElasticInfraMetricsProcessor,使用 opentelemetry-lib 将这些指标转换为 Elastic UI 可以理解的格式。

例如,OTel 指标 system.network.io 包含一个 direction 属性,其值为 receivetransmit,分别对应 Elastic 中的 system.network.in.bytessystem.network.out.bytes

Processor 然后将这些指标转发给 Elasticsearch Exporter,该出口程序现在支持以 ECS 模式导出指标。然后出口程序将指标发送到 Elasticsearch 端点,从而在基础设施 UI 中显示出有见地的数据。

要利用这条路径,您可以从 Elastic Collector Distro 部署收集器,详见 此处

以下是此摄取路径的示例收集器配置:

代码语言:javascript
复制
receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:
        metrics:
          system.cpu.utilization:
            enabled: true
          system.cpu.logical.count:
            enabled: true
      memory:
        metrics:
          system.memory.utilization:
            enabled: true
      process:
        metrics:
          process.open_file_descriptors:
            enabled: true
          process.memory.utilization:
            enabled: true
          process.disk.operations:
            enabled: true
      network:
      processes:
      load:
      disk:
      filesystem:

processors:
  resourcedetection/system:
    detectors: ["system", "ec2"]
  elasticinframetrics:

exporters:  
  logging:
    verbosity: detailed
  elasticsearch/metrics: 
    endpoints: <elasticsearch_endpoint>
    api_key: <api_key>
    mapping:
      mode: ecs

service:
  pipelines:
    metrics/host:
      receivers: [hostmetrics]
      processors: [resourcedetection/system, elasticinframetrics]
      exporters: [logging, elasticsearch/metrics]

Elastic exporter 路径非常适合那些希望使用定制 Elastic Collector Distro 的用户。该路径包括 Elasticinframetricsprocessor,通过 Elasticsearch exporter 将数据发送到 Elasticsearch。

OTLP Exporter 摄取路径:

在 OTLP Exporter 摄取路径中,hostmetrics receiver 收集系统级指标,如 CPU、内存和磁盘使用情况,并以 OTel Schema 表示。这些指标被发送到 OTLP Exporter,该出口程序将其转发到 APM Server 端点。APM Server 使用相同的 opentelemetry-lib,将这些指标转换为与 Elastic UI 兼容的格式。随后,APM Server 将指标推送到 Elasticsearch,驱动基础设施 UI。

以下是 APM 摄取路径的示例收集器配置:

代码语言:javascript
复制
receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:
        metrics:
          system.cpu.utilization:
            enabled: true
          system.cpu.logical.count:
            enabled: true
      memory:
        metrics:
          system.memory.utilization:
            enabled: true
      process:
        metrics:
          process.open_file_descriptors:
            enabled: true
          process.memory.utilization:
            enabled: true
          process.disk.operations:
            enabled: true
      network:
      processes:
      load:
      disk:
      filesystem:

processors:
  resourcedetection/system:
    detectors: ["system"]
    system:
      hostname_sources: ["os"]

exporters:
  otlphttp:
    endpoint: <mis_endpoint>
    tls:
      insecure: false
    headers:
      Authorization: <api_key_>
  logging:
    verbosity: detailed

service:
  pipelines:
    metrics/host:
      receivers: [hostmetrics]
      processors: [resourcedetection/system]
      exporters: [logging, otlphttp]

OTLP Exporter 摄取路径适用于已经使用 Elastic APM 并希望看到基础设施 UI 的用户。这些用户可以使用默认的 OpenTelemetry Collector

基础设施 UI 一瞥

基础设施 UI 展示了主机和 Kubernetes 级别的视图。以下是一些 UI 的展示:

主机概览 UI

主机 UI
主机 UI

主机库存 UI

库存 UI
库存 UI

主机的进程相关详情

进程
进程

Kubernetes 库存 UI

K8s
K8s

Pod 级别指标

Pod 指标
Pod 指标

我们的下一步是创建由原生 OTel 数据驱动的基础设施 UI,并提供专门的 OTel 仪表板,这些仪表板运行在原生数据上。

结论

Elastic 与 OpenTelemetry 的集成简化了可观测性领域。尽管我们正在努力使 ECS 与 OpenTelemetry 的语义约定对齐,我们的首要任务是通过简化用户体验来支持我们的用户。通过这种额外的支持,我们旨在为使用 OpenTelemetry 进行应用程序和基础设施监控的用户提供无缝的端到端体验。我们期待看到用户如何利用这些功能来深入了解他们的系统。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 通过两种数据摄取路径驱动基础设施 UI
    • ElasticsearchExporter 摄取路径:
      • OTLP Exporter 摄取路径:
      • 基础设施 UI 一瞥
      • 结论
      相关产品与服务
      Elasticsearch Service
      腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档