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

[DSM] Close span on produce error in ckgo #2558

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Conversation

mborst
Copy link
Contributor

@mborst mborst commented Feb 14, 2024

What does this PR do?

When the produce queue is full, the confluent-kafka-go producer returns a synchronous error. The span started in the wrapper for the produce call currently isn't Finished in this scenario.

Motivation

Stumbled upon during reading code.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

For Datadog employees:

  • If this PR touches code that handles credentials of any kind, such as Datadog API keys, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Feb 14, 2024
@pr-commenter
Copy link

pr-commenter bot commented Feb 14, 2024

Benchmarks

Benchmark execution time: 2024-02-16 10:55:29

Comparing candidate commit 444103c in PR branch mborst/fixes-for-dsm with baseline commit c86c219 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 41 metrics, 0 unstable metrics.

Comment on lines +357 to +358
// with no delivery channel or enqueue error, finish immediately
if err != nil || deliveryChan == nil {

Choose a reason for hiding this comment

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

This makes sense to me, it seems like in case of an error we'd never close the span. Does this change also need to be performed in the kafka.v2 version?

err := p.Producer.Produce(msg, deliveryChan)
// with no delivery channel, finish immediately
if deliveryChan == nil {
span.Finish(tracer.WithError(err))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

@mborst mborst force-pushed the mborst/fixes-for-dsm branch from 55ad19b to a72b9f5 Compare February 14, 2024 14:31
@mborst mborst force-pushed the mborst/fixes-for-dsm branch from a72b9f5 to a69ac18 Compare February 14, 2024 16:29
@mborst mborst marked this pull request as ready for review February 14, 2024 16:29
@mborst mborst requested a review from a team as a code owner February 14, 2024 16:29
When enqueueing a message to the producer fails, the span would never be
finished.
@mborst mborst force-pushed the mborst/fixes-for-dsm branch from a69ac18 to 444103c Compare February 16, 2024 10:39
@dianashevchenko dianashevchenko merged commit c562133 into main Feb 16, 2024
157 checks passed
@dianashevchenko dianashevchenko deleted the mborst/fixes-for-dsm branch February 16, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants