-
Notifications
You must be signed in to change notification settings - Fork 212
Add execution_id to the labels of a manual stackdriver log entry #560
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
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Looks pretty similar to my case, let's hope it gets triaged fast |
Also seeing this. |
I'm also having trouble with this issue. In the meantime, I found a few relevant Stack Overflow threads that contain decent workarounds.
By logging the execution ID this way you can create a filter to see all the logs of the same function on the Stackdriver Logging console. Unfortunately, I don't believe it would work natively on the Firebase Functions console. |
Is it possible to get an update / workaround for this? It's almost been open for 6 months now without any triaging from the Firebase team... |
Hey guys can you look at this from home? 🤓 |
We apologize for the delay - I know the CF team is aware of the issue, but don't have plans to fix this in the near future. Do you mind submitting a customer support issue to Cloud Functions directly to get help with a workaround? https://cloud.google.com/support/docs/issue-trackers#feature_requests thanks! |
@rhodgkins Did you find a solution?
It's way harder to have a non-global execution-id that you have to pass around. Since the behavior can be: For the same container being reused: Execution1 runs and logs: grab execution-id it and set the global |
@Elyx0 Interesting, I've always thought that function executions run in sequence on a given container, regardless of if they are "awaiting" or not. In your scenario, I would expect Execution2 to cause a new instance to spin up, rather than running on the same container as Execution1. Only when Execution1 completely finishes would I expect an additional execution to run on that instance. Could you point me towards a resource that explains otherwise? For what it's worth, @CodingDoug says here that, for a single instance, events are processed in serial. I'm admittedly not sure that means what I think it means though. |
@Elyx0 I'm currently using the eventId from a PubSub message as that corresponds to the execution_id. Can’t set the correct label in the logs though so I have a filter that looks for both. Neither of these are ideal solutions at all. I’d expect this to work out the box but it seems development on Firebase Functions has stalled somewhat (if you also look at the fact that Node 10 support is still in beta despite LTSing 6 months ago. Also it seems a lot of @Google-Cloud NPM packages are now dropping Node 8 support...)! |
@scottypickering You were right: https://cloud.google.com/functions/docs/concepts/exec#auto-scaling_and_concurrency so I guess it's safe to alter from a global for now |
@rhodgkins Did you ever hit Exception from a finished function: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information. when trying to log from @Google-Cloud logging? I'm having it intermittently |
This is much better (I'd go as far as to say fixed from at least my use of it!) from |
I separately confirmed that |
Related issues
This is similar but not the same I don't think #554
[REQUIRED] Version info
node: v8.16
firebase-functions: 3.2.0
firebase-tools: 7.3.2
firebase-admin: 8.3.0
@google-cloud/logging: 5.3.1
@google-cloud/error-reporting: 1.1.1
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
I follow the setup info from here: https://firebase.google.com/docs/functions/reporting-errors#sending_to_stackdriver
Put the above code in a function (returning
log.write(...)
).[REQUIRED] Expected behavior
In the Functions Logs page I'd expect to be able to have
@google-cloud/logging: Hello
showing under the same execution asconsole.log: Hello
but it does not. Also there is no "..." menu to the far right of that log entry.[REQUIRED] Actual behavior
It seems that the @google-cloud/logging is missing
labels.execution_id
, which a console.log automatically has.Is there anyway to get this? I couldn't find it in an environmental variable, and it isn't the functions event context
eventId
either.console.log: Hello from Stackdriver logging:
@google-cloud/logging: Hello from Stackdriver logging:
Were you able to successfully deploy your functions?
Yes
The text was updated successfully, but these errors were encountered: