Giter VIP home page Giter VIP logo

Comments (7)

adamnathanlewis avatar adamnathanlewis commented on August 16, 2024

Yeah been trying to set this up using NODE_OPTIONS but can't get it working. @taeold Really excited about this but would love your input! 🙏

from functions-samples.

adamnathanlewis avatar adamnathanlewis commented on August 16, 2024

By the way @dan-wu-open I think you might be able to get what you're looking for by setting an environment variable called NODE_OPTIONS to --require "./tracing.js". You can set this with an env file or as part of your CI/CD or manually on the function within the google cloud console. That said, it isn't working for me! Worth giving it a try though

https://console.cloud.google.com/functions/list
Select your function
Edit
Expand Runtime, build, connections and security settings

image

Give it a try 😄

from functions-samples.

kaczors avatar kaczors commented on August 16, 2024

I am struggling with setting this up in TypeScript, somehow my custom spans are not visible.
One general remark useful while testing: by default Cloud Run will trace 0.1 request per second per container (https://cloud.google.com/run/docs/trace#trace_sampling_rate). When I was invoking my callable from Angular app the OPTIONS preflight request was draining this quota and real request were not traced (there is nice property in logs traceSampled: true saying if given request was sampled or not)

from functions-samples.

taeold avatar taeold commented on August 16, 2024

Whoops my mistake. Thanks for calling it out @dan-wu-open and @adamaffinitech. Fix incoming at #1022

from functions-samples.

taeold avatar taeold commented on August 16, 2024

@kaczors Thanks for sharing your problem.

It's a real bummer that we don't get to configure the Cloud Run sampling rate :(.

I believe Open Telemetry allows you to configure a sampler that can override the 0.1 sampling rate of Cloud Run. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#built-in-samplers.

Unfortunately, this would mean that you won't have the overarching request span generated by the Cloud Run's load balancer, but you'd at least be getting spans generated by your application.

I will take a closer look and see if I can write some sample code this weekend. If you are willing to share your work, I think the community will appreciate it!

from functions-samples.

georgecartridge avatar georgecartridge commented on August 16, 2024

@kaczors Thanks for sharing your problem.

It's a real bummer that we don't get to configure the Cloud Run sampling rate :(.

I believe Open Telemetry allows you to configure a sampler that can override the 0.1 sampling rate of Cloud Run. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#built-in-samplers.

Unfortunately, this would mean that you won't have the overarching request span generated by the Cloud Run's load balancer, but you'd at least be getting spans generated by your application.

I will take a closer look and see if I can write some sample code this weekend. If you are willing to share your work, I think the community will appreciate it!

Do you happen to have any working code around this?

I'm using v2 callable functions but only the OPTIONS pre-flight CORS request is getting its trace sampled. The actual onCall function invocation gets a traceId and spanId, but I think due to the sampling rate of Cloud Run, it's not then getting sampled and showing up in the trace explorer.

from functions-samples.

kaczors avatar kaczors commented on August 16, 2024

@kaczors Thanks for sharing your problem.
It's a real bummer that we don't get to configure the Cloud Run sampling rate :(.
I believe Open Telemetry allows you to configure a sampler that can override the 0.1 sampling rate of Cloud Run. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#built-in-samplers.
Unfortunately, this would mean that you won't have the overarching request span generated by the Cloud Run's load balancer, but you'd at least be getting spans generated by your application.
I will take a closer look and see if I can write some sample code this weekend. If you are willing to share your work, I think the community will appreciate it!

Do you happen to have any working code around this?

I'm using v2 callable functions but only the OPTIONS pre-flight CORS request is getting its trace sampled. The actual onCall function invocation gets a traceId and spanId, but I think due to the sampling rate of Cloud Run, it's not then getting sampled and showing up in the trace explorer.

sorry, I did not found any workaround and not using this solution anymore

from functions-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.