Skip to content

Commit

Permalink
Merge branch 'main' into sdk-metric-import-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-womeldorf authored May 15, 2023
2 parents 128e78a + fadd3d6 commit b3038eb
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ Any [Maintainer] can merge the PR once the above criteria have been met.
## Design Choices

As with other OpenTelemetry clients, opentelemetry-go follows the
[OpenTelemetry Specification](https://opentelemetry.io/docs/reference/specification).
[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel).

It's especially valuable to read through the [library
guidelines](https://opentelemetry.io/docs/reference/specification/library-guidelines).
guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines).

### Focus on Capabilities, Not Structure Compliance

Expand Down
52 changes: 52 additions & 0 deletions sdk/trace/id_generator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package trace

import (
"context"
"testing"

"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/trace"
)

func TestNewIDs(t *testing.T) {
gen := defaultIDGenerator()
n := 1000

for i := 0; i < n; i++ {
traceID, spanID := gen.NewIDs(context.Background())
assert.Truef(t, traceID.IsValid(), "trace id: %s", traceID.String())
assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String())
}
}

func TestNewSpanID(t *testing.T) {
gen := defaultIDGenerator()
testTraceID := [16]byte{123, 123}
n := 1000

for i := 0; i < n; i++ {
spanID := gen.NewSpanID(context.Background(), testTraceID)
assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String())
}
}

func TestNewSpanIDWithInvalidTraceID(t *testing.T) {
gen := defaultIDGenerator()
spanID := gen.NewSpanID(context.Background(), trace.TraceID{})
assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String())
}
14 changes: 9 additions & 5 deletions website_docs/exporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and metrics, you will need to export them to a backend.
## OTLP endpoint

To send trace data to an OTLP endpoint (like the [collector](/docs/collector) or
Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your endpoint.
Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your
endpoint.

### Using HTTP

Expand All @@ -30,12 +31,13 @@ func installExportPipeline(ctx context.Context) (func(context.Context) error, er
}
```

To learn more on how to use the OTLP HTTP exporter, try out the [otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector)
To learn more on how to use the OTLP HTTP exporter, try out the
[otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector)

### Jaeger

To try out the OTLP exporter, since v1.35.0 you can run
[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace
[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace
visualization in a docker container:

```shell
Expand All @@ -48,6 +50,8 @@ docker run -d --name jaeger \

## Prometheus

Prometheus export is available in the `go.opentelemetry.io/otel/exporters/prometheus` package.
Prometheus export is available in the
`go.opentelemetry.io/otel/exporters/prometheus` package.

Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus)
Please find more documentation on
[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus)
4 changes: 2 additions & 2 deletions website_docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ With the imports added, you can start instrumenting.
The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These
[`Tracer`]s are designed to be associated with one instrumentation library. That
way telemetry they produce can be understood to come from that part of a code
base. To uniquely identify your application to the [`Tracer`] you will
create a constant with the package name in `app.go`.
base. To uniquely identify your application to the [`Tracer`] you will create a
constant with the package name in `app.go`.

```go
// name is the Tracer name used to identify this instrumentation library.
Expand Down
2 changes: 1 addition & 1 deletion website_docs/libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ weight: 3

Go does not support truly automatic instrumentation like other languages today.
Instead, you'll need to depend on
[instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library)
[instrumentation libraries](/docs/specs/otel/glossary/#instrumentation-library)
that generate telemetry data for a particular instrumented library. For example,
the instrumentation library for `net/http` will automatically create spans that
track inbound and outbound requests once you configure it in your code.
Expand Down
5 changes: 2 additions & 3 deletions website_docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ After configuring context propagation, you'll most likely want to use automatic
instrumentation to handle the behind-the-scenes work of actually managing
serializing the context.

[opentelemetry specification]: /docs/reference/specification/
[trace semantic conventions]:
/docs/reference/specification/trace/semantic_conventions/
[opentelemetry specification]: /docs/specs/otel/
[trace semantic conventions]: /docs/specs/otel/trace/semantic_conventions/
[instrumentation library]: ../libraries/

0 comments on commit b3038eb

Please sign in to comment.