googleapis / nodejs-logging-bunyan

Node.js client integration between Stackdriver Logging and Bunyan.
https://cloud.google.com/logging/
Apache License 2.0
63 stars 34 forks source link

Allow defining labels in LoggingBunyan options #607

Closed galaxyfeeder closed 10 months ago

galaxyfeeder commented 2 years ago

For us would be very useful to be able to set labels for a LoggingBunyan instance.

Is your feature request related to a problem? Please describe. Filtering logs in the same GCP project with custom requirements.

Describe the solution you'd like Being able to pass to the options of LoggingBunyan the labels for the instance that will be merged with the log labels and sent with each LogEntry, and only pass that information to GCP, like the serviceContext or the resource.

Describe alternatives you've considered

  1. Sending resource.labels, however you can only send predefined labels and not custom labels.
  2. Sending on each log message the labels as they get checked and passed if all of them are key-value strings, however that would mean that a) are sent to all other streams and not only to GCP and b) that we need to modify all our code to include a new label.

    Additional context Nope :)

cindy-peng commented 10 months ago

Hi @galaxyfeeder , I am not sure if I fully understand the request. Do you mean you want to pass customized labels only to Google cloud logging but not other Bunyan streams? Maybe an example will help here?

cindy-peng commented 10 months ago

Hi, I am closing issues for now as more details are needed for further investigations. If you are still running into this, feel free to reopen the issue and provide more details. Thank you!