-
Notifications
You must be signed in to change notification settings - Fork 31
internal/api: submit service default rates in /v0.4 endpoint #546
Conversation
@palazzem this requires changes in tracers to fix the problem. Tracers need to be updated such that when no env. setting is found in tags, they will use this value to find the rate key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pushes complexity in all tracers for a simple fix in the agent: send the default rate in service:my-service,env:
.
That could be one solution but would involve sending duplicates for each service. Not sure if better. Seems a bit hacky to me. I’m not against other solutions but maybe we can find a better one. |
I tend to consider these entries "yet another env entry" instead of seeing them as a duplicate. If the default would not be configurable, we would have to send this value anyway. This is an implementation detail of the backend. |
I’m fine with either. I like yours because it requires no changes to the tracers but the down side is that the duplication is confusing, it adds network overhead (not sure if this is a real concern) and the implementation in the agent would not be very clean. I’d like to hear from the other reviewers too. |
I like this, although updating all the tracers (that have priority sampling implemented) will be a minor hassle. I feel like it is more explicit, but I have another reason too. Currently, there is no uniform way of setting the default env for each tracer. Sometimes it can be set by tag on each trace, by environment variable or config file. It would be nice if the user just puts it in their datadog.yaml. Then we can move something that previously would have to be in N number of configuration files/locations, and instead it just goes in one. |
@willgittoes-dd Why do you want to know the default env at all? Not sending an env and letting the agent/backend figure it out is way safer. |
@rochdev (one day I hope Github adds threaded messaging here) Thanks for responding, I think your comment makes it easier to understand for me :) It pushes me to care less which of these two solutions we pick. What happens when a tracer creates traces with no/default env, and also receives propagated traces that also have no env? It seems like the local-root and propagated traces should both have the same env, but maybe not because the originating tracer for the propagated traces might be in a different env. Would it be better to have explicit envs everywhere, and "default" is just what is explicitly assigned by default? |
@willgittoes-dd Not sure I understand. Your concern is basically cross-env requests? I'm not sure this would work well either way, unless the env is only used from the top level span. |
@rochdev is cross-env requests aren't possible, then why is env even in the sample-rate map? If a tracer/agent pair can assume the env is always the same, then perhaps we could remove 'env' from the map entirely? |
@willgittoes-dd A single Agent can receive traces from different I agree with @rochdev 's idea to simply duplicate the entries: also return |
e60012d
to
1de6189
Compare
I've implemented it as suggested. It needed a small refactor to avoid hacky assumption making string matching. PTAL. |
Benchmark results for
Benchmark results for
Let me know what you think. Number after benchmark represents entry count in returned (or set) map. |
@LotharSee PTAL. Note that I've also edited your last comment (hope that was on spot). |
@willgittoes-dd From the explanation above from @LotharSee, I think the idea is that the service will end up in its own environment if it's different than the root. It makes sense from a tracing perspective, but not sure how it would affect the service map. Please correct me if my understanding is wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Someone with more Go knowledge should definitely review as well.
This change fixes a problem where integrations have trouble matching
against the map of rates sent by the agent. For example, when a trace
has no "env" tag set, the agent will use the default env (which is
"none" or whatever is in "datadog.yaml"). Tracers have no knowledge of
this default so they will not be able to match against the map of rates.
To further explain, if the agent sends the map:
A tracer will try to use the key
service:mongo,env:
because it willhave no env information, failing to match against the map.
Using this change, tracers can use correct defaults.