Make it possible to create error logs that are picked up by GCP Error Reporting
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- google-cloud, nodejs, typescript
- Domain
- backend, cloud, observability
Research direction
Start by locating the special message-key handling in @google-cloud/logging-winston and its tests. Verify how stack_trace and @type are currently placed, then add coverage showing that the supported Error Reporting fields remain in the expected top-level log entry and are recognized by the relevant formatting behavior.
Written by the indexing model from the issue text.
Description
Library Name
@google-cloud/logging-winston
A screenshot that you have tested with "Try this API".
does not apply
What would you like to see in the library?
Context
We're running a NodeJS application in GCP and wish to have logs with severity/level 'ERROR' show up in GCP's Error Reporting service.
We are currently using the @google-cloud/logging-winston library to write log messages (as recommended by GCP). However, we are finding that this library prevents us to write log messages in the format that the Error Reporting service expects.
According to the Error Reporting service's documentation, a log entry would be picked up when one these are true:
- the log entry's message contains a stack trace
- the log entry contains certain specific fields (
stack_traceorexception, or a specific@typevalue
Although 1 is possible, it will include a stack trace inside a plain text message field, which clutters up the logging quite a bit. This makes querying and organizing logs unnecessarily harder.
Using method 2 would be a huge improvement, however the @google-cloud/logging-winston library prevents us from doing that. When we try to add a stack_trace, exception of @type field, it gets moved in a metadata object instead, causing the Error Reporting service to ignore the log entry.
Proposal
The @google-cloud/logging-winston already defines certain special message keys which are not put into the metadata object (fields like logging.googleapis.com/trace, level etc.). I propose we add stack_trace and @type to that list as well, allowing us to properly format a log entry to be picked up by the Error Reporting service.
As an alternative, we could also introduce a new option field in @google-cloud/logging-winston which explicitly enables formatting a log entry to be picked up by the error reporter (something like 'formatForErrorReporting:true`?).
No response
Describe alternatives you've considered
No response
Additional context/notes
No response
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 714
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 106
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-cloud-node
-
priority: p1 samples type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
googleapis/google-cloud-node#9367 ·
-
bug(gapic-node-processing): setOnlyDefaultSystemTests incorrectly matches substring on absolute path Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
googleapis/google-cloud-node#9342 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
googleapis/google-cloud-node#9193 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
googleapis/google-cloud-node#9155 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
googleapis/google-cloud-node#9117 ·
All issues in googleapis/google-cloud-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·