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

sls flusher support metricstore #1731

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

Conversation

EvanLjp
Copy link
Collaborator

@EvanLjp EvanLjp commented Sep 1, 2024

Logtail 2.0 add sls Metrics support
Old version #908

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


shaoxuan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@EvanLjp EvanLjp added the core Core feature label Sep 1, 2024
@EvanLjp EvanLjp added this to the v2.0 milestone Sep 1, 2024
@@ -219,15 +220,20 @@ namespace sdk {
sls_logs::SlsCompressType compressType,
const std::string& compressedLogGroup,
uint32_t rawSize,
const std::string& hashKey) {
const std::string& hashKey,
bool isMetrics) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里最好改成enum,可以复用flushersls里的,因为以后可能还有trace

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个是存储类型,trace 没有特点存储,都是 logstore

map<string, string> httpHeader;
httpHeader[CONTENT_TYPE] = TYPE_LOG_PROTOBUF;
if (!mKeyProvider.empty()) {
httpHeader[X_LOG_KEYPROVIDER] = mKeyProvider;
}
httpHeader[X_LOG_BODYRAWSIZE] = std::to_string(rawSize);
httpHeader[X_LOG_COMPRESSTYPE] = Client::GetCompressTypeString(compressType);
return SynPostLogStoreLogs(project, logstore, compressedLogGroup, httpHeader, hashKey);
if (isMetrics) {
return SynPostMetricStoreLogs(project, logstore, compressedLogGroup, httpHeader);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个没有hashkey吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

metricstore 这个渠道自动 hash

Comment on lines 335 to 336
const std::string& hashKey,
int64_t hashKeySeqID,
Copy link
Collaborator

Choose a reason for hiding this comment

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

这俩参数没用?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

没用删了

Comment on lines +187 to +189
if (url.find(METRICSTORES) != std::string::npos) {
throw LOGException(LOGE_REQUEST_ERROR, httpMessage.content);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

搜一下IsLogServiceResponse(),应该在flushersls里面还有一个地方有类似的

@@ -80,7 +80,7 @@ class FlusherSLS : public HttpFlusher {
std::string mRegion;
std::string mEndpoint;
std::string mAliuid;
TelemetryType mTelemetryType = TelemetryType::LOG;
sls_logs::SlsTelemetryType mTelemetryType = sls_logs::SlsTelemetryType::SLS_TELEMETRY_TYPE_LOGS;
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个为什么要改?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

落文件时候,之前这个不记录,recover 时候只能按 log recover

@henryzhx8 henryzhx8 modified the milestones: v2.0, v2.2 Sep 5, 2024
shaoxuan added 2 commits September 20, 2024 09:43
Conflicts:
	core/plugin/flusher/sls/FlusherSLS.h
	core/sdk/Client.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants