반응형 promql2 [ENG] Basic Understanding of Prometheus Query (PromQL) The following is a translation into English of a blog post I wrote in 2017. Please note that there may be some errors in the translation. Prometheus Query (hereafter PromQL) differs from SQL, and when you first encounter it, you might find it somewhat challenging to understand. However, once you fully grasp it, you'll realize that it is a well-designed language. In this section, we aim to explai.. 2024. 12. 30. 동적 Prometheus 쿼리 만들기 with golang(레이블 삽입하기) 그라파나를 통해서 사용자에게 메트릭을 제공하려고 할때 가끔가다가 사용자별 테넌트 분리를 해야하는 경우가 있다. 또는 동적으로 변하는 특정 타겟별로 각 메트릭을 얻어오는 사이드카를 만들려고 할때 고정된 쿼리를 사용할수 없는 경우도 있다. 이럴 때는 base prometheus 쿼리를 기반으로 동적으로 레이블을 넣어줄 수 있다. 여기서는 golang client를 이용하는 방법을 설명한다. package main import ( "fmt" "github.com/prometheus/prometheus/promql/parser" ) // addLabelToQuery는 주어진 PromQL 쿼리에 새로운 레이블을 추가합니다. func addLabelToQuery(query, labelName, labelValue .. 2023. 12. 27. 이전 1 다음 반응형