mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: add ability to upload trace json (#37407)
* Tempo: upload json * Add test for upload * Minor changes * Add docs * Update docs/sources/datasources/tempo.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Add graphframes as well to upload * Add comments to code Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ This is a configuration for the [trace to logs feature]({{< relref "../explore/t
|
||||
|
||||
- **Data source -** Target data source.
|
||||
- **Tags -** The tags that will be used in the Loki query. Default is `'cluster', 'hostname', 'namespace', 'pod'`.
|
||||
- **Span start time shift -** Shift in the start time for the Loki query based on the span start time. In order to extend to the past, you need to use a negative value. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
- **Span start time shift -** A shift in the start time for the Loki query based on the start time for the span. To extend the time to the past, use a negative value. You can use time units, for example, 5s, 1m, 3h. The default is 0.
|
||||
- **Span end time shift -** Shift in the end time for the Loki query based on the span end time. Time units can be used here, for example, 5s, 1m, 3h. The default is 0.
|
||||
|
||||

|
||||
@@ -47,6 +47,56 @@ To query a particular trace, select the **TraceID** query type, and then put the
|
||||
|
||||
{{< figure src="/static/img/docs/tempo/query-editor-traceid.png" class="docs-image--no-shadow" caption="Screenshot of the Tempo TraceID query type" >}}
|
||||
|
||||
## Upload JSON trace file
|
||||
|
||||
You can upload a JSON file that contains a single trace to visualize it. If the file has multiple traces then the first trace is used for visualization.
|
||||
|
||||
{{< figure src="/static/img/docs/explore/tempo-upload-json.png" class="docs-image--no-shadow" caption="Screenshot of the Tempo data source in explore with upload selected" >}}
|
||||
|
||||
Here is an example JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"batches": [
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{ "key": "service.name", "value": { "stringValue": "db" } },
|
||||
{ "key": "job", "value": { "stringValue": "tns/db" } },
|
||||
{ "key": "opencensus.exporterversion", "value": { "stringValue": "Jaeger-Go-2.22.1" } },
|
||||
{ "key": "host.name", "value": { "stringValue": "63d16772b4a2" } },
|
||||
{ "key": "ip", "value": { "stringValue": "0.0.0.0" } },
|
||||
{ "key": "client-uuid", "value": { "stringValue": "39fb01637a579639" } }
|
||||
]
|
||||
},
|
||||
"instrumentationLibrarySpans": [
|
||||
{
|
||||
"instrumentationLibrary": {},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "AAAAAAAAAABguiq7RPE+rg==",
|
||||
"spanId": "cmteMBAvwNA=",
|
||||
"parentSpanId": "OY8PIaPbma4=",
|
||||
"name": "HTTP GET - root",
|
||||
"kind": "SPAN_KIND_SERVER",
|
||||
"startTimeUnixNano": "1627471657255809000",
|
||||
"endTimeUnixNano": "1627471657256268000",
|
||||
"attributes": [
|
||||
{ "key": "http.status_code", "value": { "intValue": "200" } },
|
||||
{ "key": "http.method", "value": { "stringValue": "GET" } },
|
||||
{ "key": "http.url", "value": { "stringValue": "/" } },
|
||||
{ "key": "component", "value": { "stringValue": "net/http" } }
|
||||
],
|
||||
"status": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Linking Trace ID from logs
|
||||
|
||||
You can link to Tempo trace from logs in Loki or Elastic by configuring an internal link. See the [Derived fields]({{< relref "loki.md#derived-fields" >}}) section in the [Loki data source]({{< relref "loki.md" >}}) or [Data links]({{< relref "elasticsearch.md#data-links" >}}) section in the [Elastic data source]({{< relref "elasticsearch.md" >}}) for configuration instructions.
|
||||
|
||||
Reference in New Issue
Block a user