14
14
15
15
#include " collection_pipeline/serializer/JsonSerializer.h"
16
16
17
- #include " constants/SpanConstants.h"
18
- // TODO: the following dependencies should be removed
19
- #include " protobuf/sls/LogGroupSerializer.h"
20
-
21
- #include " rapidjson/writer.h"
22
17
#include " rapidjson/stringbuffer.h"
18
+ #include " rapidjson/writer.h"
23
19
24
20
using namespace std ;
25
21
26
22
namespace logtail {
27
23
28
- const char * JSON_KEY_TIME = " __time__" ;
29
-
30
24
// Helper function to serialize common fields (tags and time)
31
25
template <typename WriterType>
32
26
void SerializeCommonFields (const SizedMap& tags, uint64_t timestamp, WriterType& writer) {
@@ -36,7 +30,7 @@ void SerializeCommonFields(const SizedMap& tags, uint64_t timestamp, WriterType&
36
30
writer.String (tag.second .to_string ().c_str ());
37
31
}
38
32
// Serialize time
39
- writer.Key (JSON_KEY_TIME );
33
+ writer.Key (" __time__ " );
40
34
writer.Uint64 (timestamp);
41
35
}
42
36
@@ -92,18 +86,18 @@ bool JsonEventGroupSerializer::Serialize(BatchedEvents&& group, string& res, str
92
86
writer.StartObject ();
93
87
SerializeCommonFields (group.mTags , e.GetTimestamp (), writer);
94
88
// __labels__
95
- writer.Key (METRIC_RESERVED_KEY_LABELS. c_str () );
89
+ writer.Key (" __labels__ " );
96
90
writer.StartObject ();
97
91
for (auto tag = e.TagsBegin (); tag != e.TagsEnd (); tag++) {
98
92
writer.Key (tag->first .to_string ().c_str ());
99
93
writer.String (tag->second .to_string ().c_str ());
100
94
}
101
95
writer.EndObject ();
102
96
// __name__
103
- writer.Key (METRIC_RESERVED_KEY_NAME. c_str () );
97
+ writer.Key (" __name__ " );
104
98
writer.String (e.GetName ().to_string ().c_str ());
105
99
// __value__
106
- writer.Key (METRIC_RESERVED_KEY_VALUE. c_str () );
100
+ writer.Key (" __value__ " );
107
101
if (e.Is <UntypedSingleValue>()) {
108
102
writer.Double (e.GetValue <UntypedSingleValue>()->mValue );
109
103
} else if (e.Is <UntypedMultiDoubleValues>()) {
0 commit comments