Skip to content
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

Fix redis integration not to create an invalid span in case of empty pipeline #757

Merged
merged 3 commits into from
Jul 15, 2022
Merged

Fix redis integration not to create an invalid span in case of empty pipeline #757

merged 3 commits into from
Jul 15, 2022

Conversation

sponomarev
Copy link
Contributor

@sponomarev sponomarev commented May 15, 2019

At the moment, if Redis#pipelined block doesn't invoke any Redis commands, the integration creates an invalid span with empty line Resource attribute. As a result, an agent drops that span and the whole trace.

datadog_1  | [ TRACE ] 2019-05-15 20:42:02 ERROR (api.go:259) - dropping trace reason: invalid span (SpanID:4574868779096203116): `Resource` is invalid UTF-8: "" (debug for more info), [service:"whatever...

Empty pipeline case is pretty legit for dynamic keys gathering. For instance, in Sidekick.

This PR solves the problem and creates a (none) span for an empy pipeline.

@delner delner self-requested a review May 15, 2019 21:53
@delner delner added bug Involves a bug community Was opened by a community member integrations Involves tracing integrations labels May 15, 2019
@sponomarev
Copy link
Contributor Author

The failed build on Ruby 2.1 is unrelated. This is notorious nokogiri 😞

@delner
Copy link
Contributor

delner commented May 16, 2019

No problem, this happens time to time. I kicked off another build for you, seemed like it passed. I'll review and let you know!

Copy link
Contributor

@delner delner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and identifying this bug! Just a quick question regarding how we should handle this scenario, but the changes otherwise look fine to me.

span.set_metric Datadog::Contrib::Redis::Ext::METRIC_PIPELINE_LEN, commands.length
commands = args[0].commands.map { |c| Datadog::Contrib::Redis::Quantize.format_command_args(c) }

if commands.any?
Copy link
Contributor

@delner delner May 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is interesting because it raises the question that if there are no commands, but the pipeline still runs, do we want to instrument it? (There might be a case for either one. I can imagine you might want to see that the Redis pipeline ran, even if it didn't do anything.)

If no, then I think this change is fine. If yes, then maybe we should give the resource name something else that isn't blank (e.g. null, (none), NOOP etc.).

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@delner Agree. I thought about it before and it seemed like a piece of useless information but at the moment it makes more sense. Understanding that your pipeline doesn't make any commands is a great insight into a transaction part.

I'll change the implementation.

@palazzem
Copy link
Contributor

@delner let's keep this PR at the top of our list, so we can move forward with @sponomarev work!

Thanks for this really helpful contribution!

@delner delner added this to Needs triage in Planning Apr 21, 2021
@sponomarev sponomarev requested a review from a team January 26, 2022 11:58
@ivoanjo
Copy link
Member

ivoanjo commented Jul 13, 2022

@marcotc this seems like a trivial rebase away from a nice win, what do you think?

@sponomarev
Copy link
Contributor Author

@ivoanjo @marcotc the branch has been rebased

@marcotc marcotc merged commit 016acb1 into DataDog:master Jul 15, 2022
@github-actions github-actions bot added this to the 1.3.0 milestone Jul 15, 2022
@marcotc
Copy link
Member

marcotc commented Jul 15, 2022

Thank you so much for the endurance in getting this PR merged, @sponomarev! 🙇 Sorry it took us so long to follow up before.

It will be shipped in the next release, 1.3.0.

@sponomarev sponomarev deleted the fix/redis-empty-pipeline branch July 18, 2022 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug community Was opened by a community member integrations Involves tracing integrations
Projects
Planning
Needs triage
Development

Successfully merging this pull request may close these issues.

None yet

5 participants