Skip to content

New structured logger not applying labels #703

Closed
@rhodgkins

Description

@rhodgkins

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions