1

From the documentation:

To associate a log entry with a trace by setting the trace field in the LogEntry object. The trace field must be set to a string with the following format:

projects/PROJECT_ID/traces/TRACE_ID where PROJECT_ID is your Google

Cloud project ID and TRACE_ID is the trace identifier

To associate a log entry with a span when using the Cloud Logging API, set the spanId field in the LogEntry object to the 16-character hexadecimal encoding of the span's ID. For example, to associate a log entry with a span that has an ID of 74, set the span ID to 000000000000004a.

However, this assumes that I am using @google-cloud/trace-agent, which I am not – I am using .

Is there a way to associate logs with Open Telemetry by assigning them meta data that Google would recognize or must I submit all the logs directly to OpenTelemetry collector?

Gajus
  • 69,002
  • 70
  • 275
  • 438
  • Context: are you using the OTEL collector with googlecloudexporter to export logs? If so, the otel collector needs the `spanId` and `traceId` to be set in the payload that is sent, the googlecloudexporter will automatically create the `trace` field. If not, you will need to manually set the `trace` and `spanId` fields in your structured logs. – Glen Carpenter Aug 31 '23 at 15:38

0 Answers0