-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
1068 lines (893 loc) · 28.8 KB
/
index.html
File metadata and controls
1068 lines (893 loc) · 28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>WJUG: RED with Java and Prometheus/Alertmanager/Grafana</title>
<!-- bootstrap -->
<link rel="stylesheet" href="ext/bootstrap-4.0.0-beta/bootstrap.min.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/white.css">
<!-- Theme used for syntax highlighting of code -->
<!-- link rel="stylesheet" href="lib/css/zenburn.css" -->
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style>
.reveal section img {
background-color:white;
border:0;
box-shadow: 0 0 0 0;
}
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h3 style="text-transform: none !important;">How to monitor your micro-service<br />with Prometheus?</h1>
<!-- <br />How to design the metrics? -->
<img src="img/logo_prometheus.png" width="40%" />
<h6><small>W<span style="text-transform: lowercase;">ojciech</span> B<span style="text-transform: lowercase;">arczyński</span> - SMACC.<span style="text-transform: lowercase;">io</span> | <a href="https://www.linkedin.com/in/wojciechbarczynski/">LI</a> | <a href="https://twitter.com/wbarczynski">T<span style="text-transform: lowercase;">witter</span></a> | 16 O<span style="text-transform: lowercase;">ctober</span> 2018</small></h6>
</section>
<section>
<h3>About me</h3>
<p>
<ul>
<li>Lead Software Developer- SMACC (FinTech/AI)</li>
<li>Before:<br />System Engineer && Developer Lyke</li>
<li>Looking:<br />Tools for efficent and :) teams</li>
<!-- li>System Engineer background</li -->
<!-- li>Hobby:<br />teaching software engineering</li -->
</ul></p>
</section>
<section>
<h3>Point of view</h3>
<p>
<ul>
<li>Software Developer</li>
<li>startups && fast-moving environment</li>
<li>Infra and platform should just work</li>
<li>Infra and platform ~ invisible</li>
</ul>
</p>
</section>
<section>
<h3>My Goal</h3>
<p>
<ul>
<li>Start with monitoring</li>
<li>Metrics? Start with Up/Down -> USE || RED</li>
<li>Drop-in solution - Prometheus</li>
<li>How to start? With this demo app</li>
</ul></p>
</section>
<section>
<h3>Why?</h3>
<h4>Monolit ;) </h4>
<img src="img/rubber_duck_monolit.jpg" width="70%">
</section>
<section>
<h3>Why?</h3>
<h4>Microservices ;) </h4>
<img src="img/rubber_duck_microservices.jpg" width="70%">
</section>
<section>
<h4>Observability</h4>
<ul>
<li>Monitoring</li>
<li>Logging</li>
<li>Tracing</li>
</ul>
</section>
<!-- section>
<h4>Observability</h4>
<table class="table">
<thead>
<tr>
<th></th>
<th>Monitoring</th>
<th>Logging</th>
<th>Tracing</th>
</tr>
</thead>
<tbody>
<tr>
<td>Setup</td>
<td>Easy</td>
<td>Diff</td>
<td>Diff</td>
</tr>
<tr>
<td>TCO</td>
<td>Low</td>
<td>Very High</td>
<td>High</td>
</tr>
<tr>
<td>Debuging</td>
<td>Low</td>
<td>High</td>
<td>High</td>
</tr>
<tr>
<td>Detecting</td>
<td>High</td>
<td>Low</td>
<td>Low</td>
</tr>
</tbody>
</table>
</section -->
<section>
<h4>Observability</h4>
<img src="img/observability_capex_vs_opex_from_golang_prod_blog.png" width="80%" />
<small><a href="https://peter.bourgon.org/go-for-industrial-programming/">Go for Industrial Programming by Peter Bourgon</a></small>
</section>
<section>
<h3>Not a silver-bullet</h3>
<p>but:</p>
<ul>
<li>Easy to setup</li>
<li>Immediately value</li>
</ul>
<p>Suprisengly: the last one implemented</p>
</section>
<section>
<h3>Centralized Logging</h3>
<ul>
<li>Like a debugging vs testing</li>
<li>Usually much too late</li>
<li>Post-mortem</li>
<li>Hard to find the needle</li>
</ul>
</section>
<section>
<h3>Monitoring</h3>
<ul>
<li>Numbers</li>
<li>Trends</li>
<li>Dependencies</li>
<li>+ Actions</li>
</ul>
</section>
<section>
<h4>Metric</h4>
<table class="table">
<thead>
<tr>
<th style="text-align: center;">Name</th>
<th style="text-align: center;">Label</th>
<th style="text-align: center;">Value</th>
</tr>
</thead>
<tbody>
<tr class="success">
<td>traefik_requests_total</td>
<td>code="200", method="GET"</td>
<td>3001</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3>Monitoring</h3>
<img src="img/kubernetes-grafana-live-demo.png" width="90%" />
<p><small>Demo app</small></p>
</section>
<section>
<h3>Monitoring</h3>
<img src="img/kubernetes-grafana-cluster-1024x503.png" width="80%" />
<p><small>Example from <a href="https://blog.couchbase.com/wp-content/original-assets/december-2016/kubernetes-monitoring-with-heapster-influxdb-and-grafana/">couchbase blog</a></small></p>
</section>
<section>
<h4>How to find the right metric?</h4>
<!-- h5>
<ul>
<li>USE</li>
<li>RED</li>
</ul>
</h5 -->
</section>
<section>
<h4>How to find the right metric?</h4>
<h5>
<ul>
<li>USE</li>
<li>RED</li>
</ul>
</h5>
</section>
<section data-markdown>
<script type="text/template">
## USE
<table class="table">
<tbody>
<tr>
<td>**U**tilization</td>
<td>the average time that the resource was busy servicing work</td>
</tr>
<tr>
<td>**S**aturation</td>
<td>extra work which it can't service, often queued</td>
</tr>
<tr>
<td>**E**rrors</td>
<td>the count of error events</td>
</tr>
</tbody>
</table>
<small>Documented and Promoted by <a href="http://www.brendangregg.com/usemethod.html">Berdan Gregg</a></small>
<!-- Famous Shouting in the Datacenter - https://www.youtube.com/watch?v=tDacjrSCeq4 -->
</script>
</section>
<section data-markdown>
<script type="text/template">
## USE
- **U**tilization: as a percent over a time interval: "one disk is running at 90% utilization".
- **S**aturation:
- **E**rrors:
</script>
</section>
<section data-markdown>
<script type="text/template">
## USE
- **Utilization**:
- **Saturation**: as a queue length. eg, "the CPUs have an average run queue length of four".
- **Errors**:
</script>
</section>
<section data-markdown>
<script type="text/template">
## USE
- **utilization**:
- **saturation**:
- **errors**: scalar counts. eg, "this network interface drops packages".
</script>
</section>
<section data-markdown>
<script type="text/template">
## USE
- **traditionaly** more instance oriented
- still useful in the microservices world
</script>
</section>
<section data-markdown><!-- workload -->
<script type="text/template">
## RED
<table class="table">
<tbody>
<tr>
<td>**R**ate</td>
<td>How busy is your service?</td>
</tr>
<tr>
<td>**E**rror</td>
<td>Errors</td>
</tr>
<tr>
<td>**D**uration </td>
<td>What is the latency of my service?</td>
</tr>
</tbody>
</table>
<center><small> <a href="https://twitter.com/i/web/status/852341680946544640">Tom Wilkie's guideline for instrumenting applications</a>.</small></center>
</script>
</section>
<section data-markdown><!-- workload -->
<script type="text/template">
## RED
- **Rate** - how many request per seconds handled
- **Error**
- **Duration** (distribution)
</script>
</section>
<section data-markdown><!-- workload -->
<script type="text/template">
## RED
- **Rate**
- **Error** - how many request per seconds handled we failed
- **Duration**
</script>
</section>
<section data-markdown><!-- workload -->
<script type="text/template">
## RED
- **Rate**
- **Error**
- **Duration** - how long the requests took
</script>
</section>
<section data-markdown>
<script type="text/template">
## RED
- Follow Four Golden Signals by Google SREs [1]
- Focus on what matters for end-users
<center><small>[1] Latency, Traffic, Errors, Saturation (<a href="https://landing.google.com/sre/book/chapters/monitoring-distributed-systems.html">src</a>)</small></center>
</script>
</section>
<section data-markdown><!-- workload -->
<script type="text/template">
## RED
Not recommended for:
- batch-oriented
- streaming services
</script>
</section>
<section>
<h3>Prometheus</h3>
<img src="img/logo_prometheus.png" width="40%" />
<img src="img/logo_grafana.png" width="30%" />
</h3>
</section>
<section>
<h3>What prometheus is?</h3>
<ul>
<li>Aggregation of time-series data</li>
<li>Not an event-based system</li>
</ul>
</h3>
</section>
<section>
<h3>Prometheus stack</h3>
<ul>
<li>Prometheus - collect</li>
<li>Alertmanager - alerts</li>
<li>Grafana - visualize</li>
</ul>
</section>
<section data-markdown>
<script type="text/template">
## Prometheus
- Plain text
- Metrics collected over HTTP <a href="http://127.0.0.1:8080/prometheus">*metrics/*[1]</a>
- Pull model [2]
- Wide support for languages
- PromQL
- Integration with Kubernetes, Traefik, ...
<p><small>[1] most commmon, <i>prometheus</i> in Spring 1.5</small><br />
<small>[2] See *scrape time*, push-mode possible</small></p>
</script>
</section>
<section data-markdown>
<script type="text/template" width="100%">
### Metrics in plain text
<pre><code data-trim="" width="100%"># HELP order_mgmt_audit_duration_seconds Multiprocess metric
# TYPE order_mgmt_audit_duration_seconds summary
order_mgmt_audit_duration_seconds_count{status_code="200"} 41.0
order_mgmt_audit_duration_seconds_sum{status_code="200"} 27.445735454559326
order_mgmt_audit_duration_seconds_count{status_code="500"} 1.0
order_mgmt_audit_duration_seconds_sum{status_code="500"} 0.7166361808776855
# HELP order_mgmt_duration_seconds Multiprocess metric
# TYPE order_mgmt_duration_seconds summary
order_mgmt_duration_seconds_count{method="GET",path="/complex",status_code="200"} 41.0
order_mgmt_duration_seconds_sum{method="GET",path="/complex",status_code="200"} 47.53411388397217
order_mgmt_duration_seconds_count{method="GET",path="/",status_code="404"} 1.0
order_mgmt_duration_seconds_sum{method="GET",path="/",status_code="404"} 0.029236555099487305
order_mgmt_duration_seconds_count{method="GET",path="/complex",status_code="503"} 1.0
order_mgmt_duration_seconds_sum{method="GET",path="/complex",status_code="503"} 1.6936163902282715</code></pre>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Metrics in plain text
<pre><code data-trim="" width="100%"># HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 9.01e-05
go_gc_duration_seconds{quantile="0.25"} 0.000141101
go_gc_duration_seconds{quantile="0.5"} 0.000178902
go_gc_duration_seconds{quantile="0.75"} 0.000226903
go_gc_duration_seconds{quantile="1"} 0.006099658
go_gc_duration_seconds_sum 18.749046756
go_gc_duration_seconds_count 89273</code></pre>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Exporters
- Mongodb
- Mysql
- Postgresql
- Rabbitmq
- ...
- also Blackbox exporter
<p><small>Examples: <a href="https://github.com/skarab7/kubernetes-memcached">memcached</a>, [psql](https://github.com/justwatchcom/sql_exporter)</small></p>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Prometheus P<span style="text-transform: lowercase;">rom</span>QL
# working with historams:
histogram_quantile(0.9,
rate(http_req_duration_seconds_bucket[10m]))
# rates:
rate(http_requests_total{job="api-server"}[5m])
irate(http_requests_total{job="api-server"}[5m])
# more complex:
redict_linear()
holt_winters()
</script>
<!-- https://prometheus.io/docs/prometheus/latest/querying/functions/#holt_winters() -->
</section>
<section data-markdown>
<script type="text/template">
### Prometheus P<span style="text-transform: lowercase;">rom</span>QL
Alarming:
<pre><code>ALERT ProductionAppServiceInstanceDown
IF up { environment = "production", app =~ ".+"} == 0
FOR 4m
ANNOTATIONS {
summary = "Instance of {{$labels.app}} is down",
description = " Instance {{$labels.instance}} of app {{$labels.app}} has been down for more than 4 minutes"
}</code></pre>
</script>
<!-- "https://pracucci.com/prometheus-understanding-the-delays-on-alerting.html -->
<!-- https://prometheus.io/docs/prometheus/latest/querying/functions/#holt_winters() -->
</section>
<section>
<h3>Cloud-native projects integration</h3>
<img src="img/traefik_architecture.svg" width="80%"/>
<small> - --web.metrics.prometheus</small>
</section>
<!--
-->
<section data-markdown>
<script type="text/template">
### Metrics
- Counter - just up
- Gauge - up/down
- Histogram
- Summary
</script>
</section>
<section data-markdown>
<script type="text/template">
#### Histogram
<code>traefik_duration_seconds_bucket<br />{method="GET,code="200"}</code>
<table class="table">
<tbody>
<tr>
<td>{le="0.1"}</td>
<td>2229</td>
</tr>
<tr>
<td>{le="0.3"}</td>
<td>107</td>
</tr>
<tr>
<td>{le="1.2"}</td>
<td>100</td>
</tr>
<tr>
<td>{le="5"}</td>
<td>4</td>
</tr>
<tr>
<td>{le="+Inf"}</td>
<td>2</td>
</tr>
<tr>
<td>_sum</td>
<td></td>
</tr>
<tr>
<td>_count</td>
<td>2342</td>
</tr>
</tbody>
</table>
</script>
</section>
<!-- A Summary similar to histogram_quantile() -->
<section data-markdown>
<script type="text/template">
#### Summary
<code>http_request_duration_seconds</code>
<table class="table">
<tbody>
<tr>
<td>{quantile="0.5"}</td>
<td>4</td>
</tr>
<tr>
<td>{quantile="0.9"}</td>
<td>5</td>
</tr>
<tr>
<td>http_request_duration_seconds_sum</td>
<td>9</td>
</tr>
<tr>
<td>http_request_duration_seconds_count</td>
<td>3</td>
</tr>
</tbody>
</table>
</script>
</section>
<!--
https://godoc.org/github.com/prometheus/client_golang/prometheus#Histogram
https://godoc.org/github.com/prometheus/client_golang/prometheus#Summary
https://github.com/prometheus/client_java/blob/master/simpleclient/src/main/java/io/prometheus/client/Summary.java#L61-L63
https://povilasv.me/prometheus-tracking-request-duration/
-->
<section data-markdown>
<script type="text/template">
### Histogram / Summary:
- Latency of services
- Request or Request size
Histograms recommended
</script>
</section>
<!--
rate(order_mgmt_audit_duration_seconds_sum[5m])/ rate(order_mgmt_audit_duration_seconds_count[5m])
-->
<!--
http://127.0.0.1:9090/graph?g0.range_input=1h&g0.stacked=1&g0.expr=rate(order_mgmt_audit_duration_seconds_sum%5B5m%5D)%2F%20rate(order_mgmt_audit_duration_seconds_count%5B5m%5D)&g0.tab=0
-->
<section data-markdown>
<script type="text/template">
### RED
Metric + PromQL:
sum(irate(order_mgmt_duration_seconds_count
{job=~".*"}[1m])) by (status_code)
</script>
</section>
<section data-markdown>
<script type="text/template">
### Metric and Label Naming
Best practises on <a target="_blank" href="https://prometheus.io/docs/practices/naming/">metric names</a>:
- service name is your prefix `user_`
- state the bae unit `_seconds` and `_bytes`
</script>
</section>
<!-- section data-markdown>
<script type="text/template">
### Metrics
Histogram / Summary:
- sum <code>_sum</code>
- count <code>_count</code>
- count / sum per bucket
</script>
</section -->
<section>
<h3>Prometheus + Java</h3>
<img src="img/logo_prometheus.png" width="30%" />
<img src="img/logo_grafana.png" width="20%" />
<img src="img/logo_java.png" width="20%" />
</h3>
</section>
<section data-markdown>
<script type="text/template">
### Java client
- <a target="_blank" href="https://github.com/prometheus/client_java">client_python</a>
- <a target="_blank" href="https://github.com/prometheus/client_java#counter">Counter</a>
- <a target="_blank" href="https://github.com/prometheus/client_java#gauge">Gauge</a>
- <a target="_blank" href="https://github.com/prometheus/client_java#summary">Summary</a>
- <a target="_blank" href="https://github.com/prometheus/client_java#histogram">Histogram</a>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Java
- Sprint 1.5 - demo
- Sprint 2.x - wrapper with <code>io.micrometer.core</code>
- JMX exporter -<br />https://github.com/prometheus/jmx_exporter
</script>
</section>
<section data-markdown>
<script type="text/template">
#### Demo: Simple REST service
<pre><code>
----------- ---------------
| App | ----->| Audit Service |
| OrderMgmt | | |
----------- ---------------
|
| ---------------
-------->| Database |
---------------</code></pre>
</script>
</section>
<section data-markdown>
<script type="text/template">
#### Demo:
- <a target="_blank" href="http://127.0.0.1:8080/hello">http://127.0.0.1:8080/hello</a> - service
- <a target="_blank" href="http://127.0.0.1:8080/prometheus/">http://127.0.0.1:8080/prometheus/</a>
- <a target="_blank" href="http://127.0.0.1:9090">http://127.0.0.1:9090</a> - prometheus
- <a target="_blank" href="http://127.0.0.1:3000">http://127.0.0.1:3000</a> - grafana
- <a target="_blank" href="http://127.0.0.1:9093">http://127.0.0.1:9093</a> - alertmanager
</script>
</section>
<section data-markdown>
<script type="text/template">
#### Demo
<pre><code class="bash" data-trim="" width="100%">☁ demo ⚡ make start
☁ demo ⚡ docker ps
CONTAINER ID IMAGE PORTS NAMES
5f824d1bc789 grafana/grafana:5.2.2 0.0.0.0:3000->3000/tcp java-prom_grafana_1
d681a414a8b6 prom/prometheus:v2.1.0 0.0.0.0:9090->9090/tcp java-prom_prometheus_1
ea0d9233e159 prom/alertmanager:v0.15.1 0.0.0.0:9093->9093/tcp java-prom_alertmanager_1
732c59fb3753 java-prom_order-manager 0.0.0.0:8080->8080/tcp java-prom_order-manager_1
</code></pre>
</script>
</section>
<section data-markdown>
<script type="text/template">
<h3>Demo: generate calls</h3>
<pre><code class="bash" data-trim="" width="100%">
☁ demo ⚡ make srv_wrk_random
</code></pre>
<p><small>With error injection</small></p>
</script>
</section>
<section data-background="img/demo/metrics.png" data-background-repeat="" data-background-size="100%">
</section>
<section>
<h5>Grafana</h5>
<img src="img/kubernetes-grafana-live-demo.png" width="90%" />
</section>
<section>
<h5>Prometheus </h5>
<img src="img/demo/prometheus_1.png" width="90%" />
</section>
<section>
<h5>Prometheus </h5>
<img src="img/demo/prometheus_2.png" width="90%" />
</section>
<section>
<h5>Prometheus </h5>
<img src="img/demo/prometheus_3_alerts.png" width="90%" />
</section>
<section data-markdown>
<script type="text/template">
<h3>Kill the service</h3>
<pre><code class="bash" data-trim="" width="100%">
☁ demo ⚡ docker stop java-prom_order-manager_1
</code></pre>
</script>
</section>
<section>
<h5>Prometheus</h5>
<img src="img/demo/prometheus_4_alerts.png" width="90%" />
</section>
<section>
<h5>Prometheus</h5>
<img src="img/demo/prometheus_5_alerts.png" width="90%" />
</section>
<section>
<h5>Alertmanager</h5>
<img src="img/demo/alertmanager_1.png" width="90%" />
</section>
<section>
<h5>Grafana</h5>
<img src="img/demo/grafana_1.png" width="90%" />
</section>
<section>
<h5>Grafana</h5>
<img src="img/demo/grafana_2.png" width="90%" />
</section>
<section>
<h5>Github</h5>
<img src="img/demo/github.png" width="70%" />
</section>
<!-- section data-markdown>
<script type="text/template">
### Demo: Java Code
- Metric Definition
</script>
</section -->
<!-- section data-markdown>
<script type="text/template">
#### Demo: Simulating Calls
<pre><code class="bash" data-trim="" width="100%">make docker_build
make docker_run</code></pre>
</script>
</section -->
<!-- section data-markdown>
<script type="text/template">
#### Demo: Simulating Calls
<pre><code class="bash" data-trim="" width="100%">curl 127.0.0.1:8080/hello
curl 127.0.0.1:8080/world
curl 127.0.0.1:8080/complex</code></pre>
</script>
</section -->
<!-- section data-markdown>
<script type="text/template">
#### Demo: Simulating Calls
<pre><code class="bash" data-trim="" width="100%">
curl 127.0.0.1:8080/complex?is_srv_error=True
curl 127.0.0.1:8080/complex?is_db_error=True
curl 127.0.0.1:8080/complex?db_sleep=3&srv_sleep=2
# load generator
make srv_wrk_random</code></pre>
</script>
</section -->
<section data-markdown>
<script type="text/template">
### Demo
Everything Included:
- Prometheus dashboard and config
- AlertManager dashboard and config
- Simulate the successful and failed calls
- Examples of queries for rate
</script>
</section>
<!-- section data-markdown>
<script type="text/template">
### P<span style="text-transform: lowercase;">rom</span>QL
<pre><code class="yaml" data-trim="" width="100%">
sum(irate(order_mgmt_duration_seconds_count{job=~".*"}[1m]))
by (status_code)</pre></code>
</script>
</section -->
<!-- section data-markdown>
<script type="text/template">
### P<span style="text-transform: lowercase;">rom</span>QL
<pre><code class="yaml" data-trim="" width="100%">
order_mgmt_duration_seconds_sum{job=~".*"} or
order_mgmt_database_duration_seconds_sum{job=~".*"} or
order_mgmt_audit_duration_seconds_sum{job=~".*"}</code></pre>
</script>
</section -->
<!-- section data-markdown>
<script type="text/template">
### Next steps
- Extend the sample application with OpenZipkin
- In daily work, evaluating new: <a>linkerd.io</a>, <a>istio.io</a>, ...
</script>
</section -->
<section>
<h3>Best practises</h3>
<ul>
<li>Start simple (up/down), later add more complex rules</li>
<li>Sum over Summaries with Q leads to incorrect results, see <a target="_blank" href="https://prometheus.io/docs/practices/histograms/">prom docs</a></li>
</ul>
</section>
<section>
<h3>Summary</h3>
<ul>
<li>Monitoring saves your time</li>
<li>Checking logs == debuging vs having tests</li>
<li>Logging -> high TCO</li>
</ul>
</section>
<section>
<h3>Summary</h3>
<img src="img/observability.svg" width="80%">
</section>
<section data-background="img/smacc_header_IT_source.jpg" data-background-repeat="" data-background-size="100%" data-background-position="bottom" style="position: relative; top:0">
<h1>Thank you</h1>
</section>
<section data-background="img/smacc_header_IT_source.jpg" data-background-repeat="" data-background-size="100%" data-background-position="bottom"
style="position: relative; top:0">
<h4>Questions?</h4>
<p>ps. We are hiring.</p><!-- Developers, Frontend, System Engineers -->
</section>
<section>
<img src="img/logo_smacc.png" width="40%" />
<img src="img/logo_go.png" width="25%" />
<img src="img/logo_python.png" width="25%" />
<img src="img/logo_pytorch.png" width="20%" />
<img src="img/logo_tensorflow.png" width="25%" />
<img src="img/logo_kubernetes.svg" width="10%" />
<img src="img/logo_openapi.png" width="10%" />
<img src="img/logo_aws.png" width="20%" />
<img src="img/logo_azure.png" width="15%" />
<img src="img/logo_lambda.png" width="15%" />
<img src="img/smacc_lets_do_this.png" width="25%" />
</section>
<!--
BACKUP SLIDES
-->
<section data-background="img/smacc_header_IT_source.jpg" data-background-repeat="" data-background-size="100%" data-background-position="bottom" style="position: relative; top:0">
<h1>Backup Slides</h1>
</section>
<section data-markdown>
<script type="text/template">
### Prometheus - Push model
- See: https://prometheus.io/docs/instrumenting/pushing/
Good for short living jobs in your cluster.
</script>
</section>
<section data-markdown>
<script type="text/template">
### Designing metric names
Which one is better?
- request_duration{app=my_app}
- my_app_request_duration
<p><small>see documentation on best practises for <a href="https://prometheus.io/docs/practices/naming/">metric naming</a> and <a href="https://prometheus.io/docs/practices/instrumentation/#instrumentation">instrumentation</a></small></p>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Designing metric names
Which one is better?
- order_mgmt_db_duration_seconds_sum
- order_mgmt_duration_seconds_sum{dep_name='db'}
</script>
</section>
<section>
<h2>Prometheus + K8S = <3</h2>
<h5>Labels are propagated from k8s to prometheus</h5>
</section>
<section>
<h5>Integration with Prometheus</h5>
<small><code>cat memcached-0-service.yaml</code></small><pre><code class="yaml" data-trim="" width="100%">---
apiVersion: v1
kind: Service
metadata:
name: memcached-0
labels:
app: memcached
kubernetes.io/name: "memcached"
role: shard-0
annotations:
prometheus.io/scrape: "true"
prometheus.io/scheme: "http"