Skip to content

Commit 52f69b4

Browse files
committed
update
1 parent f6e18ec commit 52f69b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+651
-658
lines changed

Diff for: core/collection_pipeline/serializer/SLSSerializer.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "json/json.h"
2020

21-
#include "Logger.h"
2221
#include "collection_pipeline/serializer/JsonSerializer.h"
2322
#include "common/Flags.h"
2423
#include "common/compression/CompressType.h"

Diff for: core/common/NetworkUtil.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 iLogtail Authors
2+
* Copyright 2025 iLogtail Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

Diff for: core/common/NetworkUtil.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 iLogtail Authors
2+
* Copyright 2025 iLogtail Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

Diff for: core/common/ProcParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/common/ProcParser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/common/TimeUtil.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ std::chrono::nanoseconds GetTimeDiffFromMonotonic() {
422422
auto now_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count();
423423
auto boot_ns = t.tv_sec * 1000000000ULL + t.tv_nsec;
424424
return std::chrono::nanoseconds(now_ns - boot_ns);
425-
// linux windows
426425
#elif defined(__APPLE__)
427426
return std::chrono::nanoseconds(0);
428427
#endif

Diff for: core/ebpf/Config.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/Config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/SourceManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/SourceManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/BPFMapTraits.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/CallName.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/FileFilter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/FileFilter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/IdAllocator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/Log.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,17 +17,18 @@
1717
logtail::ebpf::eBPFLogHandler log_fn = nullptr;
1818

1919
void set_log_handler(logtail::ebpf::eBPFLogHandler fn) {
20-
if (!log_fn)
20+
if (log_fn == nullptr) {
2121
log_fn = fn;
22+
}
2223
}
2324

2425
void ebpf_log(logtail::ebpf::eBPFLogType level, const char* format, ...) {
25-
va_list args;
26-
27-
va_start(args, format);
28-
if (log_fn) {
29-
(void)log_fn(int16_t(level), format, args);
26+
if (log_fn == nullptr) {
27+
return;
3028
}
3129

30+
va_list args;
31+
va_start(args, format);
32+
(void)log_fn(int16_t(level), format, args);
3233
va_end(args);
3334
}

Diff for: core/ebpf/driver/Log.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/NetworkFilter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/NetworkFilter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/eBPFDriver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/eBPFDriver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/driver/eBPFWrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/eBPFServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/eBPFServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/AbstractManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/AbstractManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/ProcessCacheManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/ProcessCacheManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/file_security/FileSecurityManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/file_security/FileSecurityManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_observer/Connection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_observer/Connection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_observer/ConnectionManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_observer/NetworkObserverManager.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -127,10 +127,15 @@ NetworkObserverManager::NetworkObserverManager(std::shared_ptr<ProcessCacheManag
127127
[this](std::unique_ptr<AppMetricData>& base, const std::shared_ptr<AbstractRecord>& o) {
128128
auto* other = static_cast<AbstractAppRecord*>(o.get());
129129
int statusCode = other->GetStatusCode();
130-
base->m2xxCount += statusCode / 100 == 2;
131-
base->m3xxCount += statusCode / 100 == 3;
132-
base->m4xxCount += statusCode / 100 == 4;
133-
base->m5xxCount += statusCode / 100 == 5;
130+
if (statusCode >= 500) {
131+
base->m5xxCount += 1;
132+
} else if (statusCode >= 400) {
133+
base->m4xxCount += 1;
134+
} else if (statusCode >= 300) {
135+
base->m3xxCount += 1;
136+
} else {
137+
base->m2xxCount += 1;
138+
}
134139
base->mCount++;
135140
base->mErrCount += other->IsError();
136141
base->mSlowCount += other->IsSlow();

Diff for: core/ebpf/plugin/network_observer/NetworkObserverManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_security/NetworkSecurityManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/network_security/NetworkSecurityManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/process_security/ProcessSecurityManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/plugin/process_security/ProcessSecurityManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/protocol/AbstractParser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/protocol/ParserRegistry.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/protocol/ProtocolParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/protocol/ProtocolParser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/protocol/http/HttpParser.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -37,9 +37,7 @@ std::vector<std::shared_ptr<AbstractRecord>> HTTPProtocolParser::Parse(struct co
3737
record->SetStartTsNs(dataEvent->start_ts);
3838
auto spanId = GenerateSpanID();
3939
// slow request
40-
if (record->GetLatencyMs() > 500) {
41-
record->MarkSample();
42-
} else if (sampler->ShouldSample(spanId)) {
40+
if (record->GetLatencyMs() > 500 || sampler->ShouldSample(spanId)) {
4341
record->MarkSample();
4442
}
4543

Diff for: core/ebpf/type/AggregateEvent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/type/CommonDataEvent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Diff for: core/ebpf/type/NetworkObserverEvent.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 iLogtail Authors
1+
// Copyright 2025 iLogtail Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -60,10 +60,6 @@ class AbstractRecord {
6060
virtual bool IsSlow() const = 0;
6161
virtual int GetStatusCode() const = 0;
6262

63-
virtual DataTableSchema GetMetricsTableSchema() const = 0;
64-
65-
virtual DataTableSchema GetTableSchema() const = 0;
66-
6763
protected:
6864
uint64_t mStartTs;
6965
uint64_t mEndTs;
@@ -94,8 +90,6 @@ class ConnStatsRecord : public AbstractNetRecord {
9490
int GetStatusCode() const override { return 0; }
9591

9692
std::string GetSpanName() override { return "CONN_STATS"; }
97-
DataTableSchema GetMetricsTableSchema() const override { return kNetMetricsTable; }
98-
DataTableSchema GetTableSchema() const override { return kNetTable; }
9993
int mState;
10094
uint64_t mDropCount = 0;
10195
uint64_t mRttVar = 0;
@@ -129,8 +123,6 @@ class AbstractAppRecord : public AbstractNetRecord {
129123
virtual std::string GetProtocolVersion() const = 0;
130124
virtual std::string GetPath() const = 0;
131125

132-
DataTableSchema GetMetricsTableSchema() const override { return kAppMetricsTable; }
133-
134126
mutable std::string mTraceId;
135127
mutable std::string mSpanId;
136128
};
@@ -142,8 +134,6 @@ class HttpRecord : public AbstractAppRecord {
142134
~HttpRecord() override { sDestructCount++; }
143135
HttpRecord(std::shared_ptr<Connection> connection) : AbstractAppRecord(connection) { sConstructCount++; }
144136

145-
DataTableSchema GetTableSchema() const override { return kHTTPTable; }
146-
147137
void SetPath(const std::string& path) { mPath = path; }
148138

149139
void SetRealPath(const std::string& path) { mRealPath = path; }

0 commit comments

Comments
 (0)