From 555c33e858248b911a5aa405d11f64a2fb5942dd Mon Sep 17 00:00:00 2001 From: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:28:15 -0800 Subject: [PATCH] fix: Fix rest links with the correct gRPC links used by library. (#724) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Fix incorrect rest links with gRPC * Update readme-partials.yml * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: cindy-peng <cindypeng@google.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> --- .readme-partials.yml | 10 +++++----- README.md | 10 +++++----- src/index.ts | 5 +++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.readme-partials.yml b/.readme-partials.yml index cc3876d5..ab948606 100644 --- a/.readme-partials.yml +++ b/.readme-partials.yml @@ -61,7 +61,7 @@ body: |- ### Error Reporting - Any `Error` objects you log at severity `error` or higher can automatically be picked up by [Cloud Error Reporting][error-reporting] if you have specified a `serviceContext.service` when instantiating a `LoggingBunyan` instance: + Any `Error` objects you log at severity `error` or higher can automatically be picked up by [Cloud Error Reporting](https://cloud.google.com/error-reporting/) if you have specified a `serviceContext.service` when instantiating a `LoggingBunyan` instance: ```javascript const loggingBunyan = new LoggingBunyan({ @@ -76,14 +76,14 @@ body: |- It is an error to specify a `serviceContext` but not specify `serviceContext.service`. - Make sure to add logs to your [uncaught exception][uncaught] and [unhandled rejection][unhandled] handlers if you want to see those errors too. + Make sure to add logs to your [uncaught exception](https://nodejs.org/api/process.html#process_event_uncaughtexception) and [unhandled rejection](https://nodejs.org/api/process.html#process_event_unhandledrejection) handlers if you want to see those errors too. You may also want to see the [@google-cloud/error-reporting][@google-cloud/error-reporting] module which provides direct access to the Error Reporting API. ### LogEntry Labels If the bunyan log record contains a label property where all the values are strings, we automatically promote that - property to be the [`LogEntry.labels`](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) value rather + property to be the [`LogEntry.labels`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.v2#logentry) value rather than being one of the properties in the `payload` fields. This makes it easier to filter the logs in the UI using the labels. ```javascript @@ -94,7 +94,7 @@ body: |- ### Formatting Request Logs - To format your request logs you can provide a `httpRequest` property on the bunyan metadata you provide along with the log message. We will treat this as the [`HttpRequest`][http-request-message] message and Cloud logging will show this as a request log. Example: + To format your request logs you can provide a `httpRequest` property on the bunyan metadata you provide along with the log message. We will treat this as the [`HttpRequest`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.type#google.logging.type.HttpRequest) message and Cloud logging will show this as a request log. Example:  @@ -110,7 +110,7 @@ body: |- }, req.path); ``` - The `httpRequest` property must be a properly formatted [`HttpRequest`][http-request-message] message. (Note: the linked protobuf documentation shows `snake_case` property names, but in JavaScript one needs to provide property names in `camelCase`.) + The `httpRequest` property must be a properly formatted [`HttpRequest`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.type#google.logging.type.HttpRequest) message. (Note: the linked protobuf documentation shows `snake_case` property names, but in JavaScript one needs to provide property names in `camelCase`.) ### Correlating Logs with Traces diff --git a/README.md b/README.md index 7e9ebda7..1cb66799 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ startServer(); ### Error Reporting -Any `Error` objects you log at severity `error` or higher can automatically be picked up by [Cloud Error Reporting][error-reporting] if you have specified a `serviceContext.service` when instantiating a `LoggingBunyan` instance: +Any `Error` objects you log at severity `error` or higher can automatically be picked up by [Cloud Error Reporting](https://cloud.google.com/error-reporting/) if you have specified a `serviceContext.service` when instantiating a `LoggingBunyan` instance: ```javascript const loggingBunyan = new LoggingBunyan({ @@ -158,14 +158,14 @@ const loggingBunyan = new LoggingBunyan({ It is an error to specify a `serviceContext` but not specify `serviceContext.service`. -Make sure to add logs to your [uncaught exception][uncaught] and [unhandled rejection][unhandled] handlers if you want to see those errors too. +Make sure to add logs to your [uncaught exception](https://nodejs.org/api/process.html#process_event_uncaughtexception) and [unhandled rejection](https://nodejs.org/api/process.html#process_event_unhandledrejection) handlers if you want to see those errors too. You may also want to see the [@google-cloud/error-reporting][@google-cloud/error-reporting] module which provides direct access to the Error Reporting API. ### LogEntry Labels If the bunyan log record contains a label property where all the values are strings, we automatically promote that -property to be the [`LogEntry.labels`](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) value rather +property to be the [`LogEntry.labels`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.v2#logentry) value rather than being one of the properties in the `payload` fields. This makes it easier to filter the logs in the UI using the labels. ```javascript @@ -176,7 +176,7 @@ All the label values must be strings for this automatic promotion to work. Other ### Formatting Request Logs -To format your request logs you can provide a `httpRequest` property on the bunyan metadata you provide along with the log message. We will treat this as the [`HttpRequest`][http-request-message] message and Cloud logging will show this as a request log. Example: +To format your request logs you can provide a `httpRequest` property on the bunyan metadata you provide along with the log message. We will treat this as the [`HttpRequest`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.type#google.logging.type.HttpRequest) message and Cloud logging will show this as a request log. Example:  @@ -192,7 +192,7 @@ logger.info({ }, req.path); ``` -The `httpRequest` property must be a properly formatted [`HttpRequest`][http-request-message] message. (Note: the linked protobuf documentation shows `snake_case` property names, but in JavaScript one needs to provide property names in `camelCase`.) +The `httpRequest` property must be a properly formatted [`HttpRequest`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.type#google.logging.type.HttpRequest) message. (Note: the linked protobuf documentation shows `snake_case` property names, but in JavaScript one needs to provide property names in `camelCase`.) ### Correlating Logs with Traces diff --git a/src/index.ts b/src/index.ts index 134b933c..d8e88314 100644 --- a/src/index.ts +++ b/src/index.ts @@ -114,7 +114,8 @@ export function getCurrentTraceFromAgent() { * automatically, but you may optionally specify a specific monitored * resource. For more information, see the * [official documentation]{@link - * https://cloud.google.com/logging/docs/api/reference/rest/v2/MonitoredResource} + * https://cloud.google.com/monitoring/api/ref_v3/rpc/google.api#google.api.MonitoredResource} + * * @param {object} [options.serviceContext] For logged errors, we provide this * as the service context. For more information see * [this guide]{@link @@ -283,7 +284,7 @@ export class LoggingBunyan extends Writable { // If the record contains a httpRequest property, provide it on the entry // metadata. This allows Stackdriver to use request log formatting. - // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#HttpRequest + // https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.type#google.logging.type.HttpRequest // Note that the httpRequest field must properly validate as a HttpRequest // proto message, or the log entry would be rejected by the API. We do no // validation here.