acryldata/datahub-helm

Enhance DataHub Helm Charts to Apply extraLabels to ServiceMonitor Resources for Improved Prometheus Integration

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
The existing DataHub Helm charts for datahub-frontend and datahub-gms already support the specification of extraLabels in the values.yaml file, which can be applied to Service and Deployment resources. However, this functionality is not currently extended to ServiceMonitor resources, which poses a challenge for integrating with Prometheus in environments that require specific labeling conventions for service discovery and monitoring. Our Prometheus setup, for example, relies on specific labels for scraping metrics, and the inability to apply these labels directly to ServiceMonitor resources through the Helm chart necessitates manual post-deployment adjustments or maintaining a customized version of the chart.

Describe the solution you'd like
I propose enhancing the DataHub Helm charts for datahub-frontend and datahub-gms to ensure that extraLabels defined in the values.yaml are also applied to ServiceMonitor resources. This can be achieved by including a similar templating block as used for Service and Deployment resources within the ServiceMonitor definition:

{{- if and .Values.serviceMonitor.create .Values.global.datahub.monitoring.enablePrometheus -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ printf "%s-%s" .Release.Name "datahub-frontend" }}
  labels:
    {{- include "datahub-frontend.labels" . | nindent 4 }}
    {{- range $key, $val := .Values.extraLabels }}
    {{ $key }}: {{ $val | quote }}
    {{- end }}
# other staff

Implementing this change would align the handling of extraLabels across different resource types within the chart, providing users with a consistent and flexible way to apply labels that meet their operational and monitoring needs.

Describe alternatives you've considered
The current workaround involves manually editing the ServiceMonitor resources after deployment to include the required labels, or modifying and maintaining a fork of the Helm chart with our specific adjustments. Both approaches are less than ideal, as they either introduce manual steps that complicate automation or result in divergence from the community-driven chart, complicating updates and maintenance.

Additional context
The inclusion of extraLabels in Service and Deployment definitions within the DataHub Helm charts demonstrates a commitment to flexibility and customization. Extending this functionality to ServiceMonitor resources would further enhance the utility and user-friendliness of the chart, facilitating seamless integration with monitoring tools and adherence to diverse operational practices.

This issue is stale because it has been open for 30 days with no activity. If you believe this is still an issue on the latest DataHub release please leave a comment with the version that you tested it with. If this is a question/discussion please head to https://slack.datahubproject.io. For feature requests please use https://feature-requests.datahubproject.io