Skip to content

Commit

Permalink
fix: Fix rest links with the correct gRPC links used by library. (#724)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent a79452b commit 555c33e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .readme-partials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
Expand All @@ -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:
![Request Log Example](https://raw.githubusercontent.com/googleapis/nodejs-logging-bunyan/master/doc/images/request-log.png)
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
Expand All @@ -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:

![Request Log Example](https://raw.githubusercontent.com/googleapis/nodejs-logging-bunyan/master/doc/images/request-log.png)

Expand All @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 555c33e

Please sign in to comment.