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 issue with shim use of config.Duration #7996

Merged
merged 4 commits into from
Aug 18, 2020
Merged

fix issue with shim use of config.Duration #7996

merged 4 commits into from
Aug 18, 2020

Conversation

ssoroka
Copy link
Contributor

@ssoroka ssoroka commented Aug 17, 2020

The execd shim loads config in a slightly different way. As a result, the config.Duration wasn't being handled properly.

This PR fixes it, and resolves issues mentioned in #7911

@@ -887,7 +887,7 @@ func (e *Endpoint) chunkify(ctx context.Context, res *resourceKind, now time.Tim
// Determine time of last successful collection
metricName := e.getMetricNameForId(metric.CounterId)
if metricName == "" {
e.log.Info("Unable to find metric name for id %d. Skipping!", metric.CounterId)
e.log.Infof("Unable to find metric name for id %d. Skipping!", metric.CounterId)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good change but looks unrelated. Was it supposed to be in this pr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated; just don't want to make a new pr for one line. :D

@@ -54,3 +54,24 @@ func TestLoadingConfig(t *testing.T) {

require.Len(t, c.Processors, 1)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This test belongs in config/config_test.go instead of here. TestConfig_LoadSpecialTypes is similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can't have config require reverse_dns due to cyclical dependencies. Since it mentions both, it has to go here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.. though, a config_test package might work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at this with fresh eyes, the test above it is almost identical in setup. I'm not so sure that it belongs in config. The functionality in config is covered by another test (in config_test above), and this was just an extra sanity test I added to make sure the plugin had what it needed, and wasn't falling back on default values. In the end this was not needed (because it's not a regression test per se, and didn't highlight the bug I was fixing), but I figured it didn't hurt to add the test to the test suite. I'd recommend leaving it as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it's convenient to put it here because of dependencies, but it doesn't belong here because it's testing config parsing, not reverse dns functionality. I'll leave it to you to move if you want.

@ssoroka ssoroka requested a review from reimda August 18, 2020 15:12
@@ -54,3 +54,24 @@ func TestLoadingConfig(t *testing.T) {

require.Len(t, c.Processors, 1)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it's convenient to put it here because of dependencies, but it doesn't belong here because it's testing config parsing, not reverse dns functionality. I'll leave it to you to move if you want.

@ssoroka ssoroka merged commit 11afd42 into master Aug 18, 2020
@ssoroka ssoroka deleted the config-duration branch August 18, 2020 18:20
pmalek-sumo pushed a commit to SumoLogic/telegraf that referenced this pull request Aug 19, 2020
@sjwang90 sjwang90 added this to the 1.15.3 milestone Sep 1, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants