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

12장. 내보내기 작성

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

애플리케이션에 직접 계측 기능을 추가할 수 없거나 이를 지원하는 기존 내보내기를 찾을 수 없는 경우가 있습니다. 이 경우 내보내기를 직접 작성해야 합니다. 좋은 소식은 내보내기는 비교적 쉽게 작성할 수 있다는 것입니다. 어려운 부분은 애플리케이션에서 노출되는 메트릭이 무엇을 의미하는지 파악하는 것입니다. 단위를 알 수 없는 경우가 많고, 문서가 있더라도 모호할 수 있습니다. 이 장에서는 내보내기를 작성하는 방법을 배웁니다.

컨설턴트 원격 측정

이 프로세스를 시연하기 위해 Consul용 작은 내보내기를 작성해 보겠습니다. 이미'Consul'에서 Consul과 Consul 내보내기를 살펴봤으므로 원격 분석 API의 메트릭을 사용하여 간단한 내보내기를 만들어 보겠습니다.1

어떤 프로그래밍 언어로도 내보내기를 작성할 수 있지만, 대부분은 Go로 작성되어 있으며 여기서는 이 언어를 사용합니다. 그러나 Python으로 작성된 내보내기는 소수에 불과하며, Java로 작성된 내보내기는 더 적은 수입니다.

컨설턴트가 실행 중이 아니라면 예 8-8의 지침에 따라 다시 시작하세요.http://localhost:8500/v1/agent/metrics 을 방문하면 예제 12-1과 유사한 작업할 JSON 출력을 볼 수 있습니다. 편리하게도 Consul은 사용할 수 있는 Go 라이브러리를 제공하므로 JSON을 직접 파싱하는 것에 대해 걱정할 필요가 없습니다.

예 12-1. 상담원 상담원의 메트릭 출력의 축약된 예제 출력
{
  "Timestamp": "2018-01-31 14:42:10 +0000 UTC",
  "Gauges": [
    {
        "Name": "consul.autopilot.failure_tolerance",
        "Value": 0,
        "Labels": {}
    }
  ],
  "Points": [],
  "Counters": [
    {
        "Name": "consul.raft.apply",
        "Count": 1,
        "Sum": 2, "Min": 1, "Max": 1, "Mean": 1, "Stddev": 0,
        "Labels": {}
    }
  ],
  "Samples": [
    {
        "Name": "consul.fsm.coordinate.batch-update",
        "Count": 1,
        "Sum": 0.13156799972057343,
        "Min": 0.13156799972057343, "Max": 0.13156799972057343,
        "Mean": 0.13156799972057343, "Stddev": 0,
        "Labels": {}
    }
  ]
}

영사가 카운터와 게이지를 분리해 주었으니 운이 좋았습니다.2 그리고 SamplesCountSum 을 요약 메트릭으로 사용할 수 있는 것처럼 보입니다. Samples 을 다시 살펴보면 지연 시간을 추적하는 것이 아닌가 하는 의심이 듭니다. 문서를 자세히 살펴보니 ...

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