Skip to content

Commit

Permalink
chore: update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
catdogpandas committed Sep 19, 2024
1 parent ddcab1d commit 363c06b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ bool ProcessorPromRelabelMetricNative::ProcessEvent(PipelineEventPtr& e, const G
// if confiliction, then rename it exported_<label_name>
for (const auto& [k, v] : targetTags) {
if (sourceEvent.HasTag(k)) {
sourceEvent.SetTag("exported_" + k.to_string(), sourceEvent.GetTag(k).to_string());
auto key = prometheus::EXPORTED_PREFIX + k.to_string();
sourceEvent.SetTag(key, sourceEvent.GetTag(k).to_string());
sourceEvent.DelTag(k);
} else {
sourceEvent.SetTag(k, v);
Expand Down
1 change: 1 addition & 0 deletions core/prometheus/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const char* const REPLACEMENT = "replacement";
const char* const ACTION = "action";
const char* const MODULUS = "modulus";
const char* const NAME = "__name__";
const std::string EXPORTED_PREFIX = "exported_";

// prometheus env
const char* const OPERATOR_HOST = "OPERATOR_HOST";
Expand Down
1 change: 1 addition & 0 deletions core/prometheus/schedulers/ScrapeConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>

#include "common/FileSystemUtil.h"
#include "common/StringTools.h"
#include "logger/Logger.h"
#include "prometheus/Constants.h"
#include "prometheus/Utils.h"
Expand Down

0 comments on commit 363c06b

Please sign in to comment.