@@ -3,7 +3,7 @@ title: Exporters
3
3
aliases : [exporting_data]
4
4
weight : 50
5
5
# prettier-ignore
6
- cSpell:ignore : otlplog otlploggrpc otlploghttp otlpmetric otlpmetricgrpc otlpmetrichttp otlptrace otlptracegrpc otlptracehttp promhttp stdoutlog stdouttrace
6
+ cSpell:ignore : otlplog otlploggrpc otlploghttp otlpmetric otlpmetricgrpc otlpmetrichttp otlptrace otlptracegrpc otlptracehttp stdoutlog stdouttrace
7
7
---
8
8
9
9
{{% docs/languages/exporters/intro go %}}
19
19
[ ` go.opentelemetry.io/otel/exporters/stdout/stdouttrace ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/stdout/stdouttrace )
20
20
package contains an implementation of the console trace exporter.
21
21
22
- Here's how you can create an exporter with default configuration:
23
-
24
- ``` go
25
- import (
26
- " go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
27
- " go.opentelemetry.io/otel/sdk/trace"
28
- )
29
-
30
- func newExporter () (trace .SpanExporter , error ) {
31
- return stdouttrace.New ()
32
- }
33
- ```
34
-
35
22
### Console metrics
36
23
37
24
The
38
25
[ ` go.opentelemetry.io/otel/exporters/stdout/stdoutmetric ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric )
39
26
package contains an implementation of the console metrics exporter.
40
27
41
- Here's how you can create an exporter with default configuration:
42
-
43
- ``` go
44
- import (
45
- " go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
46
- " go.opentelemetry.io/otel/sdk/metric"
47
- )
48
-
49
- func newExporter () (metric .Exporter , error ) {
50
- return stdoutmetric.New ()
51
- }
52
- ```
53
-
54
28
### Console logs (Experimental) {#console-logs}
55
29
56
30
The
57
31
[ ` go.opentelemetry.io/otel/exporters/stdout/stdoutlog ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/stdout/stdoutlog )
58
32
package contains an implementation of the console log exporter.
59
33
60
- Here's how you can create an exporter with default configuration:
61
-
62
- ``` go
63
- import (
64
- " go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
65
- " go.opentelemetry.io/otel/sdk/log"
66
- )
67
-
68
- func newExporter () (log .Exporter , error ) {
69
- return stdoutlog.New ()
70
- }
71
- ```
72
-
73
34
## OTLP
74
35
75
36
To send trace data to an OTLP endpoint (like the [ collector] ( /docs/collector ) or
@@ -82,41 +43,11 @@ endpoint.
82
43
contains an implementation of the OTLP trace exporter using HTTP with binary
83
44
protobuf payloads.
84
45
85
- Here's how you can create an exporter with default configuration:
86
-
87
- ``` go
88
- import (
89
- " context"
90
-
91
- " go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
92
- " go.opentelemetry.io/otel/sdk/trace"
93
- )
94
-
95
- func newExporter (ctx context .Context ) (trace .SpanExporter , error ) {
96
- return otlptracehttp.New (ctx)
97
- }
98
- ```
99
-
100
46
### OTLP traces over gRPC
101
47
102
48
[ ` go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc )
103
49
contains an implementation of OTLP trace exporter using gRPC.
104
50
105
- Here's how you can create an exporter with default configuration:
106
-
107
- ``` go
108
- import (
109
- " context"
110
-
111
- " go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
112
- " go.opentelemetry.io/otel/sdk/trace"
113
- )
114
-
115
- func newExporter (ctx context .Context ) (trace .SpanExporter , error ) {
116
- return otlptracegrpc.New (ctx)
117
- }
118
- ```
119
-
120
51
### Jaeger
121
52
122
53
To try out the OTLP exporter, since v1.35.0 you can run
@@ -138,40 +69,21 @@ docker run -d --name jaeger \
138
69
contains an implementation of OTLP metrics exporter using HTTP with binary
139
70
protobuf payloads.
140
71
141
- Here's how you can create an exporter with default configuration:
142
-
143
- ``` go
144
- import (
145
- " context"
146
-
147
- " go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
148
- " go.opentelemetry.io/otel/sdk/metric"
149
- )
150
-
151
- func newExporter (ctx context .Context ) (metric .Exporter , error ) {
152
- return otlpmetrichttp.New (ctx)
153
- }
154
- ```
155
-
156
72
### OTLP metrics over gRPC
157
73
158
74
[ ` go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc )
159
75
contains an implementation of OTLP metrics exporter using gRPC.
160
76
161
- Here's how you can create an exporter with default configuration:
77
+ ### OTLP logs over HTTP (Experimental)
162
78
163
- ``` go
164
- import (
165
- " context "
79
+ [ ` go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp )
80
+ contains an implementation of OTLP logs exporter using HTTP with binary protobuf
81
+ payloads.
166
82
167
- " go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
168
- " go.opentelemetry.io/otel/sdk/metric"
169
- )
83
+ ### OTLP logs over gRPC (Experimental)
170
84
171
- func newExporter (ctx context .Context ) (metric .Exporter , error ) {
172
- return otlpmetricgrpc.New (ctx)
173
- }
174
- ```
85
+ [ ` go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc )
86
+ contains an implementation of OTLP logs exporter using gRPC.
175
87
176
88
## Prometheus (Experimental)
177
89
@@ -184,61 +96,5 @@ contains an implementation of Prometheus metrics exporter.
184
96
Here's how you can create an exporter (which is also a metric reader) with
185
97
default configuration:
186
98
187
- ``` go
188
- import (
189
- " context"
190
-
191
- " go.opentelemetry.io/otel/exporters/prometheus"
192
- " go.opentelemetry.io/otel/sdk/metric"
193
- )
194
-
195
- func newExporter (ctx context .Context ) (metric .Reader , error ) {
196
- // prometheus.DefaultRegisterer is used by default
197
- // so that metrics are available via promhttp.Handler.
198
- return prometheus.New ()
199
- }
200
- ```
201
-
202
99
To learn more on how to use the Prometheus exporter, try the
203
100
[ prometheus example] ( https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples/prometheus )
204
-
205
- ### OTLP logs over HTTP (Experimental)
206
-
207
- [ ` go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp )
208
- contains an implementation of OTLP logs exporter using HTTP with binary protobuf
209
- payloads.
210
-
211
- Here's how you can create an exporter with default configuration:
212
-
213
- ``` go
214
- import (
215
- " context"
216
-
217
- " go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
218
- " go.opentelemetry.io/otel/sdk/log"
219
- )
220
-
221
- func newExporter (ctx context .Context ) (log .Exporter , error ) {
222
- return otlploghttp.New (ctx)
223
- }
224
- ```
225
-
226
- ### OTLP logs over gRPC (Experimental)
227
-
228
- [ ` go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc ` ] ( https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc )
229
- contains an implementation of OTLP logs exporter using gRPC.
230
-
231
- Here's how you can create an exporter with default configuration:
232
-
233
- ``` go
234
- import (
235
- " context"
236
-
237
- " go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc"
238
- " go.opentelemetry.io/otel/sdk/log"
239
- )
240
-
241
- func newExporter (ctx context .Context ) (log .Exporter , error ) {
242
- return otlploggrpc.New (ctx)
243
- }
244
- ```
0 commit comments