Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
catdogpandas committed Nov 28, 2024
1 parent c0e6373 commit 1622812
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ProcessorPromParseMetricNative::Process(PipelineEventGroup& eGroup) {
StringTo<uint64_t>(eGroup.GetMetadata(EventGroupMetaKey::PROMETHEUS_STREAM_TOTAL).to_string()));
}
// add auto metric,if this is the last one of the stream
if (mStreamCounter.MeetLast(streamID)) {
if (mStreamCounter.IsLast(streamID)) {
eGroup.SetMetadata(EventGroupMetaKey::PROMETHEUS_SAMPLES_SCRAPED, ToString(mMetricCountCache[streamID]));
// erase the cache
mMetricCountCache.erase(streamID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void ProcessorPromRelabelMetricNative::Process(PipelineEventGroup& eGroup) {
auto& autoMetric = mAutoMetricCache[streamID];
UpdateAutoMetrics(eGroup, autoMetric);
// add auto metric,if this is the last one of the stream
if (mStreamCounter.MeetLast(streamID)) {
if (mStreamCounter.IsLast(streamID)) {
AddAutoMetrics(eGroup, autoMetric);
// erase the cache
mAutoMetricCache.erase(streamID);
Expand Down
2 changes: 1 addition & 1 deletion core/prometheus/labels/StreamCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StreamCounter {
public:
void Add(const std::string& streamID) { mStreamCache[streamID].first++; }
void SetTotal(const std::string& streamID, uint64_t total) { mStreamCache[streamID].second = total; }
bool MeetLast(const std::string& streamID) {
bool IsLast(const std::string& streamID) {
auto stream = mStreamCache.find(streamID);
if (stream == mStreamCache.end()) {
LOG_WARNING(sLogger, ("streamID not found", streamID));
Expand Down

0 comments on commit 1622812

Please sign in to comment.