Skip to Content
Prometheus: Up & Running, 2nd Edition
book

Prometheus: Up & Running, 2nd Edition

by Julien Pivotto, Brian Brazil
May 2025
Beginner to intermediate
418 pages
6h 18m
Korean
O'Reilly Media, Inc.
Content preview from Prometheus: Up & Running, 2nd Edition

13장. PromQL 소개

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

PromQL은 프로메테우스 쿼리 언어입니다. QL로 끝나지만, 시계열에서 수행하려는 계산의 종류에 관해서는 SQL 언어가 표현력이 부족한 경향이 있기 때문에 SQL과 같은 언어는 아닙니다.

레이블은 PromQL의 핵심 부분으로, 임의의 집계를 수행하는 데 사용할 수 있을 뿐만 아니라 서로 다른 메트릭을 결합하여 산술 연산을 수행하는 데에도 사용할 수 있습니다. 예측부터 날짜 및 수학 함수까지 다양한 함수를 사용할 수 있습니다.

이 장에서는 집계, 기본 유형, HTTP API 등 PromQL의 기본 개념에 대해 소개합니다.

집계 기본 사항

몇 가지 간단한 집계 쿼리부터 시작해 보겠습니다. 이러한 쿼리는 PromQL을 사용할 수 있는 대부분의 잠재적 용도를 다룰 것입니다. PromQL은 가능한 한 강력하지만,1 대부분의 경우 요구 사항은 상당히 간단할 것입니다.

게이지

게이지란 상태의 스냅샷으로, 일반적으로 게이지를 집계할 때 합계, 평균, 최소값 또는 최대값을 취합니다.

마운트된 각 파일시스템의 크기를 보고하고 device,fstype, mountpoint 레이블이 있는 노드 익스포터에서 node_filesystem_size_bytes 메트릭을 살펴보세요. 를 사용하여 각 머신의 총 파일시스템 크기를 계산할 수 있습니다:

sum without(device, fstype, mountpoint)(node_filesystem_size_bytes)

withoutsum 애그리게이터에게 이 세 가지를 무시하고 동일한 레이블로 모든 것을 합산하도록 지시합니다. 따라서 시계열이 있다면

node_filesystem_free_bytes{device="/dev/sda1",fstype="vfat", instance="localhost:9100",job="node",mountpoint="/boot/efi"} 70300672 node_filesystem_free_bytes{device="/dev/sda5",fstype="ext4", instance="localhost:9100",job="node",mountpoint="/"} 30791843840 node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run"} 817094656 node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run/lock"} 5238784 node_filesystem_free_bytes{device="tmpfs",fstype="tmpfs", instance="localhost:9100",job="node",mountpoint="/run/user/1000"} ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Prometheus: Up & Running, 2nd Edition

Prometheus: Up & Running, 2nd Edition

Julien Pivotto, Brian Brazil
Mastering Prometheus

Mastering Prometheus

William Hegedus
Argo CD: Up and Running

Argo CD: Up and Running

Andrew Block, Christian Hernandez
Kubernetes: Up and Running, 3rd Edition

Kubernetes: Up and Running, 3rd Edition

Brendan Burns, Joe Beda, Kelsey Hightower, Lachlan Evenson

Publisher Resources

ISBN: 9798341654181