opentelemetry-java-instrumentation翻译

.NET可观测性实战:OpenTelemetry+Serilog+Prometheus全链路监控 可观测性是现代分布式系统稳定运行的核心能力,其本质是通过日志、指标、链路追踪三大支柱,实现对系统内部状态的可推断性。其底层原理依赖统一上下文传播(如Trace ID)、标准化语义约定(OpenTelemetry Logs/Metrics/Tracing规范)与低侵入采集机制。技术价值在于将模糊的‘系统变慢’转化为可定位的‘HttpClient第3次重试耗时2.1秒’,显著缩短MTTR。典型应用场景涵盖ASP.NET Core微服务、BackgroundService后台任务及EF Core数据访问层的全栈监 阅读详情

原文地址:原文

 

OpenTelemetry Instrumentation for Java

这个项目提供了一个Java agent JAR,这个jar可以attached to任何Java8+的应用上,动态地注入(inject)字节码从大量的流行库和框架(popular libraries and frameworks)中捕捉遥测数据。你可以以多种格式导出遥测数据。你也可以通过命令行或环境变量来配置agent和exporter。最终的结果就是:在不用修改Java Application代码的情况下,获取遥测数据的能力。

(This project provides a Java agent JAR that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks. You can export the telemetry data in a variety of formats. You can also configure the agent and exporter via command line arguments or environment variables. The net result is the ability to gather telemetry data from a Java application without code changes.)

开始

(Download the latest version.)

这个包包含了instrumentation agent和支持的库的instrumentation,以及所有data exporter。此包提供了一个完全自动化的,开箱即用的体验。使用-javaagent命令启动 instrumentation agent:

(This package includes the instrumentation agent as well as instrumentations for all supported libraries and all available data exporters. The package provides a completely automatic, out-of-the-box experience.

Enable the instrumentation agent using the -javaagent flag to the JVM.)

java -javaagent:path/to/opentelemetry-javaagent-all.jar \
     -jar myapp.jar

默认情况下,OpenTelemetry Java agent使用配置好的OTLP exporter来通过localhost:55680端口发送数据到 OpenTelemetry collector中。配置参数通过Java系统属性-D或者环境变量来传递,下文有完整的环境变量列表。例如:

(By default, the OpenTelemetry Java agent uses OTLP exporter configured to send data to OpenTelemetry collector at localhost:55680.

Configuration parameters are passed as Java system properties (-D flags) or as environment variables. See below for a full list of environment variables. For example:)

java -javaagent:path/to/opentelemetry-javaagent-all.jar \
     -Dotel.exporter=zipkin \
     -jar myapp.jar

通过系统属性 otel.exporter.jar 来指定external exporter的jar文件:

(Specify the external exporter JAR file using the otel.exporter.jar system property:)

java -javaagent:path/to/opentelemetry-javaagent-all.jar \
     -Dotel.exporter.jar=path/to/external-exporter.jar \
     -jar myapp.jar

如何添加自定义instrumentation可见 Manually Instrumenting 部分。

(Learn how to add custom instrumentation in the Manually Instrumenting section.)

配置参数(可能会发生变化!)

注意:这些参数名很有可能随着时间发生变化,所以当尝试新版本的时候请回到此处检查。如果你发现了任何bug或者程序发生了unexpected的行为,请报告给我们。

(Note: These parameter names are very likely to change over time, so please check back here when trying out a new version! Please report any bugs or unexpected behavior you find.)

Exporters

下面是所有exporters共有的配置属性:

The following configuration properties are common to all exporters:

System propertyEnvironment variablePurpose
otel.exporterOTEL_EXPORTER

将被使用的exporter,如果有多个,使用逗号分隔;目前并不支持多个metric的exporter,默认值是otlp

The exporter to be used. Use a comma-separated list for multiple exporters. Currently does not support multiple metric exporters. Default is otlp.

OTLP exporter(同时是span和metric的exporter)

OTLP exporter (both span and metric exporters)

一个opentelemetry-java的OTLP span和metric exporter的简单wrapper如下。

A simple wrapper for the OpenTelemetry Protocol (OTLP) span and metric exporters of opentelemetry-java.

System propertyEnvironment variableDescription
otel.exporter=otlp (default)OTEL_EXPORTER=otlpSelect the OpenTelemetry exporter (default)
otel.exporter.otlp.endpointOTEL_EXPORTER_OTLP_ENDPOINTThe OTLP endpoint to connect to. Default is localhost:55680.
otel.exporter.otlp.insecureOTEL_EXPORTER_OTLP_INSECUREWhether to enable client transport security for the connection
otel.exporter.otlp.headersOTEL_EXPORTER_OTLP_HEADERSKey-value pairs separated by semicolons to pass as request headers
otel.exporter.otlp.timeoutOTEL_EXPORTER_OTLP_TIMEOUTThe maximum waiting time allowed to send each batch. Default is 1000.

如果想要配置OTLP exporter的服务名,添加service.name的key到OpenTelemetry Resource (见下文),例如:OTEL_RESOURCE_ATTRIBUTES=service.name=myservice

To configure the service name for the OTLP exporter, add the service.name key to the OpenTelemetry Resource (see below), e.g. OTEL_RESOURCE_ATTRIBUTES=service.name=myservice.

Jaeger exporter

一个简单的Jaeger exporter of opentelemetry-java的wrapper,这个exporter使用gRPC作为它的通信协议。

(A simple wrapper for the Jaeger exporter of opentelemetry-java. This exporter uses gRPC for its communications protocol.)

System propertyEnvironment variableDescription
otel.exporter=jaegerOTEL_EXPORTER=jaegerSelect the Jaeger exporter
otel.exporter.jaeger.endpointOTEL_EXPORTER_JAEGER_ENDPOINTThe Jaeger gRPC endpoint to connect to. Default is localhost:14250.
otel.exporter.jaeger.service.nameOTEL_EXPORTER_JAEGER_SERVICE_NAMEThe service name of this JVM instance. Default is unknown.

Jaeger Thrift over HTTP exporter

一个 Jaeger exporter的简单wrapper,使用http协议上的Thrift编码格式。

A simple wrapper for the Jaeger exporter, but using Thrift encoded payloads over HTTP.

System propertyEnvironment variableDescription
otel.exporter=jaeger-thriftOTEL_EXPORTER=jaeger-thriftSelect the Jaeger HTTP Thrift exporter
otel.exporter.jaeger.endpointOTEL_EXPORTER_JAEGER_ENDPOINTThe Jaeger HTTP endpoint to send thrift data to. Default is http://localhost:14268/api/traces.
otel.exporter.jaeger.service.nameOTEL_EXPORTER_JAEGER_SERVICE_NAMEThe service name of this JVM instance. Default is unknown.

Zipkin exporter

一个Zipkin exporter的简单wrapper,使用http协议上的JSON编码格式。

A simple wrapper for the Zipkin exporter of opentelemetry-java. It sends JSON in Zipkin format to a specified HTTP URL.

System propertyEnvironment variableDescription
otel.exporter=zipkinOTEL_EXPORTER=zipkinSelect the Zipkin exporter
otel.exporter.zipkin.endpointOTEL_EXPORTER_ZIPKIN_ENDPOINTThe Zipkin endpoint to connect to. Default is http://localhost:9411/api/v2/spans. Currently only HTTP is supported.
otel.exporter.zipkin.service.nameOTEL_EXPORTER_ZIPKIN_SERVICE_NAMEThe service name of this JVM instance. Default is unknown.

Prometheus exporter

一个 Prometheus exporter 的简单wrapper

A simple wrapper for the Prometheus exporter of opentelemetry-java.

System propertyEnvironment variableDescription
otel.exporter=prometheusOTEL_EXPORTER=prometheusSelect the Prometheus exporter
otel.exporter.prometheus.portOTEL_EXPORTER_PROMETHEUS_PORTThe local port used to bind the prometheus metric server. Default is 9464.
otel.exporter.prometheus.hostOTEL_EXPORTER_PROMETHEUS_HOSTThe local address used to bind the prometheus metric server. Default is 0.0.0.0.

Logging exporter

这个logger exporter打印span的名称和属性到stdout,它主要用于test和debug。

The logging exporter prints the name of the span along with its attributes to stdout. It's mainly used for testing and debugging.

System propertyEnvironment variableDescription
otel.exporter=loggingOTEL_EXPORTER=loggingSelect the logging exporter
otel.exporter.logging.prefixOTEL_EXPORTER_LOGGING_PREFIXAn optional string printed in front of the span name and attributes.

Propagator

Propagator决定了使用哪个分布式tracing header格式,和baggage propagation header 格式。

The propagators determine which distributed tracing header formats are used, and which baggage propagation header formats are used.

System propertyEnvironment variableDescription
otel.propagatorsOTEL_PROPAGATORSThe propagators to be used. Use a comma-separated list for multiple propagators. Supported propagators are tracecontext, baggage, b3, b3multi, jaeger, ottracer, and xray. Default is tracecontext,baggage (W3C).

OpenTelemetry Resource

OpenTelemetry Resource 是生产遥测数据实体的表示(representation)

The OpenTelemetry Resource is a representation of the entity producing telemetry.

System propertyEnvironment variableDescription
otel.resource.attributesOTEL_RESOURCE_ATTRIBUTESSpecify resource attributes in the following format: key1=val1,key2=val2,key3=val3

Peer service name

peer service name是正在连接中的远程服务名。它对应于 Resource 中对应的本地服务。

The peer service name is the name of a remote service being connected to. It corresponds to service.name in the Resource for the local service.

System propertyEnvironment variableDescription
otel.endpoint.peer.service.mappingOTEL_ENDPOINT_PEER_SERVICE_MAPPINGUsed to specify a mapping from hostnames or IP addresses to peer services, as a comma-separated list of host=name pairs. The peer service is added as an attribute to a span whose host or IP match the mapping. For example, if set to 1.2.3.4=cats-service,dogs-abcdef123.serverlessapis.com=dogs-api, requests to 1.2.3.4 will have a peer.service attribute of cats-service and requests to dogs-abcdef123.serverlessapis.com will have an attribute of dogs-api.

Batch span processor

System propertyEnvironment variableDescription
otel.bsp.schedule.delayOTEL_BSP_SCHEDULE_DELAYThe interval, in milliseconds, between two consecutive exports. Default is 5000.
otel.bsp.max.queueOTEL_BSP_MAX_QUEUEThe maximum queue size. Default is 2048.
otel.bsp.max.export.batchOTEL_BSP_MAX_EXPORT_BATCHThe maximum batch size. Default is 512.
otel.bsp.export.timeoutOTEL_BSP_EXPORT_TIMEOUTThe maximum allowed time, in milliseconds, to export data. Default is 30000.
otel.bsp.export.sampledOTEL_BSP_EXPORT_SAMPLEDWhether only sampled spans should be exported. Default is true.

Trace config

System propertyEnvironment variableDescription
otel.config.sampler.probabilityOTEL_CONFIG_SAMPLER_PROBABILITYSampling probability between 0 and 1. Default is 1.
otel.config.max.attrsOTEL_CONFIG_MAX_ATTRSThe maximum number of attributes per span. Default is 32.
otel.config.max.eventsOTEL_CONFIG_MAX_EVENTSThe maximum number of events per span. Default is 128.
otel.config.max.linksOTEL_CONFIG_MAX_LINKSThe maximum number of links per span. Default is 32
otel.config.max.event.attrsOTEL_CONFIG_MAX_EVENT_ATTRSThe maximum number of attributes per event. Default is 32.
otel.config.max.link.attrsOTEL_CONFIG_MAX_LINK_ATTRSThe maximum number of attributes per link. Default is 32.

Interval metric reader

System propertyEnvironment variableDescription
otel.imr.export.intervalOTEL_IMR_EXPORT_INTERVALThe interval, in milliseconds, between pushes to the exporter. Default is 60000.

个性化OpenTelemetry SDK

个性化SDK是非常高级的行为,目前还在原型阶段。它可能发生巨大的改变甚至完全移除,使用时需要非常小心。

The OpenTelemetry API 暴露了 SPI hooks 来进行个性化,例如  attached to spans或者Sampler的Resource

因为自动化检测运行时所处的classpath不同于 instrumented application,所以不可能customization in the application to take advantage of this customization。为了提供这样的个性化,你可以提供一个JAR文件,并且使用系统属性 otel.initializer.jar来实现SPI接口。注意,这个JAR需要shade同样使用agent方式的OpenTelemetry API。最简单的实现方式是使用同这里一样的shading配置。另外,你必须指定io.opentelemetry.javaagent.shaded.io.opentelemetry.api.trace.spi.TraceProvider的值为已经实现了SPI接口的类名称。

Customizing the SDK is highly advanced behavior and is still in the prototyping phase. It may change drastically or be removed completely. Use with caution

The OpenTelemetry API exposes SPI hooks for customizing its behavior, such as the Resource attached to spans or the Sampler.

Because the automatic instrumentation runs in a different classpath than the instrumented application, it is not possible for customization in the application to take advantage of this customization. In order to provide such customization, you can provide the path to a JAR file, including an SPI implementation using the system property otel.initializer.jar. Note that this JAR needs to shade the OpenTelemetry API in the same way as the agent does. The simplest way to do this is to use the same shading configuration as the agent from here. In addition, you must specify the io.opentelemetry.javaagent.shaded.io.opentelemetry.api.trace.spi.TraceProvider to the name of the class that implements the SPI.

手动检测(Manually instrumenting)

warning starting with 0.6.0, and prior to version 1.0.0, opentelemetry-javaagent-all.jar only supports manual instrumentation using the opentelemetry-api version with the same version number as the Java agent you are using. Starting with 1.0.0, the Java agent will start supporting multiple (1.0.0+) versions of opentelemetry-api.

您需要在opentelemetry api库上添加一个依赖项才能开始使用;如果您更倾向使用@WithSpan注解,也可以包含(引入)opentelemetry-extension-annotations依赖。

You'll need to add a dependency on the opentelemetry-api library to get started; if you intend to use the @WithSpan annotation, also include the opentelemetry-extension-annotations dependency.

Maven

  <dependencies>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-api</artifactId>
      <version>0.11.0</version>
    </dependency>
    <dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-extension-annotations</artifactId>
      <version>0.11.0</version>
    </dependency>
  </dependencies>

Gradle

dependencies {
    implementation('io.opentelemetry:opentelemetry-api:0.11.0')
    implementation('io.opentelemetry:opentelemetry-extension-annotations:0.11.0')
}

给当前span添加属性值(Adding attributes to the current span)

检测(instrument)应用时一个常见需求是捕获特定应用或特定业务的信息,将其作为附加属性(additional attributes)追加到自动检测中已经存在的span中。使用Span.current()和setAttribute()来获取当前span:

A common need when instrumenting an application is to capture additional application-specific or business-specific information as additional attributes to an existing span from the automatic instrumentation. Grab the current span with Span.current() and use the setAttribute() methods:

import io.opentelemetry.api.trace.Span;

// ...

Span span = Span.current();
span.setAttribute(..., ...);

使用@WithSpan给方法创建span(Creating spans around methods with @WithSpan)

另外一个常见场景是在一个已经存在的第一方代码方法上捕获span。使用@WithSpan注解简单粗暴:

Another common situation is to capture a span around an existing first-party code method. The @WithSpan annotation makes this straightforward:

import io.opentelemetry.extension.annotations.WithSpan;

public class MyClass {
  @WithSpan
  public void MyLogic() {
      <...>
  }
}

每次应用invoke被注解的方法,都会创建一个span,这个span代表着方法执行的过程并提供了任何被抛出的异常。除非给注解指定参数,否则span的名称将会是<className>.<methodName>

Each time the application invokes the annotated method, it creates a span that denote its duration and provides any thrown exceptions. Unless specified as an argument to the annotation, the span name will be <className>.<methodName>.

Suppressing @WithSpan instrumentation

如果你使用@WithSpan对代码进行了过度检测,并且希望在不修改代码的情况下抑制(suppress)其中一些代码,那么Suppressing @WithSpan是很有用的。

Suppressing @WithSpan is useful if you have code that is over-instrumented using @WithSpan and you want to suppress some of them without modifying the code.

System propertyEnvironment variablePurpose
trace.annotated.methods.excludeTRACE_ANNOTATED_METHODS_EXCLUDESuppress @WithSpan instrumentation for specific methods.
Format is "my.package.MyClass1[method1,method2];my.package.MyClass2[method3]"

(使用Tracer来手动创建span)Creating spans manually with a Tracer

OpenTelemetry 提供了tracer使应用中自定义检测更加简单。查看 OpenTelemetry Java QuickStart 中如何配置tracer的例子,学习如何使用Tracer,Scope and Span 接口来检测你的应用。

OpenTelemetry offers a tracer to easily enable custom instrumentation throughout your application. See the OpenTelemetry Java QuickStart for an example of how to configure the tracer and use the Tracer, Scope and Span interfaces to instrument your application.

支持的libraries,frameworks和应用服务器(Supported libraries, frameworks, and application servers)

这里是支持的libraries 和 frameworks:

These are the supported libraries and frameworks:

Library/FrameworkVersions
Akka HTTP10.0+
Apache HttpAsyncClient4.1+
Apache HttpClient2.0+
Armeria1.3+
AsyncHttpClient1.9+ (not including 2.x yet)
AWS Lambda1.0+
AWS SDK1.11.x and 2.2.0+
Cassandra Driver3.0+
Couchbase Client2.0+ (not including 3.x yet)
Dropwizard Views0.7+
Elasticsearch API5.0+ (not including 7.x yet)
Elasticsearch REST Client5.0+
Finatra2.9+
Geode Client1.4+
Google HTTP Client1.19+
Grizzly2.0+ (disabled by default)
gRPC1.5+
Hibernate3.3+
HttpURLConnectionJava 7+
http4k †3.270.0+
Hystrix1.4+
JAX-RS0.5+
JAX-RS Client2.0+
JDBCJava 7+
Jedis1.4+
JMS1.1+
JSP2.3+
Kafka0.11+
khttp0.1+
Kubernetes Client7.0+
Lettuce4.0+ (not including 6.x yet)
Log4j 11.2+
Log4j 22.7+
Logback1.0+
MongoDB Drivers3.3+
Netty3.8+
OkHttp3.0+
Play2.3+ (not including 2.8.x yet)
Play WS1.0+
RabbitMQ Client2.7+
Ratpack1.4+
Reactor3.1+
Reactor Netty0.9+ (not including 1.0)
Rediscala1.8+
Redisson3.0+
RMIJava 7+
RxJava1.0+
Servlet2.2+
Spark Web Framework2.3+
Spring Batch3.0+
Spring Data1.8+
Spring Scheduling3.1+
Spring Web MVC3.1+
Spring Webflux5.0+
Spymemcached2.12+
Struts22.3+
Twilio6.6+ (not including 8.x yet)
Vert.x3.0+
Vert.x RxJava23.5+

† OpenTelemetry support provided by the library

这里是支持的应用服务器:

These are the supported application servers:

Application serverVersionJVMOS
Glassfish5.0.x, 5.1.xOpenJDK 8, 11Ubuntu 18, Windows Server 2019
JBoss EAP7.1.x, 7.3.xOpenJDK 8, 11Ubuntu 18, Windows Server 2019
Jetty9.4.x, 10.0.x, 11.0.xOpenJDK 8, 11Ubuntu 20
Payara5.0.x, 5.1.xOpenJDK 8, 11Ubuntu 18, Windows Server 2019
Tomcat7.0.x, 8.5.x, 9.0.x, 10.0.xOpenJDK 8, 11Ubuntu 18
Weblogic12OpenJDK 8Oracle Linux 7, 8
Weblogic14OpenJDK 8, 11Oracle Linux 7, 8
WildFly13.0.xOpenJDK 8Ubuntu 18, Windows Server 2019
WildFly17.0.1, 21.0.0OpenJDK 8, 11Ubuntu 18, Windows Server 2019

关闭的检测(Disabled instrumentations)

有些检测会产生过多的spans,使得trace非常noisy。因此,下面这些instrumentations默认是关闭的:

Some instrumentations can produce too many spans and make traces very noisy. For this reason, the following instrumentations are disabled by default:

  • jdbc-datasource which creates spans whenever the java.sql.DataSource#getConnection method is called.

如果想打开他们,otel.instrumentation.<name>.enabled,系统变量: -Dotel.instrumentation.jdbc-datasource.enabled=true

To enable them, add the otel.instrumentation.<name>.enabled system property: -Dotel.instrumentation.jdbc-datasource.enabled=true

Grizzly instrumentation

当你使用Grizzly作为Servlet-based应用时,你可以从特定Servlet支持中获取更好的体验。因为这两个检测相互冲突,Grizzly HTTP Server的更generic的检测将默认被关闭。如果需要,你可以通过添加系统属性: -Dotel.instrumentation.grizzly.enabled=true来打开它。

When you use Grizzly for Servlet-based applications, you get better experience from Servlet-specific support. As these two instrumentations conflict with each other, more generic instrumentation for Grizzly HTTP server is disabled by default. If needed, you can enable it by adding the following system property: -Dotel.instrumentation.grizzly.enabled=true

Suppress特定的自动检测(Suppressing specific auto-instrumentation)

See Suppressing specific auto-instrumentation

Logger MDC auto-instrumentation

See Logger MDC auto-instrumentation

排除故障(Troubleshooting)

打开agent的内部debug日志:

To turn on the agent's internal debug logging:

-Dotel.javaagent.debug=true

注意:这些日志都是特别冗长的,只有在需要的时候打开它。打开debug日志将会对应用性能产生负面影响。

Note: These logs are extremely verbose. Enable debug logging only when needed. Debug logging negatively impacts the performance of your application.

Roadmap to 1.0 (GA)

See GA Requirements

Contributing

See CONTRIBUTING.md.

Approvers (@open-telemetry/java-instrumentation-approvers):

Maintainers (@open-telemetry/java-instrumentation-maintainers):

Learn more about roles in the community repository.

Thanks to all the people who already contributed!

OpenTelemetry 系列 (四)| 如何使用 Java Agent 来实现无侵入的调用链 Java Agent一般可以被称为探针,是一种可以在 Java 应启动前和运行中修改应用的字节码的技术。通过在启动项中添加来制定使用特定的 Agent。是一个隶属于 OpenTelemetry 系列的项目,这个项目就是一个基于Java Agent来实现无侵入式接入的官方 Agent 项目。复制代码将下载下来,然后使用上述指令就能够运行,在启动成功后就能够直接接入成功,而不用对应用本身的代码进行任何的修改。在这个篇章中我们简单的介绍了的使用,实际上这个项目支持了不少自定义的扩展能力。 阅读详情

相关推荐

OpenTelemetry系列 (五)| OpenTelemetry Java Instrumentation二次开发指南

需要注意的是在早期版本中可以自己完全创建项目然后以外部插件的形式来注入,但是在后续版本中这种方式被废弃,因此后续的开发都是在clone下来的OJI项目中进行开发。虽然OJI已经提供了非常多的类库,许许多多知名的开源项目都在其中,但是总是可能会有一些需要自己来处理的内容,比如一些商用库,比如一些公司自制的二方或者三方依赖。这些都不可能找到现成的实现,那么就只能自己来了!OJI提供了完善的扩展能力,大家可以自行定义自己需要的。在OJI。

BASK2312的博客 2498

OpenTelemetry系列 - 第2篇 Java端接入OpenTelemetry

目录一、架构说明二、方式1 - 自动化2.1 opentelemetry-javaagent.jar(Java8+ )2.2 使用opentelemetry-javaagent.jar完成自动注入2.3 配置opentelemetry-javaagent.jar2.4 使用注解(@WithSpan, @SpanAttribute)2.5.1 代码集成@WithSpan, @SpanAttribute2.5.2 禁用已标注@WithSpan的方法的自动注入:2.5.3 不修改代码的情况下启用@WithSpan

罗小爬的技术宝书 9465

.NET猫系架构:模块化、接口契约与异常处理实践

在.NET中构建高可用、易演进的中大型应用,核心在于松耦合架构设计与稳健的工程实践。本文围绕模块化边界、接口契约定义、分层异常处理及自动化可观测性四大技术支柱展开,深入解析如何通过程序集隔离、DTO驱动交互、领域异常语义化映射以及Activity+OpenTelemetry链路追踪,实现系统稳定性与可维护性的双重提升。特别聚焦C#开发者在微服务与复杂单体场景下,对高内聚、低耦合、强可观测等关键能力的落地路径,为从Spring Boot迁移或深耕.NET 6+生态的工程师提供可复用的架构范式。

aobai7842的博客 424

了解 APM:如何向 OpenTelemetry Java 代理添加扩展

这与 Elastic APM 插件的工作方式有点不同,因为使用 OpenTelemetry 注入代码的默认方法是使用 OpenTelemetry 内联(inline)的(这是默认方法),并且你可以使用 InstrumentationModule 配置将依赖项注入到核心应用程序类加载器中(如如下所示)。例如,你可以指定要检测的某个类和该类中的方法,并提供一个 “拦截器” 来向该方法添加新行为。我们检测的目标类是在 typeMatch 方法中定义的,而我们想要检测的方法是在 Transform 方法中定义的。

Elastic 中国社区官方博客 1517

生产级机器学习服务的可观测性与稳定性实战

机器学习模型部署不是终点,而是工程化交付的起点。从基础概念看,可观察性(Observability)指通过指标、链路追踪和日志三大支柱,实现对系统内部状态的推断能力;其核心原理在于将黑盒推理过程转化为可量化、可关联、可归因的数据流。技术价值体现在快速故障定位、主动漂移防御与合规审计就绪,支撑高可用ML服务在金融风控、电商推荐等关键场景稳定运行。本文聚焦真实生产环境中的可观测性落地与稳定性保障,深入解析Triton推理引擎性能调优、Feast特征服务一致性机制,并结合OpenTelemetry与Grafana

weixin_30732487的博客 410

.NET开发实战:从底层框架到商业项目的进阶指南

在软件开发领域,理解底层框架原理是构建高性能、可维护应用的基础。通过深入剖析HTTP请求管道、依赖注入容器和ORM工作机制,开发者能够掌握系统核心运行机制,从而高效定位和解决复杂业务场景下的性能瓶颈与架构问题。这种从原理到实践的闭环学习路径,对于实现商业级项目至关重要。在实战层面,结合领域驱动设计(DDD)和清晰的分层架构,能够有效组织复杂业务逻辑,提升代码的可测试性和可扩展性。本文聚焦于.NET技术栈,通过系统讲解底层框架与商业项目落地的关键技术,帮助开发者跨越从理论到实践的鸿沟,构建符合生产环境要求的应

weixin_33851604的博客 375

【翻译】了解OpenTelemetry第4部分:用OpenTelemetry对Java应用程序进行测量

作者:Jack Berg2021年9月22日 特邀文章,原载于New Relic博客,作者是New Relic的工程师Jack Berg 这篇博文是Understand OpenTelemetry系列的一部分。 第一部分概述了OpenTelemetry,并讨论了为什么它是仪器的未来。第二部分探讨了OpenTelemetry开源项目的核心组件。第三部分重点介绍了OpenTelemetry的...

超级码力 721

Java与.NET技术栈深度对比:从JVM到.NET Runtime的工程实践差异

Java和.NET作为企业级开发两大主流技术栈,其本质差异远不止于语法或语言特性,而根植于底层运行时设计哲学——JVM强调内存模型共识与系统级调优能力,.NET Runtime则依托跨平台重构与工具链深度集成。这种差异直接塑造了各自的依赖管理机制(Maven中央治理 vs NuGet联邦自治)、架构演进路径(Spring Boot约定优于配置 vs ASP.NET Core显式即正义)以及生产就绪能力(Actuator全息监控 vs Health Checks分层诊断)。在云原生、信创适配与AI编码辅助等新

SailingAptech的专栏 440

跨语言分布式追踪落地:统一Trace上下文与OpenTelemetry实践

在微服务架构中,分布式链路追踪是排查性能瓶颈和故障根因的关键手段。其核心原理是通过Trace ID与Span构建请求的完整调用链,并借助标准上下文传播协议在不同服务间传递追踪状态。以OpenTelemetry为代表的统一标准,让Java、Go、Python等多语言服务能够共享同一套上下文格式,实现全链路数据打通。在千万级QPS的业务场景下,合理设计采样策略与异步导出机制,才能兼顾性能与数据完整性。本文围绕跨语言追踪的工程落地,解析W3C Trace Context协议、OpenTelemetry接入方式及高

weixin_30256901的博客 332

AI编排:企业级大模型落地的中枢工程

AI编排(AI Orchestration)是连接企业遗留系统与大语言模型的关键工程范式,其核心在于统一调度数据流与智能流,在保障数据主权、权限隔离、全链路可观测和结果可回填的前提下,实现LLM能力的安全可控集成。它超越单点RAG或API调用,强调跨系统治理、字段级脱敏、角色感知权限和Trace ID贯通等企业级能力。典型应用场景包括销售流失预警、合规审计辅助、供应链风险分析等,本质是构建AI时代的‘企业神经系统’。本文聚焦MuleSoft与LangChain协同落地的实操路径,覆盖契约定义、分层架构、Da

weixin_30654419的博客 385

opentelemetry-java-instrumentation:适用于Java的OpenTelemetry自动仪器和工具库

•• •• 适用于Java的OpenTelemetry Instrumentation 关于 该项目提供了Java代理JAR,该Java代理JAR可以附加到任何Java 8+应用程序,并动态注入字节码以捕获来自许多流行的库和框架的遥测。 您可以采用多种格式导出遥测数据。 您还可以通过命令行参数或环境变量来配置代理和导出器。 最终结果是无需更改代码即可从Java应用程序收集遥测数据的能力。 入门 下载。 该软件包包括检测代理以及所有受支持的库和所有可用数据导出器的检测。 该软件包提供了一种全自动的,即开即用的体验。 使用JVM的-javaagent标志启用检测代理。 java -javaagent:path/to/opentelemetry-javaagent-all.jar \ -jar myapp.jar 默认情况下,OpenTelemetry Java代理使用程序,该

Java服务可观测性:从Vibe Coding到AI Engineering的验证层

可观测性(Observability)是构建可靠分布式系统的核心能力,它通过日志、指标、链路追踪和告警,让开发者清晰了解系统内部状态。在Java工程实践中,Spring Boot结合Micrometer、Prometheus和OpenTelemetry,能够快速为服务搭建起完整的观测体系。这一技术不仅能帮助定位性能瓶颈、排查线上故障,还能为AI辅助编程(如Vibe Coding)生成的代码提供工程验证。当AI工具(如Trae、Cursor、GitHub Copilot)快速产出代码时,其概率输出特性可能导致

weixin_34122604的博客 619

ArcGIS 10.2 保姆级安装与破解教程(含License Manager启动失败解决方案)

本文提供ArcGIS 10.2中文版的保姆级安装与破解教程,详细讲解从环境检查到License Manager配置的全流程,特别针对License Manager启动失败等常见问题提供专业解决方案,帮助用户顺利完成地理信息系统软件的安装与激活。

weixin_26757925的博客 1180

AI工程化的确定性、可观测性与插桩实践指南

在AI系统从实验走向生产的过程中,确定性(Determinism)与可观测性(Observability)是决定系统能否被信任的关键基础。与传统软件不同,模型推理常因并行计算、随机初始化或环境差异导致相同输入产生不同输出,给故障排查和稳定性保障带来巨大挑战。可观测性工程通过分布式追踪、结构化日志和指标监控,将一次请求的完整链路、模型版本、置信度与系统状态关联起来,从而让工程师能够快速定位性能瓶颈与异常根因。插桩(Instrumentation)作为实现可观测性的核心手段,帮助团队在API入口到模型推理的每个

weixin_30591551的博客 357

单总线协议(1—Wire bus)【DS2431】

1—Wire 协议定义了复位脉冲、 应答脉冲、写0、写1、读0和读1时序等几种信号类型。所有的单总线命令序列(初始化ROM 命令功能命令)都是由这些基本的信号类型组成的。识别单总线器件(ROM 命令)单总线器件交换数据(功能命令)初始化单总线器件(初始化)

qq_41883039的博客 1146

『ISOBUS 入门』第 00 节 导言:ISOBUS 的宏观图景与入门路径

ISOBUS 是由三部分构成的集成系统:两段CAN网络(拖拉机与农具侧)、标准化通信约定及认证流程。其核心在于通过统一协议实现跨品牌设备即插即用。标准体系以ISO 11783为基础,分层涵盖物理层、传输层至应用层,关键功能如虚拟终端(VT)、任务控制器(TC)和文件服务器依赖严格的会话管理与角色分工。实际部署中,总线上传输多种协议报文,故障排查需结合地址声明、多包传输与角色权限分析。学习应从真实报文入手,建立“角色—数据流—功能块”认知链,避免仅学标准或仿真替代实测,方能有效应对复杂现场问题。

linx295的博客 281

AI模型监控四层防御体系:数据、特征、模型、业务全链路实战

机器学习模型监控是保障AI系统在生产环境中持续可靠运行的核心能力,其本质远超传统APM——它需穿透数据输入、特征计算、模型推理到业务结果的完整链条。基于数据漂移、特征腐化、模型退化等关键现象,构建分层可观测体系,能提前识别分布偏移、类型异常、置信度衰减等隐性失效。技术价值在于将‘黑盒决策’转化为可诊断、可干预、可审计的工程闭环,广泛应用于推荐系统、风控模型、搜索排序等高敏感场景。本文聚焦Kubernetes原生落地路径,深度融合OpenTelemetry与Evidently,实现零侵入、强关联、带SOP的实

xSTARx 371

金证股份软件测试笔试题面试题

boss上这家公司的HR找到了我,我看了一下这家公司的业务,是我以前做过的基金与证券。还是很感兴趣的,决定去面试看看情况。 (因为只是想去涨面试经验,没有想拿offer,一些回答有点不太对,为后面木有offer埋下伏笔。其实有点亏,毕竟走路过去,而且还花了3个小时) 地点在金证股份科技大楼8楼。 2月25号 主要分为笔试题和面试。 1、笔试题 进来的时候直接给我一份笔试题做,做了一个半小时吧。 分为3道选择题和1道SQL查询题、1道案例设计题 选择题都是考察SQL函数,可能日常生活中没有见过

全村的希望的博客 4451

从光速测量到系统延迟分析:可观测性工程实践指南

在分布式系统和软件工程领域,延迟是衡量系统性能与健康状态的核心指标,其本质是信号或数据在组件间传播的时间差。理解延迟的原理,关键在于掌握通过观测时间差来推断系统内部状态的方法论,这一思想可追溯至早期科学实验。其技术价值在于,它为构建高可观测性系统提供了理论基础,使工程师能够精准定位性能瓶颈、诊断故障根因。在实际应用场景中,从网络调用、微服务链路到数据库查询,延迟分析无处不在。本文以分布式追踪和可观测性栈为核心,详细阐述了如何利用Prometheus、Jaeger等工具实施现代版“延迟测量”,将这一经典方法论

weixin_30482181的博客 2223

从零搭建Obsidian智能知识库:Ollama本地模型与Copilot插件实战指南

本文详细介绍了如何从零搭建Obsidian智能知识库,结合Ollama本地模型与Copilot插件实现高效知识管理。通过本地部署AI助手,用户可以在保证隐私安全的同时,快速检索和整理笔记,提升工作效率。文章涵盖硬件准备、Ollama部署、插件配置及实战技巧,适合需要高效知识管理的专业人士。

weixin_29230773的博客 631

如何制作微信小程序的在线购物商城应用

首先,你需要规划好商城的整体框架,确定好你的目标用户群体,思考他们的需求是什么。接下来,使用微信开发者工具创建一个新的小程序项目,输入你的AppID,选择好保存路径,点击“创建”,一个新的商城雏形就诞生了。你可以把这里当作自己的家,无论是工作之余的小憩,还是寻找灵感的驿站,我都希望你能在这里找到属于你的那份快乐和满足。数据是现代商业的灵魂,通过数据分析,你可以更准确地把握用户的行为模式,从而做出更明智的决策。

master_chenchen的博客 2427

动态污点分析实战:从原理到Java漏洞挖掘工具搭建

数据流分析是理解软件行为和安全风险的基础技术,它通过追踪数据在程序中的传播路径来识别潜在问题。其核心原理在于标记不可信输入源,并监控数据在运算、传递过程中的流向,最终判断是否触及敏感操作点。这项技术的核心价值在于能将复杂的安全漏洞检测转化为可自动化追踪的数据流问题,极大提升了漏洞挖掘的效率和精度。在应用场景上,它广泛适用于Web安全审计、软件供应链检测以及自动化渗透测试等领域。本文聚焦于动态污点分析这一实现技术,深入剖析其作为自动化漏洞挖掘利器的实现机制,并详细演示如何构建针对Java Web应用的插桩探针

weixin_34072458的博客 372

Tailscale 自建 DERP 中继服务器

Tailscale自建DERP中继服务器

Accompagner的博客 4329

AI智能体故障监控:从定义、分层到实战排查的完整指南

在软件开发和运维领域,监控是保障系统稳定性的基石,其核心在于对系统状态的可观测性。其原理是通过采集指标、日志和追踪数据,构建对系统运行状态的实时感知能力。对于现代AI应用,尤其是基于大语言模型(LLM)构建的智能体(Agent),监控的技术价值尤为突出,因为它能有效应对其非确定性、依赖复杂和成本敏感等新挑战。在应用场景上,无论是使用Dify、Coze等平台,还是基于LangChain、Spring AI等框架自研的智能体,都需要一套从基础设施到AI管道的分层监控体系。本文聚焦于**AI智能体故障监控**,系

weixin_34220179的博客 333

PCL 贪婪投影三角剖分算法【2025最新版】

本博客在学习PCL中的贪婪投影三角算法的基础上,实现了使用彩色点云重建彩色模型的应用案例。博客长期更新,最近一次更新时间为:2025年7月6日。

点云侠的博客 37万+

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

从渐冻症攻关到技术平台:如何用工程化思维构建可复用的“试验田”

在软件工程和复杂系统开发中,构建一个能够持续验证假设、高效迭代的平台至关重要。其核心原理在于通过标准化接口、数据驱动和流程闭环,将不确定性问题转化为可并行测试的模块化任务。这种工程化思维的技术价值在于大幅降低试错成本、加速创新验证,并能将成功模式规模化复用。典型的应用场景包括分布式系统的可观测性平台、药物研发流水线以及多团队协作的中台架构。本文以攻克渐冻症的“破冰驿站”为引,深入剖析了如何通过定义统一数据模型、搭建可扩展基础设施以及建立反馈闭环,来确保平台的“底层逻辑跑通”,从而为攻克各类复杂技术难题提供了

weixin_30633405的博客 339

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

上一篇: java.lang.instrument文档翻译
下一篇: opentelemetry-java readme翻译
ProLayman
博客等级 码龄10年 105粉丝 192原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值