Skip to content

Commit

Permalink
Merge branch 'main' into codeboten/blogpost-migrate-jaeger-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Boten authored Sep 18, 2023
2 parents 800d352 + 37aedc5 commit 49041f4
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 32 deletions.
2 changes: 1 addition & 1 deletion content/en/blog/2021/malabi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ canonical_url: https://medium.com/opentelemetry/trace-based-testing-with-opentel
cSpell:ignore: Malabi
---

This article introduces you to to Malabi, a new open source tool for trace-based
This article introduces you to Malabi, a new open source tool for trace-based
testing. For all the details, see the [original post][].

[original post]: {{% param canonical_url %}}
2 changes: 1 addition & 1 deletion content/en/blog/2022/troubleshooting-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ are other exporters to choose from, and each one has a few configuration
options. An error in one of these options will fail to export, which is silently
ignored by default.

A a few common configuration errors are covered in the following subsections.
A few common configuration errors are covered in the following subsections.

### OTLP exporters

Expand Down
8 changes: 4 additions & 4 deletions content/en/docs/concepts/signals/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ Some examples of use cases for metrics include:

## Views

A View provides SDK users with the flexibility to customize the metrics that are
output by the SDK. They can customize which metric instruments are to be
processed or ignored. They can customize aggregation and what attributes are to
be reported on metrics.
A view provides SDK users with the flexibility to customize the metrics output
by the SDK. You can customize which metric instruments are to be processed or
ignored. You can also customize aggregation and what attributes you want to
report on metrics.

## Language Support

Expand Down
112 changes: 103 additions & 9 deletions content/en/docs/instrumentation/go/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,7 @@ example).

Counters can be used to measure a non-negative, increasing value.

For example, here's how you might report the number of calls for an HTTP
handler:
For example, here's how you report the number of calls for an HTTP handler:

```go
import (
Expand Down Expand Up @@ -497,7 +496,7 @@ func init() {
UpDown counters can increment and decrement, allowing you to observe a
cumulative value that goes up or down.

For example, here's how you might report the number of items of some collection:
For example, here's how you report the number of items of some collection:

```go
import (
Expand Down Expand Up @@ -537,8 +536,8 @@ func removeItem() {

Histograms are used to measure a distribution of values over time.

For example, here's how you might report a distribution of response times for an
HTTP handler:
For example, here's how you report a distribution of response times for an HTTP
handler:

```go
import (
Expand Down Expand Up @@ -573,7 +572,7 @@ func init() {
Observable counters can be used to measure an additive, non-negative,
monotonically increasing value.

For example, here's how you might report time since the application started:
For example, here's how you report time since the application started:

```go
import (
Expand Down Expand Up @@ -604,7 +603,7 @@ func init() {
Observable UpDown counters can increment and decrement, allowing you to measure
an additive, non-negative, non-monotonically increasing cumulative value.

For example, here's how you might report some database metrics:
For example, here's how you report some database metrics:

```go
import (
Expand Down Expand Up @@ -656,8 +655,8 @@ func registerDBMetrics(db *sql.DB, meter metric.Meter, poolName string) (metric.

Observable Gauges should be used to measure non-additive values.

For example, here's how you might report memory usage of the heap objects used
in application:
For example, here's how you report memory usage of the heap objects used in
application:

```go
import (
Expand Down Expand Up @@ -720,6 +719,101 @@ func init() {
}
```

### Registering Views

A view provides SDK users with the flexibility to customize the metrics output
by the SDK. You can customize which metric instruments are to be processed or
ignored. You can also customize aggregation and what attributes you want to
report on metrics.

Every instrument has a default view, which retains the original name,
description, and attributes, and has a default aggregation that is based on the
type of instrument. When a registered view matches an instrument, the default
view is replaced by the registered view. Additional registered views that match
the instrument are additive, and result in multiple exported metrics for the
instrument.

You can use the
[`NewView`](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#NewView)
function to create a view and register it using the
[`WithView`](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#WithView)
option.

For example, here's how you create a view that renames the `latency` instrument
from the `v0.34.0` version of the `http` instrumentation library to
`request.latency`:

```go
view := metric.NewView(metric.Instrument{
Name: "latency",
Scope: instrumentation.Scope{
Name: "http",
Version: "0.34.0",
},
}, metric.Stream{Name: "request.latency"})

meterProvider := metric.NewMeterProvider(
metric.WithView(view),
)
```

For example, here's how you create a view that makes the `latency` instrument
from the `http` instrumentation library to be reported as an exponential
histogram:

```go
view := metric.NewView(
metric.Instrument{
Name: "latency",
Scope: instrumentation.Scope{Name: "http"},
},
metric.Stream{
Aggregation: metric.AggregationBase2ExponentialHistogram{
MaxSize: 160,
MaxScale: 20,
},
},
)

meterProvider := metric.NewMeterProvider(
metric.WithView(view),
)
```

The `NewView` function provides a convenient way of creating views. If `NewView`
can't provide the functionalities you need, you can create a custom
[`View`](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#View) directly.

For example, here's how you create a view that uses regular expression matching
to ensure all data stream names have a suffix of the units it uses:

```go
re := regexp.MustCompile(`[._](ms|byte)$`)
var view metric.View = func(i metric.Instrument) (metric.Stream, bool) {
// In a custom View function, you need to explicitly copy
// the name, description, and unit.
s := metric.Stream{Name: i.Name, Description: i.Description, Unit: i.Unit}
// Any instrument that does not have a unit suffix defined, but has a
// dimensional unit defined, update the name with a unit suffix.
if re.MatchString(i.Name) {
return s, false
}
switch i.Unit {
case "ms":
s.Name += ".ms"
case "By":
s.Name += ".byte"
default:
return s, false
}
return s, true
}

meterProvider := metric.NewMeterProvider(
metric.WithView(view),
)
```

## Logs

The logs API is currently unstable, documentation TBA.
Expand Down
51 changes: 48 additions & 3 deletions content/en/docs/instrumentation/java/exporters.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Exporters
weight: 50
cSpell:ignore: autoconfigure springframework
cSpell:ignore: autoconfigure classpath okhttp springframework
---

In order to visualize and analyze your traces, you will need to export them to a
Expand All @@ -17,10 +17,15 @@ how to setup exporters following the
For [manual instrumentation](/docs/instrumentation/java/manual), you will find
some introductions below on how to set up backends and the matching exporters.

## OTLP endpoint
## OTLP

To send trace data to a OTLP endpoint (like the [collector](/docs/collector) or
Jaeger) you'll want to use `opentelemetry-exporter-otlp`:
Jaeger) you'll want to use `opentelemetry-exporter-otlp`.

### OTLP Artifacts

There are multiple OTLP options available, each catering to different use cases.
For most users, the default artifact will suffice and be the most simple:

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

Expand All @@ -45,6 +50,46 @@ dependencies {

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

Under the hood, there are two protocol options supported, each with different
"sender" implementations.

- `grpc` - gRPC implementation of OTLP exporters, represented by
`OtlpGrpcSpanExporter`, `OtlpGrpcMetricExporter`, `OtlpGrpcLogRecordExporter`.
- `http/protobuf` - HTTP with protobuf encoded payload implementation of OTLP
exporters, represented by `OtlpHttpSpanExporter`, `OtlpHttpMetricExporter`,
`OtlpHttpLogRecordExporter`.

A sender is an abstraction which allows different gRPC / HTTP client
implementations to fulfill the OTLP contract. Regardless of the sender
implementation, the same exporter classes are used. A sender implementation is
automatically used when it is detected on the classpath. The sender
implementations are described in detail below:

- `{groupId}:{artifactId}` - Sender description.
- `io.opentelemetry:opentelemetry-exporter-sender-okhttp` - The default sender,
included automatically with `opentelemetry-exporter-otlp` and bundled with the
OpenTelemetry Java agent. This includes an
[OkHttp](https://square.github.io/okhttp/) based implementation for both the
`grpc` and `http/protobuf` versions of the protocol, and will be suitable for
most users. However, OkHttp has a transitive dependency on kotlin which is
problematic in some environments.
- `io.opentelemetry:opentelemetry-exporter-sender-jdk` - This sender includes a
JDK 11+
[HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html)
based implementation for the `http/protobuf` version of the protocol. It
requires zero additional dependencies, but requires Java 11+. To use, include
the artifact and explicitly exclude the default
`io.opentelemetry:opentelemetry-exporter-sender-okhttp` dependency.
- `io.opentelemetry:opentelemetry-exporter-sender-grpc-managed-channel` - This
sender includes a [grpc-java](https://github.com/grpc/grpc-java) based
implementation for the `grpc` version of the protocol. To use, include the
artifact, explicitly exclude the default
`io.opentelemetry:opentelemetry-exporter-sender-okhttp` dependency, and
include one of the
[gRPC transport implementations](https://github.com/grpc/grpc-java#transport).

### Usage

Next, configure the exporter to point at an OTLP endpoint.

If you use
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/instrumentation/js/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1452,8 +1452,8 @@ counter.add(-1);

Histograms are used to measure a distribution of values over time.

For example, here's how you might report a distribution of response times for an
API route with Express:
For example, here's how you report a distribution of response times for an API
route with Express:

{{< tabpane text=true langEqualsHeader=true >}} {{% tab TypeScript %}}

Expand Down
4 changes: 2 additions & 2 deletions content/en/ecosystem/adopters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ cSpell:ignore: Dapr Datenrettungsdienste Farfetch Globale Logicmonitor Logz Upli
# All spelling entries must be on a single line
---

OpenTelemetry's mission is to to enable effective observability for all its
OpenTelemetry's mission is to enable effective observability for all its
end-users. If you are thinking about adopting OpenTelemetry for your
organization, you may be curious about other adoption journeys. The table below
is a non-exhaustive list of
[end-user organizations](https://community.cncf.io/end-user-community/) that
[_end-user_ organizations](https://community.cncf.io/end-user-community/) that
have adopted OpenTelemetry for
[Observability](/docs/concepts/observability-primer/).

Expand Down
9 changes: 1 addition & 8 deletions data/ecosystem/vendors.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cSpell:ignore Coralogix Cribl ITRS Kloud Logz Crowdstrike Humio Lumigo observ Promscale Teletrace Uptrace Greptime KloudMate
# cSpell:ignore Coralogix Cribl ITRS Kloud Logz Crowdstrike Humio Lumigo observ Teletrace Uptrace Greptime KloudMate
- name: AppDynamics (Cisco)
distribution: true
nativeOTLP: true
Expand Down Expand Up @@ -202,13 +202,6 @@
contact: ''
oss: false
commercial: true
- name: Promscale
distribution: false
nativeOTLP: true
url: 'https://www.timescale.com/promscale'
contact: ''
oss: false
commercial: true
- name: Sentry
distribution: true
nativeOTLP: false
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
"@opentelemetry/auto-instrumentations-web": "^0.33.0",
"@opentelemetry/context-zone": "^1.8.0",
"@opentelemetry/core": "^1.8.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.41.0",
"@opentelemetry/instrumentation": "^0.41.0",
"@opentelemetry/instrumentation": "^0.43.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.43.0",
"@opentelemetry/resources": "^1.8.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@opentelemetry/sdk-trace-web": "^1.8.0",
Expand Down
32 changes: 32 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,10 @@
"StatusCode": 200,
"LastSeen": "2023-06-29T15:47:40.319503-04:00"
},
"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:38.052527-05:00"
},
"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpHeaders.html": {
"StatusCode": 200,
"LastSeen": "2023-06-29T15:54:32.716302-04:00"
Expand Down Expand Up @@ -2007,6 +2011,14 @@
"StatusCode": 200,
"LastSeen": "2023-06-30T09:15:19.257742-04:00"
},
"https://github.com/grpc/grpc-java": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:39.160279-05:00"
},
"https://github.com/grpc/grpc-java#transport": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:39.672623-05:00"
},
"https://github.com/hashicorp/nomad-open-telemetry-getting-started": {
"StatusCode": 200,
"LastSeen": "2023-06-30T08:44:24.194485-04:00"
Expand Down Expand Up @@ -4379,6 +4391,22 @@
"StatusCode": 200,
"LastSeen": "2023-09-11T14:33:25.420952095Z"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#NewView": {
"StatusCode": 200,
"LastSeen": "2023-09-15T09:41:38.164411819Z"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#View": {
"StatusCode": 200,
"LastSeen": "2023-09-15T09:41:38.432556144Z"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#With": {
"StatusCode": 200,
"LastSeen": "2023-09-15T09:41:38.295762202Z"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#WithView": {
"StatusCode": 200,
"LastSeen": "2023-09-15T16:34:14.034832295Z"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource": {
"StatusCode": 200,
"LastSeen": "2023-09-11T14:33:25.721659015Z"
Expand Down Expand Up @@ -4699,6 +4727,10 @@
"StatusCode": 200,
"LastSeen": "2023-06-30T11:44:31.406627-04:00"
},
"https://square.github.io/okhttp/": {
"StatusCode": 206,
"LastSeen": "2023-09-14T09:36:37.578867-05:00"
},
"https://stackoverflow.com/questions/5626193/what-is-monkey-patching": {
"StatusCode": 200,
"LastSeen": "2023-06-29T18:45:47.500299-04:00"
Expand Down

0 comments on commit 49041f4

Please sign in to comment.