Firebase-functions: New structured logger not applying labels

Created on 10 Jun 2020  Â·  5Comments  Â·  Source: firebase/firebase-functions

This is using the new require('firebase-functions').logger in Node 10.

According to the container logs contract we should be able to write labels for a LogEntry by using the special field logging.googleapis.com/labels. However these labels just get applied to the jsonPayload in the Logs Viewer (in GCP).

I've also tried just a plan labels field with no success.

Reproduction

Deploy a function that contains the following and run the function:

const { logger } = require('firebase-functions')

logger.write({
    severity: 'INFO',
    message: 'Should include labels (via labels)',
    labels: {
      label1: 'some value'
    }
})


logger.write({
    severity: 'INFO',
    message: 'Should include labels (via logging.googleapis.com/labels)',
    'logging.googleapis.com/labels': {
      label1: 'some value'
    }
})

Logs Viewer output:
image

I'd expect the jsonPayload[labels] and jsonPayload[logging.googleapis.com/labels] to be included under the labels at the root.

It might be the case its not supported but wanted to check as other special fields from the list (i.e. message, timestamp) are being converted correctly!

functions tracked internally bug

All 5 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

This is a backend issue (internal id: b/146219077) that is currently being looked at. There's nothing specific that we can do in this repo to address it, but I'll leave this open and hopefully remember to come back and ping it when the backend is fixed.

Thanks for the report!

Thanks!

Should we be using labels or logging.googleapis.com/labels so it’ll just work once the bug is fixed?

Use logging.googleapis.com/labels

On Wed, Jun 10, 2020, 10:00 AM Rich Hodgkins notifications@github.com
wrote:

Thanks!

Should we be using labels or logging.googleapis.com/labels so it’ll just
work once the bug is fixed?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-functions/issues/703#issuecomment-642137900,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAAH7T3553KCRFNA5QJXD3RV633FANCNFSM4N2I3IEA
.

@mbleigh its been a few months so I thought I'd check in and see if its been fixed? Thanks in advance

Was this page helpful?
0 / 5 - 0 ratings

Related issues

h36ahmed picture h36ahmed  Â·  5Comments

ArbestNew picture ArbestNew  Â·  5Comments

soichisumi picture soichisumi  Â·  6Comments

joshdifabio picture joshdifabio  Â·  5Comments

TomClarkson picture TomClarkson  Â·  5Comments