Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Takuka0311 committed Nov 26, 2024
1 parent 56e22f8 commit 1de87d6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
7 changes: 0 additions & 7 deletions core/monitor/MetricManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,15 @@ SelfMonitorMetricEvent::SelfMonitorMetricEvent(MetricsRecord* metricRecord) {
// category
mCategory = metricRecord->GetCategory();
// labels
string projects;
for (auto item = metricRecord->GetLabels()->begin(); item != metricRecord->GetLabels()->end(); ++item) {
pair<string, string> pair = *item;
mLabels[pair.first] = pair.second;
if (pair.first == METRIC_LABEL_KEY_PROJECT) {
projects = pair.second;
}
}
for (auto item = metricRecord->GetDynamicLabels()->begin(); item != metricRecord->GetDynamicLabels()->end();
++item) {
pair<string, function<string()>> pair = *item;
string value = pair.second();
mLabels[pair.first] = value;
if (pair.first == METRIC_LABEL_KEY_PROJECT) {
projects = value;
}
}
// counters
for (auto& item : metricRecord->GetCounters()) {
Expand Down
1 change: 0 additions & 1 deletion core/pipeline/serializer/JsonSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ using namespace std;
namespace logtail {

const string JSON_KEY_TIME = "__time__";
const string JSON_KEY_TIME_NANO = "__time_nano__";

bool JsonEventGroupSerializer::Serialize(BatchedEvents&& group, string& res, string& errorMsg) {
if (group.mEvents.empty()) {
Expand Down
9 changes: 0 additions & 9 deletions core/pipeline/serializer/SLSSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ bool SLSEventGroupSerializer::Serialize(BatchedEvents&& group, string& res, stri
const auto& e = group.mEvents[i].Cast<MetricEvent>();
if (e.Is<UntypedSingleValue>()) {
metricEventContentCache[i].first = to_string(e.GetValue<UntypedSingleValue>()->mValue);
} else if (e.Is<UntypedMultiDoubleValues>()) {
Json::Value metricValues;
for (auto value = e.GetValue<UntypedMultiDoubleValues>()->ValusBegin();
value != e.GetValue<UntypedMultiDoubleValues>()->ValusEnd();
value++) {
metricValues[value->first.to_string()] = value->second;
}
Json::StreamWriterBuilder writer;
metricEventContentCache[i].first = Json::writeString(writer, metricValues);
} else {
// should not happen
LOG_ERROR(sLogger,
Expand Down

0 comments on commit 1de87d6

Please sign in to comment.