Opentelemetry——Instrumentation-Zero-code

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

大纲
  • *Zero-code*

Zero-code

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

As ops you might want to add observability to one or more applications without having to edit the source. OpenTelemetry lets you quickly gain some observability for a service without having to use the OpenTelemetry API & SDK for code-based instrumentation. 作为操作人员,您可能希望向一个或多个应用程序添加可观测性,而无需编辑源代码。OpenTelemetry可让您快速获得服务的一些可观测性,而无需使用 OpenTelemetry API 和 SDK 进行基于代码的测量。

Zero-code instrumentation adds the OpenTelemetry API and SDK capabilities to your application typically as an agent or agent-like installation. The specific mechanisms involved may differ by language, ranging from bytecode manipulation, monkey patching, or eBPF to inject calls to the OpenTelemetry API and SDK into your application. 零代码测量通常以代理或类似代理安装的方式将OpenTelemetry API 和 SDK 功能添加到您的应用程序中。所涉及的具体机制可能因语言而异,包括字节码操作、monkey patching或 eBPF。它们将OpenTelemetry API 和 SDK 的调用代码注入到您的应用程序中。

Typically, zero-code instrumentation adds instrumentation for the libraries you’re using. This means that requests and responses, database calls, message queue calls, and so forth are what are instrumented. Your application’s code, however, is not typically instrumented. To instrument your code, you’ll need to use code-based instrumentation. 通常,零代码测量会为您正在使用的库添加测量装置。这意味着请求和响应、数据库调用、消息队列调用等等都是会被测量的。然而,您的应用程序代码通常不会被测量。要测量您的代码,您需要使用基于代码的测量。

Additionally, zero-code instrumentation lets you configure the Instrumentation Libraries and exporters loaded. 此外,零代码测量允许您配置需要加载的测量库和导出器。

You can configure zero-code instrumentation through environment variables and other language-specific mechanisms, such as system properties or arguments passed to initialization methods. To get started, you only need a service name configured so that you can identify the service in the observability backend of your choice. 您可以通过环境变量和其他特定于语言的机制(例如系统属性或传递给初始化方法的参数)来配置零代码测量。首先,您只需要配置一个服务名称,以便您可以在您选择的可观测性后端中识别该服务。

Other configuration options are available, including: 还可以使用其他配置选项,包括:

  • Data source specific configuration 数据源具体配置
  • Exporter configuration 导出器配置
  • Propagator configuration 传播器配置
  • Resource configuration 资源配置

Automatic instrumentation is available for the following languages: 自动测量装置可用于以下语言:

  • .NET
  • Java
  • JavaScript
  • PHP
  • Python

0 人点赞