datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

proposal: DD_APM_ANALYZED_SPANS env var is a clunky way to enable analyzing spans

Open leoyu037 opened this issue 8 years ago • 28 comments

Summary of conversation with Kirk Kaiser in the #apm Slack channel:

I think using an env var to enable collection of analyzed spans like below is a little clunky. In a microservices ecosystem deployed to a Kubernetes cluster, I’d have to update the agent daemonset configuration every time a new span/service is added to the ecosystem. It’d be nice if there were an option to enable/disable analysis of all spans like DD_APM_ANALYZE_SPANS=true/false. This could maybe be coupled with DD_APM_SPAN_WHITELIST and DD_APM_SPAN_BLACKLIST for more control.

leoyu037 avatar Oct 05 '18 18:10 leoyu037

Hi Leo,

Indeed we have gathered feedback that this is unpractical and we are working on a simpler way to flag spans to be analyzed. We are moving towards configuring the spans to be analyzed in the code instrumentation. Would it address your issue?

Bertrand

bmermet avatar Oct 09 '18 08:10 bmermet

I'm unclear about how you intend to allow configuring analyzable spans in code if this is an agent parameter. Can you give an example of your proposal?

But any solution that doesn't require me to manually specify the spans to analyze in the agent configuration should work. I think it would be a little clunky to have to manually turn on analyzing for auto-instrumented spans though (e.g. the koa.request span).

leoyu037 avatar Oct 09 '18 14:10 leoyu037

Indeed this would involve an agent change too. Basically the instrumentation would annotate spans of interest to be indexed in Trace Search & Analytics and the agent would forward those appropriately. The feature is not completely designed yet but internally the behavior would be similar to doing:

span.SetTag("_dd.analyzed_span", 1)

We would also update auto-instrumentation to automatically analyze web spans.

Is this more clear?

bmermet avatar Oct 09 '18 15:10 bmermet

Okay, that makes sense. I think that would work well, as long as the auto-instrumented spans were automatically analyzed too.

leoyu037 avatar Oct 09 '18 15:10 leoyu037

Sounds good then. Thank you for the feedback. We'll let you know when the new configuration is available.

bmermet avatar Oct 09 '18 15:10 bmermet

Any update on this?

willyyang avatar Nov 13 '18 21:11 willyyang

Something might be coming in the next release, hopefully next week in 6.7.0. Hang tight.

gbbr avatar Nov 14 '18 08:11 gbbr

I still trying to understand how this mechanism even works, just so I can get basic APM working. The documentation is extensive, but not at all helpful in understanding at a larger scale. I expect that this "clucky mechanism" is making it all the harder for me to learn as well, but I don't know what I don't know (read this at least 20 times now): https://docs.datadoghq.com/tracing/setup/docker/?tab=nodejs

I know this feedback is only slightly relevant to this specific issue, but I think it is and I'm hoping you guys will forgive the intrusion and can perhaps help me understand what this variable even does. So far the only thing I see in APM are what appear to be outgoing HTTP communications, not my clients inbound (the routes my app serves).

It would appear this env var is how I'm supposed to "Configure the spans to analyze for transactions", but what does that even mean? I want all my client traffic by default and I'd happily take my server traffic in there also. New Relic made this dead simple at all levels. Here I'm not sure if I'm even sending the right metrics. I'm using Docker, Node.js & Hapi 16 so I can't depend on the "automatic" plugin for my actual app and this env var makes me think that even if I was on Hapi 17 (which is months away), I'd still not understand of have things working. I've also read the following over and over, but it's more of a marketing article that actual support/help: https://www.datadoghq.com/blog/node-monitoring-apm/

Can someone close the loop by clarifying what exactly this env var even does or if it's even required (which isn't clear for the same reasons).

rainabba avatar Nov 19 '18 17:11 rainabba

@rainabba DD_APM_ANALYZED_SPANS enables the Trace and Analytics section under APM menu , where you can search for traces using facets https://app.datadoghq.com/apm/search. In other words Spans are analyzed to make them searchable. It is not required to start collecting traces but is highly useful going forward.

Setting this value to "some-service|express.request=1" would enable analytics for the service "some-service" and would analyse the node express requests.

davideagle avatar Nov 19 '18 17:11 davideagle

that brief explanation did more for me than two weeks of cycling round and round through the documentation so thank you very much.

Is it accurate to say then that all the traces are sent out based on that pattern, or is it the only those traces are exposed in the APM UI but all traces are sent in regardless.

Also, can you tell me if there are any basic HTTP or https spans that will exist in my current context, or will I have to provide all of them manually since I'm not on Hapi 17?

Either way, how do I go about deciding what spans should be exposed (at this point) in order for me to be able to trace all my requests as I see in the documentation?

Is datadog support the best place for me to be asking these questions or would you like to direct me to somewhere else where I'm not spamming up this issue? :) TIA

rainabba avatar Nov 19 '18 17:11 rainabba

@rainabba I'd suggest going through support since, I too am just starting out with APM so I don't want to feed you some misinformation unknowingly. The tracing I'm doing currently is with auto instrumentation of Java projects, and the span type is servlet.request there.

When you go to APM->Services->[Service] and click one of the resources that appear on the bottom of the page. You can see a bread crumb at the top of the page similar to "Services > user-repository > servlet.request", the last part I figured out is the span type, which you then can use for the ENV DD_APM_ANALYZED_SPANS="service|servlet.request=1"

Hope this helps

davideagle avatar Nov 19 '18 17:11 davideagle

@rainabba I think you should check out https://github.com/DataDog/dd-trace-js + the issues to get a feel for tracing in Node. It helped me a lot and I felt the maintainers were able to answer my questions much better than the support engineers.

Started last month with nothing and now I have traces set up connecting various micro services in diff. languages running on k8s.

willyyang avatar Nov 19 '18 18:11 willyyang

@willyyang Thank you. I am, but its use still assumes an understanding of how tracing "should" be implemented and how it relates to the APM, services, routes, etc... I've already forked ( internally ) https://github.com/Josiah/hapi-datadog to get an idea, but compared to what I expect to see from the screen-shots in the docs, this is still far lower-level than needed. It also implies that I "need" to do more than just modify the DD_APM_ANALYSED_SPAN parm, but I still only see "client" requests (outgoing from my server) and not "server" requests (those inbound to my server, which is what I'm really interested in).

@davideagle I see what you mean now. Mine is http.request and now I see the pattern, but it seems that all so far has led me to "myServiceName|http.request=1" which only results in my "client" requests getting logged. I'm going to test more with my forked hapi-datadog code and see if I can get my requests in manually, but so far I can't get a valid scope reference so I can't even finish/close a span. It looks like it's meant to implement a singleton pattern of sorts, but I'm apparently going to have to dig into those projects just to figure out how to get a basic node.js implementation which makes this all feel quite wanting right now :/

Meanwhile, my containers, hosts and IIS app are all working fine and I can't get logging to work anywhere at all. I just might understand the potential and basics enough to begin to form a decent question for support now though :)

"Learning curve. Felt more like like a hard left to me."

rainabba avatar Nov 20 '18 00:11 rainabba

Hi everyone,

We are aware of the confusion around Trace Search & Analytics and how to configure it (result of a feature still heavily in development / not fully refined yet). @rainabba thanks a lot for your detailed comments and feedbacks, it will help us review and improve our documentation on that section.

Also, next month we will release a new preferred configuration method, driven by code instrumentation. Similar to how one can set priority sampling on a span it will be easy to configure the spans to be sent Trace Search. We will also review our common http integrations to set that attribute by default.

Happy to hear what you all think about such option, if that helps you and what else you think of it!

LotharSee avatar Nov 20 '18 10:11 LotharSee

"result of a feature still heavily in development / not fully refined yet"

@LotharSee @gbbr I literally spent months researching alternatives and left NewRelic under the understanding that DataDog was going to provide the same functionality with no exceptional amount of effort. The incredible amount of confusing and colorful docs surrounding APM are what I based my decision on.

That message sounds a lot like you're telling me that months of planning and days of work are for not and this feature isn't ready yet (even though I've been paying for months)?

Perhaps I'm still confused about what does what, but my end goal for dataDog is "tracing" requests, their performance and that of the stack in each request. Is that NOT what APM is for, is it not ready for Node.js, Docker, or something else?

Thanks for the quick engagement.

rainabba avatar Nov 20 '18 15:11 rainabba

Thanks for your quick interactions :)

What I meant by "still heavily in development" is that, like most Datadog features, we do have many new improvements coming to Trace Search soon (this simpler configuration being one, but many other cool ones are also on the way :) ). Trace Search & Analytics has been fully ready since its announcement earlier this year and have been used by large users for longer than that.

And what I meant by "not fully refined yet" is that our documentation will get updated and that instrumentation-driven configuration will help user experience.

To keep that Github issue scoped to the original topic: we are going to update our documentation + provide new ways of configuring Trace Search next month. We will then update this thread and see if it addresses the root issue.

For anything else (ways to use the product / what it can do, confusions, Node-specifics), I'd suggest to contact us at [email protected], it will be simpler to follow-up and provide a specific and in-depth answer.

LotharSee avatar Nov 20 '18 16:11 LotharSee

Hi it looks like the 6.7.0 release addresses this issue. Can we get an updated Readme / examples on how to configure DD agent ? thanks.

willyyang avatar Dec 04 '18 14:12 willyyang

Hi @willyyang yes that's a good catch! We are going to release over the next weeks updates to all our tracers to allow you to use such feature.

LotharSee avatar Dec 04 '18 15:12 LotharSee

Any update on this?

willyyang avatar Dec 19 '18 21:12 willyyang

hello?

willyyang avatar Jan 03 '19 15:01 willyyang