-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/metadata #1768
base: main
Are you sure you want to change the base?
Feature/metadata #1768
Conversation
c8cd6f1
to
ce5fa17
Compare
@@ -0,0 +1,245 @@ | |||
/* | |||
* LRUCache11 - a templated C++11 based LRU cache class that allows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::cerr << "Failed to parse JSON: " << errors << std::endl; | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空行
// Copyright 2022 iLogtail Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件名大小写
for (const auto& key : json["labels"].getMemberNames()) { | ||
if (json["labels"].isMember(key)) { | ||
info.labels[key] = json["labels"][key].asString(); | ||
if (key == "armsAppId") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不能直接有arms的变量,具体处理策略core/ebpf/handler/ObserveHandler.cpp
std::chrono::system_clock::time_point th2 = std::chrono::system_clock::from_time_t(now); | ||
std::chrono::duration<double> diff = th2 - th1; | ||
double minutes_diff = diff.count() / 60.0; | ||
if (minutes_diff > 10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成用乘法作比较
FromContainerJson(root, data); | ||
for (const auto& pair : data->containers) { | ||
if (infoType == containerInfoType::ContainerIdInfo) { | ||
containerCache.insert(pair.first, std::make_shared<k8sContainerInfo>(pair.second)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
并发的考虑
return; | ||
} | ||
FromContainerJson(root, data); | ||
for (const auto& pair : data->containers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
containers没有老化机制?只增不删?
|
||
if (reader->parse(res.mBody.c_str(), res.mBody.c_str() + res.mBody.size(), &root, &errors)) { | ||
std::shared_ptr<ContainerData> data = std::make_shared<ContainerData>(); | ||
FromContainerJson(root, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FromContainerJson 外部输入都是不可靠的
} | ||
Json::StreamWriterBuilder writer; | ||
std::string output = Json::writeString(writer, jsonObj); | ||
SendRequestToOperator(mServiceHost, output, containerInfoType::ContainerIdInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SendRequestToOperator 失败机制也不统一
} | ||
request = std::make_unique<HttpRequest>("GET", false, mServiceHost, mServicePort, path, "", map<std::string, std::string>(), output, 30, 3); | ||
bool success = SendHttpRequest(std::move(request), res); | ||
if (res.mStatusCode != 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
success跟res.mStatusCode的顺序是什么
add k8s metadata