Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New structured logger not applying labels #703

Closed
rhodgkins opened this issue Jun 10, 2020 · 12 comments
Closed

New structured logger not applying labels #703

rhodgkins opened this issue Jun 10, 2020 · 12 comments
Labels
api: functions tracked internally Issues that are tracked internally, even though the issue is closed type: bug

Comments

@rhodgkins
Copy link
Contributor

rhodgkins commented Jun 10, 2020

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!

@google-oss-bot
Copy link
Collaborator

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

@mbleigh mbleigh added api: functions tracked internally Issues that are tracked internally, even though the issue is closed type: bug and removed needs-triage labels Jun 10, 2020
@mbleigh
Copy link
Contributor

mbleigh commented Jun 10, 2020

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!

@rhodgkins
Copy link
Contributor Author

Thanks!

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

@mbleigh
Copy link
Contributor

mbleigh commented Jun 10, 2020 via email

@rhodgkins
Copy link
Contributor Author

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

@rhodgkins
Copy link
Contributor Author

@mbleigh went to check on this and with the original above code logging.googleapis.com/labels are now completely dropped...

image

@voxmaster
Copy link

Same issue with

Cross all languages and any Structured Logs

@rhodgkins
Copy link
Contributor Author

Same issue with

Cross all languages and any Structured Logs

I haven't tried Cloud Functions (but Firebase functions are built on top of these so I imagine its the same as this issue), but labels are showing for me with Cloud Run when using the logging.googleapis.com/labels key.

@taeold
Copy link
Contributor

taeold commented Mar 17, 2021

2021 update: Cloud Functions backend is working on a fix to this issue. I will come back in another week to provide an update.

@taeold
Copy link
Contributor

taeold commented Mar 30, 2021

I'm reading from internal tracking bug that the fix should land in a week or so. Will provide another update in a few weeks.

@taeold
Copy link
Contributor

taeold commented Apr 8, 2021

Personally I'm seeing the log labels being correctly applied in Cloud Monitoring. The rollout is only ~90% done, but you may also start to see the label being applied correctly. Rollout should be fully completed in the next couple of days.

@rhodgkins
Copy link
Contributor Author

Yep all working for me now too thanks @taeold

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: functions tracked internally Issues that are tracked internally, even though the issue is closed type: bug
Projects
None yet
Development

No branches or pull requests

5 participants