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

feat(http): add config option to disable metrics endpoint in influxd #20963

Merged
merged 7 commits into from
Mar 15, 2021

Conversation

danxmoran
Copy link
Contributor

Closes #20755

NOTE: We wire up the influxd process with a prom.Registry even when /metrics is disabled, because the metrics are also used by our telemetry reporter. A follow-up improvement could avoid all the prometheus code paths when both metrics and reporting are disabled.

@danxmoran danxmoran force-pushed the dm-disable-metrics-http-20755 branch from 2689c32 to aae02dd Compare March 15, 2021 18:11
@russorat
Copy link
Contributor

what happens if someone does --metrics-disabled but not --reporting-disabled?

@danxmoran
Copy link
Contributor Author

what happens if someone does --metrics-disabled but not --reporting-disabled?

The /metrics endpoint will return a "forbidden" response, but metrics will still be collected by the system and made available to the telemetry reporter. I'll try adding a test that shows the HTTP API metrics are registered even when /metrics is turned off.

@@ -68,34 +83,23 @@ func WithPprofEnabled(enabled bool) HandlerOptFn {
}
}

func WithHealthHandler(h http.Handler) HandlerOptFn {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we dropping the health and ready handler code? They're just not called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, unused.

@danxmoran danxmoran force-pushed the dm-disable-metrics-http-20755 branch from aae02dd to 561052a Compare March 15, 2021 18:43
w: httptest.NewRecorder(),
},
{
name: "should record metrics when http handling",
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: test name should be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, good catch

Copy link
Contributor

@lesam lesam left a comment

Choose a reason for hiding this comment

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

lgtm

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.

Add support for disabling /metrics endpoint
3 participants