-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_sync_gauge_example
- Loading branch information
Showing
26 changed files
with
156 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,7 +122,7 @@ such as serverless, can import packages before the instrumentation code has a | |
chance to run. This can be easily missed. | ||
|
||
To diagnose this issue, enable logging and verify you are seeing your | ||
instrumentation package being loaded. For example: | ||
instrumentation library being loaded. For example: | ||
|
||
```nocode | ||
@opentelemetry/instrumentation-http Applying patch for [email protected] | ||
|
@@ -337,7 +337,7 @@ provider.shutdown(); | |
## Package Versions Compatibility | ||
|
||
Some issues can be a result of incompatible or old versions of SDK and | ||
instrumentation packages. | ||
instrumentation libraries. | ||
|
||
### SDK versions | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
content/en/docs/zero-code/java/spring-boot-starter/additional-instrumentations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Additional instrumentation | ||
weight: 50 | ||
weight: 60 | ||
--- | ||
|
||
The OpenTelemetry Spring Boot starter provides | ||
|
108 changes: 73 additions & 35 deletions
108
content/en/docs/zero-code/java/spring-boot-starter/annotations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,95 @@ | ||
--- | ||
title: Annotations | ||
weight: 60 | ||
weight: 50 | ||
cSpell:ignore: proxys | ||
--- | ||
|
||
For most users, the out-of-the-box instrumentation is completely sufficient and | ||
nothing more has to be done. Sometimes, however, users wish to create | ||
[spans](/docs/concepts/signals/traces/#spans) for their own custom code without | ||
doing too much code change. | ||
needing to make many code changes. | ||
|
||
## Available annotations | ||
|
||
This feature uses spring-aop to wrap methods annotated with `@WithSpan` in a | ||
span. The arguments to the method can be captured as attributed on the created | ||
span by annotating the method parameters with `@SpanAttribute`. | ||
|
||
> **Note**: this annotation can only be applied to bean methods managed by the | ||
> spring application context. To learn more about aspect weaving in spring, see | ||
> [spring-aop](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#aop). | ||
| Feature | Property | Default Value | Description | | ||
| ----------- | ------------------------------------------ | ------------- | --------------------------------- | | ||
| `@WithSpan` | `otel.instrumentation.annotations.enabled` | true | Enables the WithSpan annotations. | | ||
If you add the `WithSpan` annotation to a method, the method is wrapped in a | ||
span. The `SpanAttribute` annotation allows you to capture the method arguments | ||
as attributes. | ||
|
||
```java | ||
import org.springframework.stereotype.Component; | ||
|
||
import io.opentelemetry.instrumentation.annotations.SpanAttribute; | ||
import io.opentelemetry.instrumentation.annotations.WithSpan; | ||
import io.opentelemetry.api.trace.Span; | ||
import io.opentelemetry.api.trace.SpanKind; | ||
|
||
/** | ||
* Test WithSpan | ||
*/ | ||
@Component | ||
public class TracedClass { | ||
|
||
@WithSpan | ||
public void tracedMethod() { | ||
public void tracedMethod(@SpanAttribute parameter) { | ||
} | ||
``` | ||
|
||
@WithSpan(value="span name") | ||
public void tracedMethodWithName() { | ||
Span currentSpan = Span.current(); | ||
currentSpan.addEvent("ADD EVENT TO tracedMethodWithName SPAN"); | ||
currentSpan.setAttribute("isTestAttribute", true); | ||
} | ||
{{% alert title="Note" color="info" %}} The OpenTelemetry annotations use Spring | ||
AOP based on proxys. | ||
|
||
These annotations work only for the methods of the proxy. You can learn more in | ||
the | ||
[Spring documentation](https://docs.spring.io/spring-framework/reference/core/aop/proxying.html). | ||
|
||
@WithSpan(kind = SpanKind.CLIENT) | ||
public void tracedClientSpan() { | ||
In the following example, the `WithSpan` annotation won't do anything when the | ||
GET endpoint is called: | ||
|
||
```java | ||
@RestController | ||
public class MyControllerManagedBySpring { | ||
|
||
@GetMapping("/ping") | ||
public void aMethod() { | ||
anotherMethod(); | ||
} | ||
|
||
public void tracedMethodWithAttribute(@SpanAttribute("attributeName") String parameter) { | ||
@WithSpan | ||
public void anotherMethod() { | ||
} | ||
} | ||
``` | ||
|
||
{{% /alert %}} | ||
|
||
{{% alert title="Note" color="info" %}} | ||
|
||
To be able to use the OpenTelemetry annotations, you have to add the Spring Boot | ||
Starter AOP dependency to your project: | ||
|
||
{{< tabpane text=true >}} {{% tab header="Maven (`pom.xml`)" lang=Maven %}} | ||
|
||
```xml | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-aop</artifactId> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
{{% /tab %}} {{% tab header="Gradle (`gradle.build`)" lang=Gradle %}} | ||
|
||
```kotlin | ||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-aop") | ||
} | ||
``` | ||
|
||
{{% /tab %}} {{< /tabpane >}} | ||
|
||
{{% /alert %}} | ||
|
||
You can disable the OpenTelemetry annotations by setting the | ||
`otel.instrumentation.annotations.enabled` property to `false`. | ||
|
||
You can customize the span by using the elements of the `WithSpan` annotation: | ||
|
||
| Name | Type | Description | Default Value | | ||
| ------- | ---------- | --------------------- | ------------------- | | ||
| `value` | `String` | Span name | ClassName.Method | | ||
| `kind` | `SpanKind` | Span kind of the span | `SpanKind.INTERNAL` | | ||
|
||
You can set the attribute name from the `value` element of the `SpanAttribute` | ||
annotation: | ||
|
||
| Name | Type | Description | Default Value | | ||
| ------- | -------- | -------------- | --------------------- | | ||
| `value` | `String` | Attribute name | Method parameter name | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: 迁移 | ||
description: 如何迁移到 OpenTelemetry | ||
weight: 950 | ||
default_lang_commit: 4b1f5e382758278e1e56e7b197bd349c17fdf9cb | ||
--- | ||
|
||
## OpenTracing 和 OpenCensus | ||
|
||
OpenTelemetry 是 OpenTracing 和 OpenCensus 的合并版本。 | ||
从一开始,OpenTelemetry 就被定位[成为 OpenTracing 和 OpenCensus 的下一个主要版本][]。 | ||
因此,OpenTelemetry 项目的[关键目标][]之一是提供与两个项目的向后兼容性以及为现有用户提供迁移方案。 | ||
|
||
如果你来自其中一个项目,你可以遵循 [OpenTracing](opentracing/) 和 | ||
[OpenCensus](opencensus/) 的迁移指南。 | ||
|
||
## Jaeger 客户端 | ||
|
||
[Jaeger 社区](https://www.jaegertracing.io/)弃用了他们的[客户端库](https://www.jaegertracing.io/docs/latest/client-libraries/)并建议使用 | ||
OpenTelemetry 的 API、SDK 和插桩器。 | ||
|
||
自 v1.35 起,Jaeger 后端可以通过 OpenTelemetry 协议(OTLP)接收链路数据。 | ||
因此,你可以将 OpenTelemetry SDK 和收集器从使用 Jaeger 导出器迁移到 OTLP 导出器。 | ||
|
||
[成为 OpenTracing 和 OpenCensus 的下一个主要版本]: https://www.cncf.io/blog/2019/05/21/a-brief-history-of-opentelemetry-so-far/ | ||
[关键目标]: https://medium.com/opentracing/merging-opentracing-and-opencensus-f0fe9c7ca6f0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.