Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 6f0cc6b

Browse files
author
Jason Schmidt
authored
feat: add statsd collector to prometheus deployment (#53)
* feat: add statsd receiver to prometheus namespace * feat: add doc notes for statsd collector * feat: add statsd receiver to prometheus namespace * feat: add doc notes for statsd collector
1 parent ae2c6a4 commit 6f0cc6b

File tree

3 files changed

+107
-1
lines changed

3 files changed

+107
-1
lines changed

pulumi/aws/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ vpc - defines and installs the VPC and subnets to use with EKS
3131
└─logstore - deploys a logstore (elasticsearch) to the EKS cluster
3232
└─logagent - deploys a logging agent (filebeat) to the EKS cluster
3333
└─certmgr - deploys the open source cert-manager.io helm chart to the EKS cluster
34-
└─prometheus - deploys prometheus server and node exporter for metrics
34+
└─prometheus - deploys prometheus server, node exporter, and statsd collector for metrics
3535
└─grafana - deploys the grafana visualization platform
3636
└─sirius - deploys the Bank of Sirus application to the EKS cluster
3737

pulumi/aws/config/Pulumi.stackname.yaml.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ config:
204204
prometheus:helm_repo_name: prometheus-community
205205
# Name of the repo to pull the prometheus chart from
206206
prometheus:helm_repo_url: https://https://prometheus-community.github.io/helm-charts
207+
# Name of the statsd chart (uses the same repo as the prom chart)
208+
prometheus:statsd_chart_name: prometheus-statsd-exporter
209+
# Version of the statsd chart (uses the same repo as the prom chart)
210+
prometheus.statsd_chart_version: 0.3.1
207211

208212
############################################################################
209213

pulumi/aws/prometheus/__main__.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,105 @@ def project_name_from_project_dir(dirname: str):
6363
prometheus_chart = helm.Chart(release_name='prometheus',
6464
config=chart_ops,
6565
opts=pulumi.ResourceOptions(provider=k8s_provider))
66+
67+
#
68+
# Deploy the statsd collector
69+
#
70+
71+
statsd_chart_values = {
72+
"replicaCount": 1,
73+
"image": {
74+
"repository": "prom/statsd-exporter",
75+
"pullPolicy": "IfNotPresent",
76+
"tag": "v0.20.0"
77+
},
78+
"imagePullSecrets": [],
79+
"nameOverride": "",
80+
"fullnameOverride": "",
81+
"statsd": {
82+
"udpPort": 9125,
83+
"tcpPort": 9125,
84+
"cacheSize": 1000,
85+
"eventQueueSize": 10000,
86+
"eventFlushThreshold": 1000,
87+
"eventFlushInterval": "200ms"
88+
},
89+
"serviceMonitor": {
90+
"enabled": False,
91+
"interval": "30s",
92+
"scrapeTimeout": "10s",
93+
"namespace": "monitoring",
94+
"honorLabels": False,
95+
"additionalLabels": {}
96+
},
97+
"serviceAccount": {
98+
"create": True,
99+
"annotations": {},
100+
"name": ""
101+
},
102+
"podAnnotations": {
103+
"prometheus.io/scrape": "true",
104+
"prometheus.io/port": "9102"
105+
},
106+
"podSecurityContext": {},
107+
"securityContext": {},
108+
"service": {
109+
"type": "ClusterIP",
110+
"port": 9102,
111+
"path": "/metrics",
112+
"annotations": {}
113+
},
114+
"ingress": {
115+
"enabled": False,
116+
"annotations": {},
117+
"hosts": [
118+
{
119+
"host": "chart-example.local",
120+
"paths": []
121+
}
122+
],
123+
"tls": []
124+
},
125+
"resources": {},
126+
"autoscaling": {
127+
"enabled": False,
128+
"minReplicas": 1,
129+
"maxReplicas": 100,
130+
"targetCPUUtilizationPercentage": 80
131+
},
132+
"nodeSelector": {},
133+
"tolerations": [],
134+
"affinity": {},
135+
"annotations": {
136+
"prometheus.io/scrape": "true",
137+
"prometheus.io/port": "9102"
138+
}
139+
}
140+
141+
config = pulumi.Config('prometheus')
142+
statsd_chart_name = config.get('statsd_chart_name')
143+
if not statsd_chart_name:
144+
statsd_chart_name = 'prometheus-statsd-exporter'
145+
statsd_chart_version = config.get('statsd_chart_version')
146+
if not statsd_chart_version:
147+
statsd_chart_version = '0.3.1'
148+
helm_repo_name = config.get('prometheus_helm_repo_name')
149+
if not helm_repo_name:
150+
helm_repo_name = 'prometheus-community'
151+
helm_repo_url = config.get('prometheus_helm_repo_url')
152+
if not helm_repo_url:
153+
helm_repo_url = 'https://prometheus-community.github.io/helm-charts'
154+
155+
statsd_chart_ops = helm.ChartOpts(
156+
chart=statsd_chart_name,
157+
namespace=ns.metadata.name,
158+
repo=helm_repo_name,
159+
fetch_opts=FetchOpts(repo=helm_repo_url),
160+
version=statsd_chart_version,
161+
values=statsd_chart_values,
162+
transformations=[remove_status_field]
163+
)
164+
165+
statsd_chart = helm.Chart(release_name='statsd',
166+
config=statsd_chart_ops,
167+
opts=pulumi.ResourceOptions(provider=k8s_provider))

0 commit comments

Comments
 (0)