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

Expose pipecd ops metrics #2279

Merged
merged 5 commits into from Jul 21, 2021
Merged

Expose pipecd ops metrics #2279

merged 5 commits into from Jul 21, 2021

Conversation

khanhtc1202
Copy link
Member

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.72%. This pull request decreases coverage by -0.03%.

File Function Base Head Diff
pkg/cli/cmd.go Telemetry.CustomMetricsHandlerFor 0.00% 0.00% +0.00%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 31.72%. This pull request decreases coverage by -0.04%.

File Function Base Head Diff
pkg/cli/cmd.go Telemetry.CustomMetricsHandlerFor 0.00% 0.00% +0.00%

pkg/cli/cmd.go Outdated
@@ -142,15 +145,41 @@ type MetricsBuilder interface {
Build() (io.Reader, error)
}

func (t Telemetry) CustomMetricsHandlerFor(mb MetricsBuilder) http.Handler {
func (t Telemetry) CustomMetricsHandlerFor(reg *prometheus.Registry, mb MetricsBuilder) http.Handler {
if t.Flags.Metrics {
Copy link
Member

Choose a reason for hiding this comment

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

nit:

if !t.Flags.Metrics {
        var empty http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(""))
	}
	return empty
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I get your point. 👍 Lets keep it as is to unify with others for now, will address it by another PR (apply this pattern to others metrics handler as well)

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed my mind, will address it in this PR and apply only for this handler, lol

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed by 6513a2d 🙏

pkg/cli/cmd.go Outdated
@@ -142,15 +145,41 @@ type MetricsBuilder interface {
Build() (io.Reader, error)
}

func (t Telemetry) CustomMetricsHandlerFor(mb MetricsBuilder) http.Handler {
func (t Telemetry) CustomMetricsHandlerFor(reg *prometheus.Registry, mb MetricsBuilder) http.Handler {
Copy link
Member

Choose a reason for hiding this comment

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

Passing Gatherer instead of Registry.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch 👍 Address by 6513a2d 🙏

@nghialv
Copy link
Member

nghialv commented Jul 21, 2021

Looks good!
/lgtm

@nakabonne
Copy link
Member

Yup, looks perfect ;)
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nakabonne.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants