From bcf114654f6f16008741f85885230308aed5f318 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 11 Jul 2024 22:49:14 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20post-p?= =?UTF-8?q?rocessor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1815e266..105689e3 100644 --- a/README.md +++ b/README.md @@ -170,20 +170,18 @@ how to populate the Http request metadata for log entries. If you already have a "raw" Http `request` object you can assign it to `entry.metadata.httpRequest` directly. More information about how the `request` is interpreted as raw can be found in the [code](https://github.com/googleapis/nodejs-logging/blob/15849160116a814ab71113138cb211c2e0c2d4b4/src/entry.ts#L224-L238). -## Automatic Trace/Span Id Extraction -Cloud Logging libraries use [trace fields within LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace) to capture trace contexts, which enables the [correlation of logs and traces](https://cloud.google.com/logging/docs/view/correlate-logs), and supporting distributed tracing. -These trace fields, including [trace](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace), [spanId](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.span_id), and [traceSampled](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace_sampled) define the trace context for the log entry. +## Automatic trace/span Id extraction +Cloud Logging libraries use [trace fields within LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace) to capture trace contexts, which enables the [correlation of logs and traces](https://cloud.google.com/logging/docs/view/correlate-logs), and distributed tracing troubleshooting. +These tracing fields including [trace](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace), [spanId](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.span_id), and [traceSampled](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.trace_sampled) define the trace context for a `LogEntry`. -If not provided explicitly, Google Cloud Logging library will automatically populate `LogEntry fields`_ -`trace`, `span_id`, and `trace_sampled` from detected OpenTelemetry span context, or HTTP request headers. +If not provided explicitly in a LogEntry, Google Cloud Logging library will automatically populate `trace`, `span_id`, and `trace_sampled` fields from detected OpenTelemetry span contexts, or HTTP request headers. -### Extracting from OpenTelemetry Context +### Extracting trace/span Id from OpenTelemetry Context If you are using OpenTelemetry and there is an active span in the OpenTelemetry Context, that log entry will automatically have the `trace`, `span_id`, and `trace_sampled` fields populated from that span. More information about OpenTelemetry can be found [here](https://opentelemetry.io/docs/languages/js/). -### Extracting from HTTP headers -If tracing fields are not provided explicitly and no OpenTelemetry context were detected, `trace` / `span_id` fields will be extracted automatically from HTTP headers. -Trace information is automatically populated from either the `[W3C Traceparent](https://www.w3.org/TR/trace-context)` or `[X-Cloud-Trace-Context](https://cloud.google.com/trace/docs/trace-context#legacy-http-header)` headers. -Populating trace information this way also automatically populates the `http_request` field in the `LogEntry` as well. +### Extracting trace/span Id from HTTP headers +If tracing fields are not provided explicitly and no OpenTelemetry context is detected, `trace` / `span_id` fields will be extracted automatically from HTTP headers. +Trace information can be automatically populated from either the [W3C Traceparent](https://www.w3.org/TR/trace-context) or [X-Cloud-Trace-Context](https://cloud.google.com/trace/docs/trace-context#legacy-http-header) headers. ## Error handling with logs written or deleted asynchronously