-
Notifications
You must be signed in to change notification settings - Fork 35
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
CustomTraceExtractor does not work as expected #500
Comments
Hey @MartinLoeper, My first question is, it seems that #501 and #502 might be duplicates of this issue, is this correct, or am I missing something? If they are, I will close them in favor of #500 (here). Now, on
Is there a problem on using the out-of-the-box trace propagation? Lambda -> EventBridge -> Lambda should work without any custom extraction.
This shouldn't affect any of the process, so it's safe to ignore, since it's mainly for internal purposes. Are you using a specific |
Apologies for opening multiple issues. There was a network error and I hit page reload twice.
Since we are using lambda destinations, the datadog context is not propagated automatically. Thus, I attached it to the I am using 4.29.0 as per pnpm-lock.yaml. Thanks for looking into this @duncanista! |
Hi @MartinLoeper, I ran into similar behavior before. And in my case, there were two tracers running and causing such overrides. To be more specific, there's already a |
Thanks for the hint @joeyzhao2018! I had to remove the dd-tracer from my dependencies and update the datadog-lambda-js layer version to latest to make it work. Is it possible to access the built-in tracer and to add some tags to the root span? |
Nice catch @joeyzhao2018!
Yes, here is a docs example of how to add tags to the current span. |
That's a good point! I ran into this issue in the first place because I wanted to tag the spans and the example you referenced suggests the following: const tracer = require('dd-trace'); Does that mean I have to import a second tracing library to tag the spans? |
Not at all, this layer comes packaged with a version of |
I see. Since |
I'm sorry this is inconvenient to work with @MartinLoeper, I'll will look forward to fix this issue. Since you are using esbuild, I'd overall recommend marking it as an external module as you did! Here are some docs about it: https://docs.datadoghq.com/serverless/guide/serverless_tracing_and_bundlers/ (although we don't have an example for the Sometimes, native modules might need to be marked as external, you can read more in the docs of |
Hi @MartinLoeper - chiming in here as we've also noticed some issues using CDK. CDK does not honor the ESBuild API design which supports ESBuild plugins; a feature supported and designed by ESBuild for this purpose and something we rely on for instrumentation to function, as noted above. There are multiple issues documenting this in both projects: Right now we recommend marking dependencies as But as this is no longer an issue with this library and we've diverged significantly from the original topic, I'm going to close this issue. Feel free to open a new issue or reach out to support directly with any questions. Thanks again! |
Thanks for the clarification guys. Happy this works now! |
Expected Behavior
I am trying to do custom trace propagation in the following scenario: AWS Lambda -> Event Bridge -> AWS Lambda
The trace of the second lambda function should have the same trace id as the first lambda and the aws.lambda span of the first lambda should be the parent of the seconds aws.lambda span.
Actual Behavior
The datadog-lambda-js picks up the
_datadog
attribute which is sent to the second lambda as event payload:It also says:
However, the next log says it sets another traceId:
The following logs confirms it:
Why isn't the traceId which was obtained by traceExtractor used by the dd-trace library?
I configured the extractor as follows:
Is
event
the proper source mode in my scenario? It is hard to find any documentation on this. It looks like dd-trace just ignores the tracingContext obtained like this.Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: