Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Abingcbc committed Sep 18, 2024
1 parent 409f575 commit 9e76b8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 1 addition & 9 deletions core/pipeline/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "common/Flags.h"
#include "common/ParamExtractor.h"
#include "go_pipeline/LogtailPlugin.h"
#include "monitor/MetricConstants.h"
#include "pipeline/batch/TimeoutFlushManager.h"
#include "pipeline/plugin/PluginRegistry.h"
#include "pipeline/queue/ProcessQueueManager.h"
Expand Down Expand Up @@ -74,16 +73,9 @@ bool Pipeline::Init(PipelineConfig&& config) {
mContext.SetCreateTime(config.mCreateTime);
mContext.SetPipeline(*this);
mContext.SetIsFirstProcessorJsonFlag(config.mIsFirstProcessorJson);


WriteMetrics::GetInstance()->CreateMetricsRecordRef(mMetricsRecordRef,
{
{METRIC_LABEL_PROJECT, config.mProject},
{METRIC_LABEL_CONFIG_NAME, config.mName},
});
mMetricsRecordRef.AddLabels({{METRIC_LABEL_PROJECT, config.mProject}});
mMetricsRecordRef.AddLabels({{METRIC_LABEL_CONFIG_NAME, mName}});
WriteMetrics::GetInstance()->CommitMetricsRecordRef(mMetricsRecordRef);
mLoadDelayMs = mMetricsRecordRef.CreateCounter("config_load_delay_ms");

// for special treatment below
const InputFile* inputFile = nullptr;
Expand Down
5 changes: 5 additions & 0 deletions core/pipeline/Pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "config/PipelineConfig.h"
#include "models/PipelineEventGroup.h"
#include "monitor/MetricConstants.h"
#include "pipeline/PipelineContext.h"
#include "pipeline/plugin/instance/FlusherInstance.h"
#include "pipeline/plugin/instance/InputInstance.h"
Expand All @@ -37,6 +38,10 @@ namespace logtail {

class Pipeline {
public:
Pipeline() {
WriteMetrics::GetInstance()->CreateMetricsRecordRef(mMetricsRecordRef, {});
mLoadDelayMs = mMetricsRecordRef.CreateCounter("config_load_delay_ms");
}
// copy/move control functions are deleted because of mContext
bool Init(PipelineConfig&& config);
void Start();
Expand Down

0 comments on commit 9e76b8a

Please sign in to comment.