Skip to content

Commit

Permalink
add example for exporting logs over otlp + http (#4358)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <[email protected]>
Co-authored-by: Phillip Carter <[email protected]>
  • Loading branch information
codeboten and cartermp authored Apr 26, 2024
1 parent 5cf59b8 commit 8300a59
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 20 additions & 1 deletion content/en/docs/languages/go/exporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Exporters
aliases: [exporting_data]
weight: 50
# prettier-ignore
cSpell:ignore: otlpmetric otlpmetricgrpc otlpmetrichttp otlptrace otlptracegrpc otlptracehttp promhttp stdoutlog stdouttrace
cSpell:ignore: otlplog otlploghttp otlpmetric otlpmetricgrpc otlpmetrichttp otlptrace otlptracegrpc otlptracehttp promhttp stdoutlog stdouttrace
---

{{% docs/languages/exporters/intro go %}}
Expand Down Expand Up @@ -194,3 +194,22 @@ func newExporter(ctx context.Context) (metric.Reader, error) {

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

### OTLP logs over HTTP (Experimental)

[`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp)
contains an implementation of OTLP logs exporter using HTTP with binary protobuf
payloads.

Here's how you can create an exporter with default configuration:

```go
import (
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
"go.opentelemetry.io/otel/sdk/log"
)

func newExporter(ctx context.Context) (log.Exporter, error) {
return otlploghttp.New(ctx)
}
```
4 changes: 4 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -6859,6 +6859,10 @@
"StatusCode": 200,
"LastSeen": "2024-01-18T19:10:29.862565-05:00"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp": {
"StatusCode": 200,
"LastSeen": "2024-04-25T07:21:16.712986-07:00"
},
"https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc": {
"StatusCode": 200,
"LastSeen": "2024-01-30T15:25:43.27652-05:00"
Expand Down

0 comments on commit 8300a59

Please sign in to comment.