googleapis / nodejs-spanner

Node.js client for Google Cloud Spanner: the world’s first fully managed relational database service to offer both strong consistency and horizontal scalability.
https://cloud.google.com/spanner/
Apache License 2.0
135 stars 100 forks source link

observability: implement trace wrapping, alternative to manual tracing #2109

Open odeke-em opened 6 days ago

odeke-em commented 6 days ago

This change implements trace wrapping by intercepting the Object.prototype method and starting a span right before invoking the original method, then an appropriate pass-through replacement object.

Trace-Wrapping is an alternative to the manual tracing in PR #2087 but then a precursor to use later on using the opentelemetry-instrumentation framework for which we shall be able to extract out this code.

Despite being an alternative to manual tracing, in some cases where perhaps it might be convenient and time saving to use manual tracing, these two methods can live side by side.

Updates #2079

Trace exhibits

Screenshot 2024-09-13 at 6 32 56 PM Screenshot 2024-09-13 at 6 34 00 PM Screenshot 2024-09-13 at 6 33 39 PM
odeke-em commented 5 days ago

Trace exhibits

Screenshot 2024-09-13 at 6 32 56 PM Screenshot 2024-09-13 at 6 34 00 PM Screenshot 2024-09-13 at 6 33 39 PM