GoogleCloudPlatform / GoogleCloudPlatform/cloud-trace-data-source-plugin

Proposition to not format Trace SpanID

Open
#24 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
16
Forks
6
PR merge metrics
No merged PRs in 30d

Description

When using the plugin, I have noticed that SpanIDs are formatted.

```
spanIDField.Append(strconv.FormatUint(s.GetSpanId(), 10))
```
https://github.com/GoogleCloudPlatform/cloud-trace-data-source-plugin/blob/2926fd2d77f30b927663605524ef788d0d014eef/pkg/plugin/plugin.go#L297C3-L297C14

Problem is that makes the Span IDs "unusable":
Say you want to use this ID to check the logs for specific SpanId. Google Cloud Logging expects the spanID in '016x' format, as it is originally set in the Trace span metadata.

I would like to propose that the plugin wouldn't format the spanIDs.

I have tried to format the ID back to '016x' using Grafana variables and Big Query
```
DECLARE spanIDString STRING;
SET spanIDString = "$span_id";

SELECT FORMAT("%016x", CAST(spanIDString AS INT64)) AS spanID;
```

but there are times where the spanID is getting (from the plugin) a value too large to be cast as an INT64. So my workaround doesn't work either.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.