Skip to content

Commit

Permalink
Feature: add prometheus authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
leolin49 committed Dec 4, 2024
1 parent 3eac220 commit 90d155c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions trpc/admin/prometheus_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ bool PrometheusHandler::CheckBasicAuth(std::string token) {

void PrometheusHandler::CommandHandle(http::HttpRequestPtr req, rapidjson::Value& result,
rapidjson::Document::AllocatorType& alloc) {
static std::unique_ptr<::prometheus::Serializer> serializer = std::make_unique<::prometheus::TextSerializer>();

std::string prometheus_str = serializer->Serialize(trpc::prometheus::Collect());

std::string token = req->GetHeader("authorization");
Expand Down

0 comments on commit 90d155c

Please sign in to comment.