You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contribute/backend/instrumentation.md
+30-22Lines changed: 30 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,7 +156,7 @@ A distributed trace is data that tracks an application request as it flows throu
156
156
157
157
### Usage
158
158
159
-
Grafana currently supports two tracing implementations, [OpenTelemetry](https://opentelemetry.io/)and [OpenTracing](https://opentracing.io/). OpenTracing is deprecated, but still supported until we remove it. The two different implementations implements the `Tracer`and `Span` interfaces, defined in the _pkg/infra/tracing_ package, which you can use to create traces and spans. To get a hold of a `Tracer` you would need to get it injected as dependency into your service, see [Services](services.md) for more details.
159
+
Grafana uses [OpenTelemetry](https://opentelemetry.io/)for distributed tracing. There's an interface `Tracer` in the _pkg/infra/tracing_ package that implements the [OpenTelemetry Tracer interface](go.opentelemetry.io/otel/trace), which you can use to create traces and spans. To get a hold of a `Tracer` you would need to get it injected as dependency into your service, see [Services](services.md) for more details. For more information, see https://opentelemetry.io/docs/instrumentation/go/manual/.
@@ -243,6 +244,22 @@ If span names, attribute or event values originates from user input they **shoul
243
244
244
245
Be **careful** to not expose any sensitive information in span names, attribute or event values, e.g. secrets, credentials etc.
245
246
247
+
### Span attributes
248
+
249
+
Consider using `attributes.<Type>("<key>", <value>)` in favor of `attributes.Key("<key>").<Type>(<value>)` since it requires less characters and thereby reads easier.
### How to collect, visualize and query traces (and correlate logs with traces) locally
247
264
248
265
#### 1. Start Jaeger
@@ -255,20 +272,11 @@ make devenv sources=jaeger
255
272
256
273
To enable tracing in Grafana, you must set the address in your config.ini file
257
274
258
-
opentelemetry tracing (recommended):
259
-
260
275
```ini
261
276
[tracing.opentelemetry.jaeger]
262
277
address = http://localhost:14268/api/traces
263
278
```
264
279
265
-
opentracing tracing (deprecated/not recommended):
266
-
267
-
```ini
268
-
[tracing.jaeger]
269
-
address = localhost:6831
270
-
```
271
-
272
280
#### 3. Search/browse collected logs and traces in Grafana Explore
273
281
274
282
You need provisioned gdev-jaeger and gdev-loki datasources, see [developer dashboard and data sources](https://github.com/grafana/grafana/tree/main/devenv#developer-dashboards-and-data-sources) for setup instructions.
0 commit comments