Opentelemetry——Instrumentation

2024-05-24 19:25:09 浏览数 (1)

大纲
  • *Instrumentation*
  • *Additional OpenTelemetry Benefits*
    • *Zero-code*
    • *Code-based*
    • *Libraries*

Instrumentation

测量装置

How OpenTelemetry facilitates instrumentation OpenTelemety如何简化测量

In order to make a system observable, it must be instrumented: That is, code from the system’s components must emit traces, metrics, and logs. 为了使系统可观察,必须对其进行测量,也就是说,来自系统组件的代码必须发出Traces, Metrics和Logs。

Using OpenTelemetry, you can instrument your code in two primary ways: 使用 OpenTelemetry,您可以通过两种主要方式测量代码:

  1. Code-based solutions via official APIs and SDKs for most languages 基于代码的,适用于大多数语言的,官方API 和 SDK的解决方案
  2. Zero-code solutions 零代码解决方案

Code-based solutions allow you to get deeper insight and rich telemetry from your application itself. They let you use the OpenTelemetry API to generate telemetry from your application, which acts as an essential complement to the telemetry generated by zero-code solutions. 基于代码的解决方案使您可以从应用程序本身获得更深入的洞察和丰富的遥测数据。它们允许您使用 OpenTelemetry API 从应用程序生成遥测数据,这是对零代码解决方案生成的遥测数据的重要补充。

Zero-code solutions are great for getting started, or when you can’t modify the application you need to get telemetry out of. They provide rich telemetry from libraries you use and/or the environment your application runs in. Another way to think of it is that they provide information about what’s happening at the edges of your application. 零代码解决方案非常适合入门,以及当您无法修改应用程序以从中获取遥测数据时。它们从您使用的库和/或应用程序运行的环境中提供丰富的遥测数据。从另外一个角度说,它们提供有关应用程序边缘发生的信息。

You can use both solutions simultaneously. 您可以同时使用两种解决方案。

Additional OpenTelemetry Benefits

其他 OpenTelemetry 优势

OpenTelemetry provides more than just zero-code and code-based telemetry solutions. The following things are also a part of OpenTelemetry: OpenTelemetry 提供的不仅仅是零代码和基于代码的遥测解决方案。以下内容也是 OpenTelemetry 的一部分:

  • Libraries can leverage the OpenTelemetry API as a dependency, which will have no impact on applications using that library, unless the OpenTelemetry SDK is imported. 库可以利用 OpenTelemetry API 作为依赖项,这不会对使用该库的应用程序产生影响,除非它也导入了OpenTelemetry SDK。
  • For each signal (traces, metrics, logs) you have several methods at your disposals to create, process, and export them. 对于每个Signals(Trace、Metric、Logs),您可以使用多种方法来创建、处理和导出它们。
  • With context propagation built into the implementations, you can correlate signals regardless of where they are generated. 通过将Context Propagation内置到实现中,您可以关联信号(Trace、Metrics、Logs),无论它们在何处生成。
  • Resources and Instrumentation Scopes allow grouping of signals, by different entities, like, the host, operating system or K8s cluster 资源和测量范围允许按不同实体(例如主机、 操作系统或 K8s 集群)对信号进行分组。
  • Each language-specific implementation of the API and SDK follows the requirements and expectations of the OpenTelemetry specification. API和SDK的每种特定于语言的实现都遵循OpenTelemetry规范的要求和期望。
  • Semantic Conventions provide a common naming schema that can be used for standardization across code bases and platforms. 语义约定提供了一个通用的命名模式,可用于跨代码库和平台的标准化。

Zero-code

Learn how to add observability to an application without the need to write code 了解如何在无需编写代码的情况下向应用程序添加可观察性

Code-based

基于代码

Learn the essential steps in setting up code-based instrumentation 了解设置基于代码的Instrumentation的基本步骤

Libraries

Learn how to add native instrumentation to your library. 了解如何将本地Instrumentation添加到您的库中。

0 人点赞