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: Add support for metrics in chart #924

Merged
merged 8 commits into from
Sep 9, 2024
Merged

Conversation

coibib
Copy link
Contributor

@coibib coibib commented Jul 4, 2024

This PR adds a specific port for the metrics in the Helm Chart.

Signed-off-by: François BIBRON <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Jul 4, 2024

CLA assistant check
All committers have signed the CLA.

@xvilo
Copy link

xvilo commented Jul 4, 2024

Do we also want to add support for prometheus service monitor? https://observability.thomasriley.co.uk/prometheus/configuring-prometheus/using-service-monitors/

In this case it would be automatically be picked up by prometheus-operator running on my cluster :D

coibib added 2 commits July 4, 2024 16:23
Signed-off-by: François BIBRON <[email protected]>
Signed-off-by: François BIBRON <[email protected]>
@coibib
Copy link
Contributor Author

coibib commented Jul 4, 2024

Do we also want to add support for prometheus service monitor? https://observability.thomasriley.co.uk/prometheus/configuring-prometheus/using-service-monitors/

In this case it would be automatically be picked up by prometheus-operator running on my cluster :D

I totally agree with you, I added the corresponding changes.

coibib added 2 commits July 4, 2024 16:30
Signed-off-by: François BIBRON <[email protected]>
Signed-off-by: François BIBRON <[email protected]>
@xvilo
Copy link

xvilo commented Jul 12, 2024

LGTM

Copy link
Owner

@dunglas dunglas left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, and sorry for the late review.

I made some small suggestions inspired by https://github.com/bitnami/charts/blob/main/bitnami/wordpress/.

name: metrics
selector:
{{- include "mercure.selectorLabels" . | nindent 4 }}
{{- end }}
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
{{- end }}
{{- end }}

# admin :9181
enabled: false
# -- The port to use for exposing the metrics.
port: 9181
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
port: 9181
port: 2019

Can we stick with the default Caddy port?

@@ -28,6 +28,22 @@ subscriberJwtAlg: HS256
# -- The license key for [the High Availability version](https://mercure.rocks/docs/hub/cluster) (not necessary is you use the FOSS version).
license: ""

metrics:
# -- Enable the metrics. You must also add the [metrics](https://caddyserver.com/docs/caddyfile/directives/metrics) in the `globalOptions` for Caddy server.
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
# -- Enable the metrics. You must also add the [metrics](https://caddyserver.com/docs/caddyfile/directives/metrics) in the `globalOptions` for Caddy server.
# -- Enable metrics. You must also add a `servers` block with a [`metrics` directive](https://caddyserver.com/docs/caddyfile/options#metrics) in the `globalOptions` value.

# servers {
# metrics
# }
# admin :9181
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
# admin :9181

name: {{ include "mercure.fullname" . }}-metrics
labels:
{{- include "mercure.labels" . | nindent 4 }}
prometheus-operated: true
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
prometheus-operated: true
prometheus-operated: true
app.kubernetes.io/component: metrics

name: {{ include "mercure.fullname" . }}-metrics
labels:
{{- include "mercure.labels" . | nindent 4 }}
prometheus-operated: true
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this label necessary? I don't find where it is documented.

Comment on lines 6 to 7
labels:
app.kubernetes.io/name: {{ include "mercure.name" . }}
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
labels:
app.kubernetes.io/name: {{ include "mercure.name" . }}
labels:
{{- include "mercure.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics

spec:
selector:
matchLabels:
prometheus-operated: "true"
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
prometheus-operated: "true"
app.kubernetes.io/component: metrics

@@ -28,6 +28,22 @@ subscriberJwtAlg: HS256
# -- The license key for [the High Availability version](https://mercure.rocks/docs/hub/cluster) (not necessary is you use the FOSS version).
license: ""

metrics:
# -- Enable the metrics. You must also add the [metrics](https://caddyserver.com/docs/caddyfile/directives/metrics) in the `globalOptions` for Caddy server.
# servers {
Copy link
Owner

Choose a reason for hiding this comment

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

Can't we add this option automatically using the by appending the needed config to the GLOBAL_OPTIONS environment variable in deployment.yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Appending server {metrics} option to GLOBAL_OPTIONS may cause errors if the server option is specified elsewhere, for example in globalOptions I think

Copy link
Owner

Choose a reason for hiding this comment

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

Indeed, let's do that like this for now. We could do something smarter in the future (like detection if servers is not part of the existing string, but we'll see in follow-up PRs!

Signed-off-by: François Bibron <[email protected]>
@gabrielrosset
Copy link

Hello @dunglas , it seems that @coibib has taken your remarks into account, is there anything left to do on this PR to merge it?

Hello @coibib , can you please allow me to push on your fork to allow us to get the subject back into the project ? Thanks.

@@ -28,6 +28,22 @@ subscriberJwtAlg: HS256
# -- The license key for [the High Availability version](https://mercure.rocks/docs/hub/cluster) (not necessary is you use the FOSS version).
license: ""

metrics:
# -- Enable the metrics. You must also add the [metrics](https://caddyserver.com/docs/caddyfile/directives/metrics) in the `globalOptions` for Caddy server.
# servers {
Copy link
Owner

Choose a reason for hiding this comment

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

Indeed, let's do that like this for now. We could do something smarter in the future (like detection if servers is not part of the existing string, but we'll see in follow-up PRs!

Comment on lines 137 to 138
resources:
{}
Copy link
Owner

Choose a reason for hiding this comment

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

Why this change?

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 my linter, i reverted the change back.

Signed-off-by: François Bibron <[email protected]>
@xvilo
Copy link

xvilo commented Sep 9, 2024

Hiya, whats the status of this PR? We've been using Mercure in production since a month or so, and running it through kubernetes. Unfortunately we've had issues with it borking twice now, and with just the ingress logs we don't have enough data :-) so this might be super helpful 👍

@dunglas
Copy link
Owner

dunglas commented Sep 9, 2024

Thanks @coibib!

@dunglas dunglas merged commit 849c7b3 into dunglas:main Sep 9, 2024
8 checks passed
@dunglas
Copy link
Owner

dunglas commented Sep 9, 2024

@xvilo merged, it will be in the next release.

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.

5 participants