Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
michael2893 committed Jan 6, 2025
1 parent 69bec1b commit abf5a93
Show file tree
Hide file tree
Showing 21 changed files with 341 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/DOCS_UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Docs PR Checklist

<!--- Just making sure... -->

- [ ] This PR is for a documentation page whose authoritative copy is in the
opentelemetry.io repository.
8 changes: 8 additions & 0 deletions content/en/announcements/eBPF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: eBPF
date: 2024-06-07
expiryDate: 2024-07-25
---

Elastic's **eBPF profiling agent** is now part of OTel.
[Learn more](/blog/2024/elastic-contributes-continuous-profiling-agent)
9 changes: 9 additions & 0 deletions content/en/announcements/kubecon-china.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: KubeCon China
date: 2024-07-10
expiryDate: 2024-08-23
---

<i class="fas fa-bullhorn"></i> Join us in Hong Kong for
[**KubeCon + CloudNativeCon + OpenSourceSummit + AI_dev**](/blog/2024/kubecon-china/)
, August 21 - 23, 2024
10 changes: 10 additions & 0 deletions content/en/announcements/otel-community-day.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: OTel Community Day
date: 2024-04-05
expiryDate: 2024-06-25
weight: -1 # top
---

<i class="fas fa-bullhorn"></i> Join us for
[**OTel Community Day**](https://events.linuxfoundation.org/open-telemetry-community-day/)
on June 25th
9 changes: 9 additions & 0 deletions content/en/announcements/otel-localized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: OpenTelemetry website goes multilingual!
date: 2024-08-21
expiryDate: 2024-09-30
weight: -240821 # top
---

<i class="fas fa-language"></i> {{% param title %}}
[Learn more](/blog/2024/docs-localized/)
15 changes: 15 additions & 0 deletions content/en/api-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: API Documentation
linkTitle: Docs
---

{{% blocks/section color="white" %}}

## {{% param title %}}

Below you will find links to all the API references available for the different
implementations of the OpenTelemetry API & SDK

{{% apidocs %}}

{{% /blocks/section %}}
43 changes: 39 additions & 4 deletions content/en/docs/collector/deployment/gateway/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description:
Why and how to send signals to a single OTLP end-point and from there to
backends
weight: 3
cSpell:ignore: hostnames loadbalancer loadbalancing
# prettier-ignore
cSpell:ignore: filelogreceiver hostmetricsreceiver hostnames loadbalancer loadbalancing resourcedetectionprocessor
---

The gateway collector deployment pattern consists of applications (or other
Expand Down Expand Up @@ -39,9 +40,9 @@ Let's have a look at such a case where we are using the load-balancing exporter:

### NGINX as an "out-of-the-box" load balancer

Assuming you have three collectors (`collector1`, `collector2`, and
`collector3`) configured and you want to load balance traffic across them using
NGINX, you can use the following configuration:
Assuming you have two collectors (`collector1` and `collector2`) configured and
you want to load balance traffic across them using NGINX, you can use the
following configuration:

```nginx
server {
Expand Down Expand Up @@ -198,14 +199,48 @@ The load-balancing exporter emits metrics including
that you can use for health and performance monitoring of the OTLP endpoint
collector.

## Combined deployment of Collectors as agents and gateways

Often a deployment of multiple OpenTelemetry collectors involves running both
Collector as gateways and as [agents](/docs/collector/deployment/agent/).

The following diagram shows an architecture for such a combined deployment:

- We use the Collectors running in the agent deployment pattern (running on each
host, similar to Kubernetes daemonsets) to collect telemetry from services
running on the host and host telemetry, such as host metrics and scrap logs.
- We use Collectors running in the gateway deployment pattern to process data,
such as filtering, sampling, and exporting to backends etc.

![gateway](otel-gateway-arch.svg)

This combined deployment pattern is necessary, when you use components in your
Collector that either need to be unique per host or that consume information
that is only available on the same host as the application is running:

- Receivers like the
[`hostmetricsreceiver`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/hostmetricsreceiver)
or
[`filelogreceiver`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver)
need to be unique per host instance. Running multiple instances of these
receivers will result in duplicated data.

- Processors like the
[`resourcedetectionprocessor`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor)
are used to add information about the host, the collector and the application
are running on. Running them within a Collector on a remote machine will
result in incorrect data.

## Tradeoffs

Pros:

- Separation of concerns such as centrally managed credentials
- Centralized policy management (for example, filtering certain logs or
sampling)

Cons:

- It's one more thing to maintain and that can fail (complexity)
- Added latency in case of cascaded collectors
- Higher overall resource usage (costs)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 187 additions & 0 deletions content/en/docs/languages/java/libraries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Using instrumentation libraries
linkTitle: Libraries
weight: 40
cSpell:ignore: getenv httpclient println
---

{{% docs/languages/libraries-intro "java" %}}

## Use Instrumentation Libraries

If a library does not come with OpenTelemetry out of the box, you can use
[instrumentation libraries](/docs/specs/otel/glossary/#instrumentation-library)
in order to generate telemetry data for a library or framework.

The Java agent for automatic instrumentation includes instrumentation libraries
for many common Java frameworks. Most are turned on by default. If you need to
turn off certain instrumentation libraries, you can
[suppress them](/docs/zero-code/java/agent/disable/).

If you use [code-based instrumentation](../instrumentation), you can leverage
some instrumentation libraries for your dependencies standalone. To find out
which standalone instrumentation libraries are available, take a look at
[this list](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks).
Follow the instructions of each instrumentation library to set them up.

## Example app

The following example instruments an HTTP client application using library
instrumentation which calls an HTTP server.

You can use the dice example app as HTTP server from
[Getting Started](../getting-started/) or you can create your own HTTP server.

### Dependencies

Set up an environment in a new directory named `java-simple-http-client`. Inside
the directory, create a file named `build.gradle.kts` with the following
content:

{{% alert title="Note" color="info" %}} The example is built using Gradle. You
might need to amend the directory structure and `pom.xml` to run using Maven.
{{% /alert %}}

{{< tabpane text=true >}} {{% tab Gradle %}}

```kotlin
plugins {
id("java")
id("application")
}

application {
mainClass.set("otel.SampleHttpClient")
}

sourceSets {
main {
java.setSrcDirs(setOf("."))
}
}

repositories {
mavenCentral()
}

dependencies {
implementation("io.opentelemetry:opentelemetry-api:{{% param vers.otel %}}");
implementation("io.opentelemetry:opentelemetry-sdk:{{% param vers.otel %}}");
implementation("io.opentelemetry:opentelemetry-exporter-logging:{{% param vers.otel %}}");
implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:{{% param vers.otel %}}");
implementation("io.opentelemetry.instrumentation:opentelemetry-java-http-client:{{% param vers.instrumentation %}}-alpha");
}
```

{{% /tab %}} {{% tab Maven %}}

```xml
<dependencies>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-java-http-client</artifactId>
<version>{{% param vers.instrumentation %}}-alpha</version>
</dependency>
</dependencies>
```

{{< /tab >}} {{< /tabpane>}}

### Setup

The following example shows how you can instrument external API calls using
[Java HTTP client library](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/java-http-client/library):

```java
// SampleHttpClient.java
package otel;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
import io.opentelemetry.instrumentation.httpclient.JavaHttpClientTelemetry;
import java.net.http.HttpClient;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public final class SampleHttpClient {
//Init OpenTelemetry
private static final OpenTelemetry openTelemetry = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();

//Use this HttpClient implementation for making standard http client calls.
public HttpClient createTracedClient(OpenTelemetry openTelemetry) {
return JavaHttpClientTelemetry.builder(openTelemetry).build().newHttpClient(createClient());
}

//your configuration of the Java HTTP Client goes here:
private HttpClient createClient() {
return HttpClient.newBuilder().build();
}

public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.GET()
.uri(URI.create(System.getenv().getOrDefault("EXTERNAL_API_ENDPOINT", "http://localhost:8080/rolldice")))
//.setHeader("User-Agent", "Java 11 HttpClient Bot") // add request header
.build();

SampleHttpClient s = new SampleHttpClient();
HttpResponse<String> response = s.createTracedClient(openTelemetry).send(request, HttpResponse.BodyHandlers.ofString());
// print response headers
HttpHeaders headers = response.headers();
headers.map().forEach((k, v) -> System.out.println(k + ":" + v));
// print status code
System.out.println(response.statusCode());
// print response body
System.out.println(response.body());

}
}
```

### Run

Set the `EXTERNAL_API_ENDPOINT` environment variable to specify the external API
endpoint. By default, it points to `http://localhost:8080/rolldice`, where
[example dice app](../getting-started/#example-application) is running.

To check your code, run the app:

```sh
env \
OTEL_SERVICE_NAME=http-client \
OTEL_TRACES_EXPORTER=logging \
OTEL_METRICS_EXPORTER=logging \
OTEL_LOGS_EXPORTER=logging \
gradle run
```

When you run the app, the instrumentation libraries do the following:

- Start a new trace.
- Generate a span that represents the request made to the external API endpoint.
- If you use an instrumented HTTP server, as in the
[dice app](../getting-started/#example-application), more trace spans are
generated with the same trace ID.

## Available instrumentation libraries

For a full list of instrumentation libraries, see
[opentelemetry-java-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks).

## Next steps

After you've set up instrumentation libraries, you might want to add
[additional instrumentation](../instrumentation) to collect custom telemetry
data.

You might also want to [configure the SDK](../configuration/) to export to one
or more telemetry backends.

For existing library instrumentations, also see
[Java agent](/docs/zero-code/java/agent/).

[opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java)
12 changes: 12 additions & 0 deletions content/ja/announcements/otel-community-day.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: OTel Community Day
date: 2024-04-05
expiryDate: 2024-06-25
weight: -1 # top
default_lang_commit: 8603bc8e
---

<i class="fas fa-bullhorn"></i>
6月25日に開催される
[**OTel コミュニティデー**](https://events.linuxfoundation.org/open-telemetry-community-day/)
にご参加ください
10 changes: 10 additions & 0 deletions content/ja/announcements/otel-localized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: OpenTelemetryのウェブサイトが国際化に対応しました!
date: 2024-08-21
expiryDate: 2024-09-30
weight: -240821 # top
default_lang_commit: 48eac183a4dd74946d5a45fa436cfc6052f30532
---

<i class="fas fa-language"></i> {{% param title %}}
[詳細はこちら](/blog/2024/docs-localized/)
10 changes: 10 additions & 0 deletions content/pt/announcements/otel-localized.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Site do OpenTelemetry com suporte a múltiplas linguas!
date: 2024-08-21
expiryDate: 2024-09-30
weight: -240821 # top
default_lang_commit: 48eac183a4dd74946d5a45fa436cfc6052f30532
---

<i class="fas fa-language"></i> {{% param title %}}
[Saiba mais](/blog/2024/docs-localized/)
12 changes: 12 additions & 0 deletions content/zh/announcements/otel-community-day.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: OTel Community Day
date: 2024-04-05
expiryDate: 2024-06-25
weight: -1 # top
default_lang_commit: c2cd5b14
---

<i class="fas fa-bullhorn"></i>
加入我们,参加
[**OTel 社区日**](https://events.linuxfoundation.org/open-telemetry-community-day/)
6月25日
8 changes: 8 additions & 0 deletions content/zh/blogs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 博客
menu:
main: { weight: 50 }
redirects: [{ from: '', to: '2024/ 301!' }]
outputs: [HTML, RSS]
default_lang_commit: aca2e07f0d3a6
---
1 change: 1 addition & 0 deletions examples/go 2
1 change: 1 addition & 0 deletions examples/java 2
1 change: 1 addition & 0 deletions tools/content/go 2
1 change: 1 addition & 0 deletions tools/content/java 2
1 change: 1 addition & 0 deletions tools/content/java-zero-code 2
1 change: 1 addition & 0 deletions tools/examples 2

0 comments on commit abf5a93

Please sign in to comment.