We have an implementation of NodeJS APM agent running in our Firebase server-less functions along with custom spans in some of the transactions. After trying to compare logs on the APM console with application logs we found out that the APM agent is missing some requests entirely and are not being logged onto the server. We have failed to find any co-relation of request type/time between the missing requests. Upon further investigation I started returning the object apm.transaction in request responses and found out that the requests which fail to be logged have the following JSON.stringify value:
Thanks for writing and reporting the behavior @Abhiraj_Kulaar.
If I'm reading what you said correctly -- it sounds like you have some Google Cloud Serverless Functions running in combination with your Google Firebase applications (as outlined here: Cloud Functions for Firebase | Firebase Documentation), and APM data is not consistently coming though.
Unfortunately, the Elastic APM Node.js agent doesn't officially support Google Cloud Serverless Functions. Due to the unique execution environment of Cloud Functions it's not always possible to get data out of the function after it finishes executing. The sampling you're seeing isn't a result of agent sampling behavior, it's a result of how cloud functions run in Google's production environment.
We'll make a note of this as a feature request for Google Cloud Functions. Also, if you happen to find a way to get it working please do share with the community.
Hey @Abhiraj_Kulaar -- one additional thing: The reason you're seeing sampled:false on those transactions -- sometimes Google's infrastructure can add a Traceparent header to the request before it reaches your service, indicating that server should be sampled. You [can read a bit more about this behavior in the following thead]Traceparent header from outside Elastic · Issue #286 · elastic/apm · GitHub).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.