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

Dynatrace Plugin: Make conversion to counters possible / Changed large bulk handling #8397

Merged
merged 89 commits into from
Mar 2, 2021

Conversation

thschue
Copy link
Contributor

@thschue thschue commented Nov 12, 2020

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Some input plugins do not set a ValueType for counters, which causes them to be handled as gauges in dynatrace. This PR enables the definition of such metrics to be handled as counters

Thomas Schuetz and others added 30 commits July 2, 2020 11:32
Co-authored-by: Steven Soroka <ssoroka78@gmail.com>
Co-authored-by: Steven Soroka <ssoroka78@gmail.com>
@sjwang90 sjwang90 added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Nov 24, 2020
@thschue thschue changed the title Dynatrace Plugin: Make conversion to counters possible Dynatrace Plugin: Make conversion to counters possible / Changed large bulk handling Nov 26, 2020
@zak-pawel
Copy link
Collaborator

@thschue Is this PR ready for review? Still see some Printlns, lack of README.md update and so on...

@thschue
Copy link
Contributor Author

thschue commented Nov 30, 2020

@thschue Is this PR ready for review? Still see some Printlns, lack of README.md update and so on..

The PR is ready now

@@ -219,6 +232,15 @@ func (d *Dynatrace) Write(metrics []telegraf.Metric) error {
default:
fmt.Fprintf(&buf, "%s%s %v\n", metricID, tagb.String(), value)
}

if metricCounter%1000 == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't 1000 be configurable or at least not used as a magic number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to ensure that the bulks sent to the api are not too large (that's also the reason, why it isn't configurable)

Copy link
Contributor

Choose a reason for hiding this comment

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

keep in mind if this splits it into chunks and the last chunk fails, all chunks will be retried(re-sent) when returning an error. When returning a nil, no chunks will be retried(re-sent).
I wonder if instead we should allow plugins to request that the batch size not exceed a certain limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since that isn't possible now, I think the solution here is sufficient. 1000 is a hard limit set by the dynatrace api rate limiting so a configuration wouldn't do any good.

Retrying the whole batch if the last chunk fails is unfortunate and something i'm taking a note of that I might fix in a follow up. Thanks for the heads-up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @zak-pawel! You still have a request changes in place for this comment. Would you be fine with merging this now? Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@arminru I understand why it should not be configurable.
But I don't understand why this magic number cannot be converted to const. You can name it dynatraceAPIRateLimit (or similar) and everyone will be happy :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, making it a const for better readability makes sense - will do!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@arminru Now it's great.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!
@ssoroka can this be merged now? 🙂

@sjwang90 sjwang90 added this to the Planned milestone Dec 9, 2020
@ssoroka
Copy link
Contributor

ssoroka commented Jan 21, 2021

see last comment

@sjwang90 sjwang90 removed this from the Planned milestone Jan 29, 2021
@zak-pawel zak-pawel added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 18, 2021
@arminru
Copy link
Contributor

arminru commented Feb 26, 2021

Hey, any chance this could be merged? Thanks!

@arminru
Copy link
Contributor

arminru commented Mar 1, 2021

@helenosheaa @ssoroka I updated the PR to pick up the latest Revive fixes from the master branch.

@ssoroka ssoroka merged commit 15d45ec into influxdata:master Mar 2, 2021
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants