Skip to content

Let the proxy pod expose Prometheus metrics #2232

Open
@consideRatio

Description

@consideRatio

With configurable-http-proxy version 4.4.0 just released, there is support for exposing prometheus metrics on a given port.

But, it is not obvious to me where to add annotations to help prometheus scrape this metrics.

  • The CHP/proxy pod should run in a single replica.
  • The CHP/proxy pod is exposed behind the k8s service named proxy-http if autohttps is enabled, or behind proxy-public if it isn't.
  • The hub pod's k8s service is annotated so the hub pod is scraped.

Option 1: We could apply the prometheus scraping annotations to either the proxy-http service or the proxy-public service depending on where its located.
Option 2: We could apply the prometheus scraping annotations to the proxy pod itself

Those are the viable options I think, and I'm not sure what makes sense or how the details work out.

Action points

  • Configure --metrics-port=<some-port> when starting configurable-http-proxy
  • Decide where to configure scraping annotations
    • Configure annotations

Related

jupyterhub/configurable-http-proxy#314

annotations:
{{- if not (index .Values.hub.service.annotations "prometheus.io/scrape") }}
prometheus.io/scrape: "true"
{{- end }}
{{- if not (index .Values.hub.service.annotations "prometheus.io/path") }}
prometheus.io/path: {{ .Values.hub.baseUrl | trimSuffix "/" }}/hub/metrics
{{- end }}
{{- if not (index .Values.hub.service.annotations "prometheus.io/port") }}
prometheus.io/port: "8081"
{{- end }}
{{- with .Values.hub.service.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions