-
Notifications
You must be signed in to change notification settings - Fork 98
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
[Tracking Issue] Auto-tracing not working in Google Cloud Functions/Firebase Cloud Functions #725
Comments
We don't expect tracing to work out of the box for Firebase Cloud Functions (or GCF) at the moment (I'll make sure that gets documented from here on out). The error message points out that You could try the workaround of wrapping the function contents in const traceApi = require('@google-cloud/trace-agent').start();
traceApi.runInRootSpan({ name: 'my-root-span' }, (rootSpan) => {
// ...
rootSpan.endSpan();
}); You might consider using Given how background trace publishing operations may not be supported by Cloud Function's CPU throttling model, it might be useful to publish traces as soon as they're created (by specifying that at most one trace should be buffered at a time): const traceApi = require('@google-cloud/trace-agent').start({ bufferSize: 1 }); Please let us know if there are any issues that arise! |
@SamyPesse If you don't mind, I am going to use this as a tracking issue for the progress of getting the Trace Agent to work with GCF. |
@kjin sure 👍 we made it works in our Firebase cloud functions, but without auto-tracing. The lack of auto-tracing seems to come from the code added by Firebase that requires the modules like |
@SamyPesse Thanks for the update! We've been working with the GCF team (which I believe also maintains the Firebase Cloud Functions, or at least the functionality should be similar anyway) but I don't think we can support it yet within the next two months or so. Will give updates as I hear about them. |
Hi (I am a Product Manager on Google Cloud). As others said, in the meantime, you should be able to import the trace module, but not everything will be traced as it is not the first module imported. |
I'm having trouble getting the suggested workaround to work. My code looks as follows
As suggested, all code runs in the rootSpan, and the bufferSize is set to 1. I still get the error
I've signed up for the Alpha (thanks steren!), but I have many Firebase projects that need proper tracing, so any workaround that would help right now would be useful. Thanks! |
Hi @shaneosullivan -- are you still getting traces reported? The error message being shown here is likely a false alarm, as the condition for its appearance is simply that modules were loaded before the Trace Agent (which is true by nature of the workaround); it's just a blanket "warning" that suggests a possible reason why traces might not get published, if they are not. |
@kjin I am getting traces, but only the root traces for some reason. I've wrapped each GraphQL resolver with
but these traces do not show up anywhere. I was hoping the |
@shaneosullivan Could you provide more code around the call to Also, do you have warnings turned on? If you set in the config passed to |
The Cloud Functions / Firebase Functions team are working on proper support for this feature. I'm going to close this issue out over here as this is not an issue in this repo. Please do add a comment here if you this this is incorrect. |
This can now be tracked on the GCF issue tracker here: https://issuetracker.google.com/124761993 |
I didn't see any pg-query RPCs spans within background cloud function. Is this the reason? |
Any advancements? I'm not sure if it's locking me on googleapis/nodejs-logging#591 |
Hey @Elyx0, I saw that you also posted on https://issuetracker.google.com/124761993 -- you should treat that as the source of truth. Thanks! |
@ofrobots any way to get an ETA? H1? H2? |
When using
@google-cloud/trace-agent
in Firebase Cloud Functions, the custom tracing works, but auto tracing doesn't (no trace for HTTP/HTTPS/gRPC requests).Even included as the first module, the cloud functions log output:
It may related to how Firebase Cloud Functions works as an overlay of Google Cloud Functions.
The text was updated successfully, but these errors were encountered: