Skip to content

Commit 7fba5d9

Browse files
committed
como funciona Prometheus addded
1 parent f84c2ee commit 7fba5d9

3 files changed

Lines changed: 139 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Comprendiendo cómo funciona Prometheus
2+
3+
## Explorando la Arquitectura de Prometheus
4+
5+
Las cosas pueden salir mal en muchos niveles. Para reaccionar ante ese tipo de situaciones, necesita una solución de monitoreo y alerta que rastree métricas y vea tendencias antes de que suceda algo realmente malo.
6+
7+
Y eso es lo que Prometheus precisamente nos da, una herramienta de monitorización `open-source`.
8+
9+
> Mostrar diagrama
10+
11+
* `Prometheus` es una aplicación para ejecutar en un servidor.
12+
* `Scheduler` recoge métricas.
13+
* Las métricas se almacenan en una `time series database` que se ejecuta en el mismo servidor.
14+
* Expone una `API`
15+
* Expone una `Web UI`
16+
* Sistema de alertas.
17+
18+
## ¿Qué hace a prometheus diferente?
19+
20+
La forma en que toma `Prometheus` las métricas de los distintos sistemas sólo precisa de un `exporter`.
21+
22+
El `exporter` provee todas la mátricas en un `endpoint`. `Prometheus` coge esas métricas de los distintos endpoints.
23+
24+
`Prometheus` no se preocupa del `exporter`, sólo de recuperar las métricas en un formato estandar.
25+
26+
Los componentes que monitoriza `Prometheus` pueden ser distintos entre si, y las cosas que queremos monitorizar serán distintas. `Prometheus` provee una capa de consistencia para la monitorización.
27+
28+
> El proceso de exportar y recolectar métricas es el mismo para todos ellos.
29+
30+
### Ejemplos
31+
32+
```
33+
# HELP node_filefd_allocated File descriptor statistics: allocated.
34+
# TYPE node_filefd_allocated gauge
35+
node_filefd_allocated 1184
36+
```
37+
38+
```
39+
# HELP node_disk_io_time_seconds_total Total seconds spent foing I/Os.
40+
# TYPE node_disk_io_time_seconds_total counter
41+
node_disk_io_time_seconds_total{device="sda"} 104.296
42+
```
43+
44+
```
45+
# HELP process_cpu_seconds_total Total user and system CPU time.
46+
# TYPE process_cpu_seconds_total counter
47+
process_cpu_seconds_total 5.23
48+
```
49+
50+
## Client Libraries
51+
52+
* Java
53+
* GO
54+
* Nodejs
55+
* Python
56+
* Elixir
57+
* .NET
58+
* ....
59+
60+
## Tipos de Métricas
61+
62+
### Counter
63+
64+
Un `Counter` es un tipo de métrica que siempre aumenta.
65+
66+
```
67+
http_requests_total 1000000
68+
cpu_seconds_total 3000
69+
@ 22:00
70+
```
71+
72+
```
73+
http_requests_total 970000
74+
cpu_seconds_total 3000
75+
@ 21:00
76+
```
77+
78+
```
79+
http_requests_total - http_requests_total offset 1h = 30000
80+
```
81+
82+
### Gauge
83+
84+
El `Gauge` es un tipo de métrica que toma un `snapshot` the un valor cambiante.
85+
86+
```
87+
http_requests_active 2000
88+
memory_allocated_bytes 4.832e+09
89+
```
90+
91+
```
92+
http_requests_active 900
93+
memory_allocated_bytes 3.642e+09
94+
```
95+
96+
```
97+
memory_allocated_bytes / (1024*1024*1024) = 4.5 # gigabytes
98+
```
99+
100+
### Summary
101+
102+
El `Summary` es un tipo de métrica que sirve para tomar el tamaño medio de algo.
103+
104+
Es una métrica que presenta dos tipos de información:
105+
106+
* `count` - el número de veces que ha ocurrido el evento
107+
* `sum` - la suma de todos los eventos
108+
109+
```
110+
calculation_seconds_count 3
111+
calculation_seconds_sum 15
112+
@ 21:00
113+
```
114+
115+
```
116+
calculation_seconds_count 10
117+
calculation_seconds_sum 113
118+
@ 21:01
119+
```
120+
121+
122+
### Histogram
123+
124+
El `Histogram` guarda los datos en `buckets`, el valor devuelto es la cuenta de eventos por cada `bucket`
125+
126+
```
127+
calculation_seconds_bucket{le="1"} 0
128+
calculation_seconds_bucket{le="5"} 3
129+
calculation_seconds_bucket{le="10"} 6
130+
calculation_seconds_bucket{le="20"} 9
131+
calculation_seconds_bucket{le="60"} 10
132+
```
133+
134+
Se incluye el total de eventos en el bucket con label `+Inf`
135+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Nodejs Client Library
2+
3+
Los ejemplos

06-monitoring/diagrams.drawio

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mxfile host="app.diagrams.net" modified="2022-01-16T17:31:55.067Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" etag="MtsbZk8y8blsvG723iu6" version="16.2.4" type="device"><diagram id="Fikdp2nAoaiWym19B8Rx" name="Page-1">5Zpbc6s2EIB/jR/xGMkY+zEX5zTT0zbTTKYnT4wMMlaDESPJt/z6rkCYmxPIqS9tkszE1mrRZfeTVivSwzfL7TdBksVvPKBRDw2CbQ/f9hCykWPDh5bsMonrGkEoWGCUCsEje6VGODDSFQuorCgqziPFkqrQ53FMfVWRESH4pqo251G114SEtCF49EnUlP7FArXIpGNnUMh/oSxc5D3bA1OzJLmyEcgFCfimJMLTHr4RnKvs23J7QyNtvNwu2XN3b9TuByZorLo8MJ5+e8K/89ng+cfzr39u7sf4lVjjrJU1iVZmwmawapdbQPBVHFDdiN3D15sFU/QxIb6u3YDPQbZQy8hUz1kU3fCICyjHPAala9MDFYpu3xy6vTcIkET5kiqxA5X8AdfJHjEQTYxJN4VHnNzui6o3DAmGgnDfdGEo+GJs9QG72e12ky9U+Xp0AzBCwlmsqJiuYcbS2GoPhFYIiFykRh5UDSqV4C+0ZtKylXsIOwP9C/KIzGj0wCVTjMdQ51PdKVRo6zOA+ntNYcaV4suSwlXEQl2huHYsX6mIxdB7vrZ0J8So7BuHeSR6zsttqPeAPp/PmU/7sCJ9mijZ9yPuvxwHBJR7eZfvL3bfabAwdJoo5LKjk4A+SAKRSWbLOdtqhx8ZjWMj0PD2W+zVKVhKn9B++lQimKT9gCgyI5J6IY2pYP4RcMCdcMBuEwfnVBvDsAMOxlJsmcaesksP+6DVdanTr4n/Eqabdck98/QHVNLOrnL2DoJoxnO7UEoH1yttCHTnBzHqM1jMcwZhQMCyXoJUOxM+tFxqJb5MqIJx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