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

Enable queueing, retry, timeout for Kafka exporter #1455

Merged
merged 1 commit into from
Aug 13, 2020

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented Jul 29, 2020

@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

Merging #1455 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1455   +/-   ##
=======================================
  Coverage   90.93%   90.93%           
=======================================
  Files         240      240           
  Lines       16718    16727    +9     
=======================================
+ Hits        15202    15211    +9     
  Misses       1085     1085           
  Partials      431      431           
Impacted Files Coverage Δ
exporter/kafkaexporter/factory.go 100.00% <100.00%> (ø)
exporter/kafkaexporter/kafka_exporter.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d31f0f...90d64b1. Read the comment docs.

exporter/kafkaexporter/kafka_exporter_test.go Show resolved Hide resolved
@@ -41,6 +41,8 @@ func newExporter(config Config, params component.ExporterCreateParams) (*kafkaPr
c.Producer.Return.Errors = true
// Wait only the local commit to succeed before responding.
c.Producer.RequiredAcks = sarama.WaitForLocal
// Because sarama does not accept a Context for every message, set the Timeout here.
Copy link
Member

Choose a reason for hiding this comment

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

not sure what you mean by a Context

Copy link
Member Author

Choose a reason for hiding this comment

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

SendRequest does not accept a context.Context as an argument, so I cannot pass Timeout using the standard go way to do this via the context.Context

},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
NumConsumers: 2,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should it? it is 2 here because that's what I put in the yaml.

Copy link
Member

Choose a reason for hiding this comment

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

Looks good I haven't noticed that this is a test 😟

MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
},
QueueSettings: exporterhelper.QueueSettings{
Copy link
Member

Choose a reason for hiding this comment

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

Are the default values based on something or just common sense (also for the retry) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just common sense. there is a documentation on how to configure the sending queue:
https://github.com/open-telemetry/opentelemetry-collector/blob/master/exporter/exporterhelper/queued_retry.go#L43

@pavolloffay
Copy link
Member

Could you please also update the readme with the new properties?

@bogdandrutu
Copy link
Member Author

@pavolloffay PTAL

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

LGTM, although I am not sure what the default values should be used.

- `timeout` (default = 5s): Is the timeout for every attempt to send data to the backend.
- `retry_on_failure`
- `enabled` (default = true)
- `initial_interval` (default = 5s): Time to wait after the first failure before retrying; ignored if `enabled` is `false`
Copy link
Member

Choose a reason for hiding this comment

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

Are the default values correct? Shouldn't we use the same defaults as the driver uses?

https://github.com/Shopify/sarama/blob/master/config.go#L462

Copy link
Member Author

Choose a reason for hiding this comment

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

You pointed to the timeout this is the initial backoff delay after a request fail. We can tune the timeout to be 10sec if that is important, I would leave it as is for the moment and maybe collect feedback.

- `max_elapsed_time` (default = 120s): Is the maximum amount of time spent trying to send a batch; ignored if `enabled` is `false`
- `sending_queue`
- `enabled` (default = false)
- `num_consumers` (default = 10): Number of consumers that dequeue batches; ignored if `enabled` is `false`
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean that 10 instances of the exporter will be created?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just one instance, but will be 10 goroutines consuming items from the in-memory queue (similar with queue retry processor, but per exporter) and calling into the only one instance of the exporter created.

@bogdandrutu
Copy link
Member Author

/cc @tigrannajaryan

Comment on lines +27 to +29
exporterhelper.TimeoutSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
exporterhelper.QueueSettings `mapstructure:"sending_queue"`
exporterhelper.RetrySettings `mapstructure:"retry_on_failure"`
Copy link
Member

Choose a reason for hiding this comment

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

Since all (?) of the exporters are going to need all 3 settings perhaps introduce a struct which embeds all 3 and use. Can be done in a future PR.

@tigrannajaryan tigrannajaryan merged commit 442c6df into open-telemetry:master Aug 13, 2020
@bogdandrutu bogdandrutu deleted the kafkaexp branch September 14, 2020 17:19
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this pull request Nov 11, 2021
…lemetry#1455)

* Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /sdk

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
…y#1455)

Bumps [boto3](https://github.com/boto/boto3) from 1.21.35 to 1.21.38.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](boto/boto3@1.21.35...1.21.38)

---
updated-dependencies:
- dependency-name: boto3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants