Skip to content

Commit fd8dc84

Browse files
committed
Code for step 5
1 parent 6c6f811 commit fd8dc84

9 files changed

+4271
-0
lines changed

docker-compose.yml

+38
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,45 @@ services:
3535
POSTGRES_PASSWORD: postgres
3636
POSTGRES_USER: postgres
3737

38+
grafana:
39+
image: grafana/grafana:6.3.3
40+
depends_on:
41+
- prometheus
42+
ports:
43+
- '3000:3000'
44+
volumes:
45+
- grafana-data:/var/lib/grafana
46+
- ./docker/grafana/:/etc/grafana/provisioning/
47+
env_file:
48+
- ./docker/grafana/.env
49+
50+
prometheus:
51+
image: prom/prometheus:v2.11.2
52+
ports:
53+
- '9090:9090'
54+
volumes:
55+
- ./docker/prometheus/:/etc/prometheus/
56+
- prometheus-data:/prometheus
57+
command:
58+
- '--config.file=/etc/prometheus/config.yml'
59+
- '--storage.tsdb.path=/prometheus'
60+
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
61+
- '--web.console.templates=/usr/share/prometheus/consoles'
62+
63+
postgres_exporter:
64+
image: wrouesnel/postgres_exporter:v0.5.1
65+
ports:
66+
- '9187:9187'
67+
depends_on:
68+
- postgres
69+
environment:
70+
DATA_SOURCE_USER: postgres
71+
DATA_SOURCE_PASS: postgres
72+
DATA_SOURCE_URI: postgres:5432/?sslmode=disable
73+
3874
volumes:
3975
elixir-deps: {}
4076
elixir-build: {}
4177
postgres-data: {}
78+
prometheus-data: {}
79+
grafana-data: {}

docker/grafana/.env

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GF_SECURITY_ADMIN_PASSWORD=admin
2+
GF_USERS_ALLOW_SIGN_UP=false
3+
GF_INSTALL_PLUGINS=grafana-worldmap-panel
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{
2+
"annotations": {
3+
"list": [
4+
{
5+
"builtIn": 1,
6+
"datasource": "-- Grafana --",
7+
"enable": true,
8+
"hide": true,
9+
"iconColor": "rgba(0, 211, 255, 1)",
10+
"name": "Annotations & Alerts",
11+
"type": "dashboard"
12+
}
13+
]
14+
},
15+
"description": "Dashboard for application specific Statistics.",
16+
"editable": true,
17+
"gnetId": null,
18+
"graphTooltip": 1,
19+
"links": [],
20+
"panels": [
21+
{
22+
"cards": {
23+
"cardPadding": null,
24+
"cardRound": null
25+
},
26+
"color": {
27+
"cardColor": "#b4ff00",
28+
"colorScale": "sqrt",
29+
"colorScheme": "interpolateOranges",
30+
"exponent": 0.5,
31+
"mode": "spectrum"
32+
},
33+
"dataFormat": "tsbuckets",
34+
"datasource": "prometheus",
35+
"description": "Within what radius are users commonly searching",
36+
"gridPos": {
37+
"h": 12,
38+
"w": 24,
39+
"x": 0,
40+
"y": 0
41+
},
42+
"heatmap": {},
43+
"hideZeroBuckets": true,
44+
"highlightCards": true,
45+
"id": 4,
46+
"legend": {
47+
"show": false
48+
},
49+
"options": {},
50+
"reverseYBuckets": false,
51+
"targets": [
52+
{
53+
"expr": "sum(increase(elixir_app_radius_search_bucket[5m])) by (le)",
54+
"format": "heatmap",
55+
"instant": false,
56+
"legendFormat": "{{ le }}",
57+
"refId": "A"
58+
}
59+
],
60+
"timeFrom": null,
61+
"timeShift": null,
62+
"title": "Zip code search radius",
63+
"tooltip": {
64+
"show": true,
65+
"showHistogram": false
66+
},
67+
"type": "heatmap",
68+
"xAxis": {
69+
"show": true
70+
},
71+
"xBucketNumber": null,
72+
"xBucketSize": null,
73+
"yAxis": {
74+
"decimals": null,
75+
"format": "lengthmi",
76+
"logBase": 1,
77+
"max": null,
78+
"min": null,
79+
"show": true,
80+
"splitFactor": null
81+
},
82+
"yBucketBound": "auto",
83+
"yBucketNumber": null,
84+
"yBucketSize": null
85+
},
86+
{
87+
"circleMaxSize": "10",
88+
"circleMinSize": "2",
89+
"colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"],
90+
"datasource": "prometheus",
91+
"decimals": 0,
92+
"description": "Within what zip codes are users commonly searching",
93+
"esMetric": "Count",
94+
"gridPos": {
95+
"h": 16,
96+
"w": 24,
97+
"x": 0,
98+
"y": 12
99+
},
100+
"hideEmpty": false,
101+
"hideZero": false,
102+
"id": 2,
103+
"initialZoom": "7",
104+
"locationData": "table",
105+
"mapCenter": "custom",
106+
"mapCenterLatitude": "47.4",
107+
"mapCenterLongitude": "-120.7401",
108+
"maxDataPoints": 1,
109+
"mouseWheelZoom": true,
110+
"options": {},
111+
"showLegend": false,
112+
"stickyLabels": false,
113+
"tableQueryOptions": {
114+
"geohashField": "geohash",
115+
"labelField": "zip_code",
116+
"latitudeField": "latitude",
117+
"longitudeField": "longitude",
118+
"metricField": "Value",
119+
"queryType": "geohash"
120+
},
121+
"targets": [
122+
{
123+
"expr": "elixir_app_zip_code_search",
124+
"format": "table",
125+
"instant": true,
126+
"refId": "A"
127+
}
128+
],
129+
"thresholds": "0,10",
130+
"timeFrom": null,
131+
"timeShift": null,
132+
"title": "Zip code search map",
133+
"type": "grafana-worldmap-panel",
134+
"unitPlural": "",
135+
"unitSingle": "",
136+
"valueName": "total"
137+
}
138+
],
139+
"refresh": "5s",
140+
"schemaVersion": 19,
141+
"style": "dark",
142+
"tags": [],
143+
"templating": {
144+
"list": []
145+
},
146+
"time": {
147+
"from": "now-1h",
148+
"to": "now"
149+
},
150+
"timepicker": {
151+
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
152+
},
153+
"timezone": "",
154+
"title": "Brewery Search",
155+
"uid": "vuTsSjdWk",
156+
"version": 3
157+
}

0 commit comments

Comments
 (0)