Skip to content

Commit

Permalink
Improve Helm chart - Use metric sink approach for Prometheus & genera…
Browse files Browse the repository at this point in the history
…l refresh

Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com>
  • Loading branch information
tomkerkhove committed Sep 1, 2020
1 parent c6068f1 commit 34f4641
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ steps:
mkdir output/
helm package ${{ parameters.chartName }}/ --version ${{ parameters.chartVersion }} --app-version ${{ parameters.appVersion }} --destination output/
workingDirectory: charts
displayName: 'Package Helm Chart v${{ parameters.chartVersion }} (App version ${{ parameters.appVersion }})'
displayName: 'Package Helm Chart v${{ parameters.chartVersion }} (App version ${{ parameters.appVersion }})'
11 changes: 7 additions & 4 deletions charts/promitor-agent-scraper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: v1
version: 0.2.0
appVersion: 1.0.0
description: Promitor, bringing Azure Monitor metrics where you need them.
type: application
name: promitor-agent-scraper
icon: https://raw.githubusercontent.com/tomkerkhove/promitor/master/docs/media/logos/promitor.png
home: https://github.com/tomkerkhove/promitor
description: Promitor, bringing Azure Monitor metrics where you need them.
home: https://promitor.io
sources:
- https://github.com/tomkerkhove/promitor
maintainers:
- name: Tom Kerkhove
url: https://github.com/tomkerkhove
url: https://github.com/tomkerkhove
icon: https://raw.githubusercontent.com/tomkerkhove/promitor/master/docs/media/logos/promitor.png
21 changes: 11 additions & 10 deletions charts/promitor-agent-scraper/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Promitor

[Promitor](https://promitor.io/) is an Azure Monitor scraper for Prometheus providing
a scraping endpoint for Prometheus that provides a configured subset of Azure
Monitor metrics.
[Promitor](https://promitor.io/) is an Azure Monitor scraper which makes
the metrics available for metric systems such as Atlassian Statuspage,
Prometheus and StatsD.

## TL;DR

```console
helm repo add promitor https://promitor.azurecr.io/helm/v1/repo
helm install promitor/promitor-agent-scraper
helm install promitor-agent-scraper promitor/promitor-agent-scraper
```

## Introduction
Expand All @@ -28,10 +28,11 @@ Service so that other Pods can consume it.
To install the chart with the release name `promitor-agent-scraper`:

```console
$ helm install --name promitor-agent-scraper promitor/promitor-agent-scraper \
$ helm install promitor-agent-scraper
--set azureAuthentication.appId='<azure-ad-app-id>' \
--set azureAuthentication.appKey='<azure-ad-app-key>' \
--values /path/to/metric-declaration.yaml
--values /path/to/metric-declaration.yaml \
promitor/promitor-agent-scraper
```

The command deploys Prometheus on the Kubernetes cluster with the specified metrics
Expand Down Expand Up @@ -66,10 +67,10 @@ their default values.
| `metricSinks.statsd.host` | DNS name or IP address of StatsD server | |
| `metricSinks.statsd.port` | Port (UDP) address of StatsD server | `8125` |
| `metricSinks.statsd.metricPrefix` | Prefix that will be added to every metric defined in the metric declaration | |
| `prometheus.scrapeEndpointPath` | Path where the scraping endpoint for Prometheus is being exposed | `/metrics` |
| `prometheus.enableMetricTimestamps` | Indication whether or not to include timestamp | `true` |
| `prometheus.metricUnavailableValue` | Value to report in Prometheus when no metric was found whether or not to include timestamp | `NaN` |
| `prometheus.enableServiceDiscovery` | Indication whether or not service discovery with annotations should be enabled ([docs](https://github.com/helm/charts/tree/master/stable/prometheus#scraping-pod-metrics-via-annotations)) | `true` |
| `metricSinks.prometheusScrapingEndpoint.baseUriPath` | Path where the scraping endpoint for Prometheus is being exposed | `/metrics` |
| `metricSinks.prometheusScrapingEndpoint.enableMetricTimestamps` | Indication whether or not to include timestamp | `true` |
| `metricSinks.prometheusScrapingEndpoint.metricUnavailableValue` | Value to report in Prometheus when no metric was found whether or not to include timestamp | `NaN` |
| `metricSinks.prometheusScrapingEndpoint.enableServiceDiscovery` | Indication whether or not service discovery with annotations should be enabled ([docs](https://github.com/helm/charts/tree/master/stable/prometheus#scraping-pod-metrics-via-annotations)) | `true` |
| `telemetry.applicationInsights.enabled` | Indication whether or not to send telemetry to Azure Application Insights | `false` |
| `telemetry.applicationInsights.logLevel` | Minimum level of logging for Azure Application Insights | |
| `telemetry.applicationInsights.key` | Application Insights instrumentation key | |
Expand Down
4 changes: 2 additions & 2 deletions charts/promitor-agent-scraper/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "promitor-agent-scraper.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:{{ .Values.service.targetPort }}

2. Check the scraping output at http://0.0.0.0:8080{{ .Values.prometheus.scrapeEndpointPath }}
2. Check the scraping output at http://0.0.0.0:8080{{ .Values.metricSinks.prometheusScrapingEndpoint.baseUriPath }}

3. To set up Prometheus in your cluster & pull in metrics from Promitor's scraping output, run:

cat > promitor-scrape-config.yaml <<EOF
extraScrapeConfigs: |
- job_name: {{ template "promitor-agent-scraper.fullname" . }}
metrics_path: {{ .Values.prometheus.scrapeEndpointPath }}
metrics_path: {{ .Values.metricSinks.prometheusScrapingEndpoint.baseUriPath }}
static_configs:
- targets:
- {{ template "promitor-agent-scraper.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}
Expand Down
6 changes: 3 additions & 3 deletions charts/promitor-agent-scraper/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ data:
{{- end }}
{{- end }}
prometheusScrapingEndpoint:
metricUnavailableValue: {{ .Values.prometheus.metricUnavailableValue | quote }}
enableMetricTimestamps: {{ .Values.prometheus.enableMetricTimestamps | quote }}
baseUriPath: {{ .Values.prometheus.scrapeEndpointPath | quote }}
metricUnavailableValue: {{ .Values.metricSinks.prometheusScrapingEndpoint.metricUnavailableValue | quote }}
enableMetricTimestamps: {{ .Values.metricSinks.prometheusScrapingEndpoint.enableMetricTimestamps | quote }}
baseUriPath: {{ .Values.metricSinks.prometheusScrapingEndpoint.baseUriPath | quote }}
metricsConfiguration:
absolutePath: /config/metrics-declaration.yaml
telemetry:
Expand Down
4 changes: 2 additions & 2 deletions charts/promitor-agent-scraper/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: {{ .Values.service.labelType }}
{{- if .Values.prometheus.enableServiceDiscovery }}
{{- if .Values.metricSinks.prometheusScrapingEndpoint.enableServiceDiscovery }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: {{ .Values.prometheus.scrapeEndpointPath | quote }}
prometheus.io/path: {{ .Values.metricSinks.prometheusScrapingEndpoint.baseUriPath | quote }}
prometheus.io/port: {{ .Values.service.targetPort | quote }}
{{- end }}
spec:
Expand Down
10 changes: 5 additions & 5 deletions charts/promitor-agent-scraper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ metricSinks:
host: ""
port: 8125
metricPrefix: ""
prometheusScrapingEndpoint:
baseUriPath: /metrics
enableMetricTimestamps: true
metricUnavailableValue: NaN
enableServiceDiscovery: true
resourceDiscovery:
enabled: false
host: ""
port: 80
prometheus:
scrapeEndpointPath: /metrics
enableMetricTimestamps: true
metricUnavailableValue: NaN
enableServiceDiscovery: true
telemetry:
defaultLogLevel: "Error"
applicationInsights:
Expand Down

0 comments on commit 34f4641

Please sign in to comment.