Skip to content
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

Change Metrics Output for sls flusher #908

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open

Conversation

EvanLjp
Copy link
Collaborator

@EvanLjp EvanLjp commented Jun 6, 2023

@EvanLjp EvanLjp changed the title Support V1 DataType in GO Change Metrics Output for sls flusher Jun 13, 2023
core/plugin/LogtailPluginAdapter.cpp Outdated Show resolved Hide resolved
plugins/input/opentelemetry/service_oltp.go Outdated Show resolved Hide resolved
core/sdk/Client.cpp Outdated Show resolved Hide resolved
@@ -167,6 +172,77 @@ static const char* GetOperationString(OperationOnFail op) {
}
}

void MetricsSendClosure::OnFail(sdk::Response* response, const string& errorCode, const string& errorMessage) {
static std::string sMetricstoreVersionTooLowFlag = "get WriteClient error: no basic auth or parse error";
LOG_INFO(sLogger, ("send failed, error code", errorCode)("error msg", errorMessage)("retry times", mDataPtr->mSendRetryTimes));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug

@@ -19,10 +19,12 @@
#include <string>
#include <deque>
#include <stdio.h>
#include "Config.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog

dataPtr->mLogData,
dataPtr->mRawSize,
sendClosure);
}else if (hashKey.empty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}else 加空格

@@ -167,6 +172,77 @@ static const char* GetOperationString(OperationOnFail op) {
}
}

void MetricsSendClosure::OnFail(sdk::Response* response, const string& errorCode, const string& errorMessage) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SendClosure::OnFail 这两个函数还是重复度极高,能合成一个吗

core/plugin/LogtailPluginAdapter.cpp Outdated Show resolved Hide resolved
else if (telemetryTypeStr == "metrics")
telemetryType = sls_logs::SLS_TELEMETRY_TYPE_METRICS;
else {
LOG_ERROR(sLogger, ("not supported log type, use default log telemetry type", telemetryType));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不致命的用WARNING

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return;
}
auto errCode = LOGE_REQUEST_ERROR;
if (request->mCallBack->mHTTPMessage.statusCode ==401) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

401也是LOGE_INTERNAL_SERVER_ERROR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -2125,7 +2215,15 @@ void Sender::SendToNetAsync(LoggroupTimeValue* dataPtr) {
}
} else if (dataPtr->mDataType == LOGGROUP_COMPRESSED) {
const auto& hashKey = exactlyOnceCpt ? exactlyOnceCpt->data.hash_key() : dataPtr->mShardHashKey;
if (hashKey.empty()) {
if (sendToMetricStore){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

core/sender/Sender.cpp Outdated Show resolved Hide resolved
core/sender/Sender.cpp Outdated Show resolved Hide resolved
@@ -351,6 +372,9 @@ void SendClosure::OnFail(sdk::Response* response, const string& errorCode, const

// Log warning if retry for too long or will discard data
switch (operation) {
case METRICSTORE_CHANGE_LOGSTORE:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后端不具备时,所有请求会发送两次。等后端发差不多了,再带入logtail版本吧。 @yyuuttaaoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants