feat(helm): Add configurable prometheus metrics annotation sup (#60) #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds comprehensive Prometheus metrics scraping support to the DotCMS Helm chart, enabling automated discovery and monitoring of DotCMS pods by Prometheus. The implementation provides full configurability while maintaining backward compatibility.
Changes
📊 Prometheus Configuration (
values.yaml)prometheusconfiguration section with full control over scraping behaviorscrape,port, andpathscrape: "true",port: "8090",path: "/dotmgt/metrics"prometheus.enabled: false🏷️ Pod Annotations (
statefulset.yaml)prometheus.enabled: trueprometheus.io/scrape,prometheus.io/port,prometheus.io/path🔧 Helper Functions (
_helpers.tpl)dotcms.versionhelper function for consistent version handling"1.0.0-SNAPSHOT"→"SNAPSHOT"for cleaner version labelsFIELD:prefix🏃♂️ Environment Variables for Metrics Tagging
When Prometheus is enabled, the following environment variables are automatically injected for consistent metric labeling:
DOT_METRICS_TAG_APP- Application name (e.g., "dotcms")DOT_METRICS_TAG_ENV- Environment name (e.g., "prod")DOT_METRICS_TAG_VER- Version tag (truncated, e.g., "21.06.14" or "SNAPSHOT")DOT_METRICS_TAG_CUST- Customer name (e.g., "dotcms-dev")DOT_METRICS_TAG_FULLNAME- Full deployment name (e.g., "dotcms-dotcms-dev-prod")DOT_METRICS_TAG_HOSTNAME- Pod hostname with StatefulSet index via Kubernetes downward API🔄 Kubernetes Integration
valueFrom.fieldRef.fieldPath: "metadata.name")dotcms-dotcms-dev-prod-0,dotcms-dotcms-dev-prod-1for StatefulSet replica identificationTesting
prometheus.enabled: trueExample Usage
Enable with defaults:
Custom configuration:
Disable entirely:
Impact
Closes #60
Issue: Add configurable prometheus metrics annotation support to helm chart