Promql
Data Models and Lablse
Metrics Names
Specyige the general feature of system taht is mesaured(http_request_toatl)Metrics Lables
Enable Prometheus dimensional data modle to ideentyfie any given combination of labes for the same metiric anem- Can’t use __ resrved for the internal testing
DataTypes
Stirng
Scalar
intVectors
Instant vector
(One value )- Every 30s
[30]
- Every 30s
Range vectors
(Multiples values)- From yesterday to now
-
Counter
(sotres a metric that will increase over time and total amount of them)- If metrics is a
total
then this iscounter
- Example: alter_menager_recived_total
- shoudln’t be used for decrease
- Returns
Instant Vector
- Examples request count or error count
total number of the metrics over desired period
bash rate(counter_name [last_period_of_time])
increase
(how much a counter has gone up over a certain period of time)- Imagine you have a counter for disk flush requests: At the start of the day, the counter is at 100. By the end of the day, it’s at 300. The increase is 200
Gauge
(metrics that go up and down)- Cpu Usage,memory usage ,response time
- Usually an input to the agregaitng functions like avrage over time
- If metrics is a
Hisotgram
put data in a specyfic buckets(has to be predefined)- Stores total number of metrics
- Sum of values
- If metrics is a
bucket
then this ishistogram
- Example: prometheus_http_response_size_bytes_bucket
-
Better visualisation
- predefined functions for procentails
Summery
(if u don’t know the exact value of the buckets) - Response times - Respnse size - Bytes exchanged - ReadIO ## Filters - Based on labels
- Stores total number of metrics
Rates and Derivities
rate()
Stable increase of vector irate()
The same as vecotrs unless
spikes derive
desinged to show changes more for an aletr then the
daschboard
Cpu usage over the last cpu
Aggregation over dimmesions
- lables add dimension to the dataset http_request_total has 3 lables application instance grouop**
- Get all the labes
- Exclude instaces
- or based on another group
Timestamps Metrics
timestamps
are given in epoch time
and can be queried for instant
vector - How fresh the data is
# So this will give u the raw data to
timestamp(go_memstat_frees_total)
# To get human readable time use
time() - timestamp(go_memstat_frees_total)