Enroll Course

100% Online Study
Web & Video Lectures
Earn Diploma Certificate
Access to Job Openings
Access to CV Builder



online courses

PromQL for Beginners

Programming . 

The language mentioned in the title is the query language for the Prometheus monitoring system. Many people use it to make queries for alerts, graphs, and time series. It is popular because it is unique from other query languages like Flux, InfluxQL, or SQL.

That means that the language is more straightforward to work with. However, it also means that there can be a steep learning curve, especially for beginners. Here are some things you can quickly learn to do with this language. 

Select a Time Series

Using PromQL to select a time series is incredibly easy. All you have to do is type in the series name. From there, you can type in what information you want to return with the query. Then, the program can filter through the information and produce data with different labels. It does this automatically. 

Filter by Label

As mentioned, you will receive information from your online research queries with different labels. Another straightforward thing to do with this language is filter them. You must add the tag you want to see in your series query. You can also use the same idea to exclude specific labels. 

Filter by Multiple Labels

You can also combine label filters. For instance, you can filter the results by a label starting with a specific letter. You filter with multiple tags using "and" between these on your query. If you have experience working with other languages, you might wonder if you can use "or" in your search. Currently, you cannot. However, there are alternatives that you can learn. 

Filter by Metric Name

You might want to return all the data for a particular metric name. Metric names are ordinary labels with unique names. This language uses regex to filter multiple metric names. Otherwise, metric names will not be sorted. 

Compare Current and Historical Data

This language allows you to compare current data with historical information. All you have to do is add "offset" to your query. That can let you go back a week or more and compare data. Then, you can reach data points by setting certain limits. 

Calculate Rates

Specific data points can return constantly growing lines. While graphs are important, ones that are continually increasing are often unhelpful because they are hard to read. However, this language offers a solution by calculating rates. It can calculate per-second rates for any time series query.

Rate With Counters 

Using rate strips data points of their metric names and leaves labels for time series. Therefore, you should not apply the rate function to time series that can go up and down. These are called gauges. Instead, it would be best if you only used the rate function to counters, which are time series that only go up. 

Arithmetic Operations

This language allows you to use all basic arithmetic operations, including:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Percentage

That makes it easier for you to perform a variety of conversions. For example, you can convert data from bytes to bits. 

Comparison Operations

It also allows you to compare data by seeing what is equal, not equal, more significant, greater or equal, less, and less or equal. You apply these to data just like you would regular arithmetic operations. The result that you will receive is only data that matches the comparison you've provided. For instance, if you search for results less than a specific value, you will exclude all of the data equal to or greater than your chosen value. 

This is an easy language to work with. It makes writing queries much more straightforward than in other languages. Once you learn the functions in this tutorial, you can move on to more complex features. It may not cover every aspect you want to do in a time series query like SQL does. However, it is powerful enough that you will likely not experience any complications from using it if you are a beginner. As you get more advanced, you might consider purchasing a more robust language. 

SIIT Courses and Certification

Full List Of IT Professional Courses & Technical Certification Courses Online
Also Online IT Certification Courses & Online Technical Certificate Programs