@@ -19,7 +19,7 @@ type TraceID string
19
19
// SpanID is the id of a span
20
20
type SpanID string
21
21
22
- // ValueType is the type of a value stored in KeyValue struct.
22
+ // ValueType is the type of a value stored in keyValue struct.
23
23
type ValueType string
24
24
25
25
const (
@@ -28,71 +28,71 @@ const (
28
28
// FollowsFrom means a span follows from another span
29
29
FollowsFrom ReferenceType = "FOLLOWS_FROM"
30
30
31
- // StringType indicates a string value stored in KeyValue
31
+ // StringType indicates a string value stored in keyValue
32
32
StringType ValueType = "string"
33
- // BoolType indicates a Boolean value stored in KeyValue
33
+ // BoolType indicates a Boolean value stored in keyValue
34
34
BoolType ValueType = "bool"
35
- // Int64Type indicates a 64bit signed integer value stored in KeyValue
35
+ // Int64Type indicates a 64bit signed integer value stored in keyValue
36
36
Int64Type ValueType = "int64"
37
- // Float64Type indicates a 64bit float value stored in KeyValue
37
+ // Float64Type indicates a 64bit float value stored in keyValue
38
38
Float64Type ValueType = "float64"
39
- // BinaryType indicates an arbitrary byte array stored in KeyValue
39
+ // BinaryType indicates an arbitrary byte array stored in keyValue
40
40
BinaryType ValueType = "binary"
41
41
)
42
42
43
- // Reference is a reference from one span to another
44
- type Reference struct {
43
+ // reference is a reference from one span to another
44
+ type reference struct {
45
45
RefType ReferenceType `json:"refType"`
46
46
TraceID TraceID `json:"traceID"`
47
47
SpanID SpanID `json:"spanID"`
48
48
}
49
49
50
- // Process is the process emitting a set of spans
51
- type Process struct {
50
+ // process is the process emitting a set of spans
51
+ type process struct {
52
52
ServiceName string `json:"serviceName"`
53
- Tags []KeyValue `json:"tags"`
53
+ Tags []keyValue `json:"tags"`
54
54
// Alternative representation of tags for better kibana support
55
55
Tag map [string ]any `json:"tag,omitempty"`
56
56
}
57
57
58
- // Log is a log emitted in a span
59
- type Log struct {
58
+ // log is a log emitted in a span
59
+ type log struct {
60
60
Timestamp uint64 `json:"timestamp"`
61
- Fields []KeyValue `json:"fields"`
61
+ Fields []keyValue `json:"fields"`
62
62
}
63
63
64
- // KeyValue is a key-value pair with typed value.
65
- type KeyValue struct {
64
+ // keyValue is a key-value pair with typed value.
65
+ type keyValue struct {
66
66
Key string `json:"key"`
67
67
Type ValueType `json:"type,omitempty"`
68
68
Value any `json:"value"`
69
69
}
70
70
71
- // Service is the JSON struct for service:operation documents in ElasticSearch
72
- type Service struct {
71
+ // service is the JSON struct for service:operation documents in ElasticSearch
72
+ type service struct {
73
73
ServiceName string `json:"serviceName"`
74
74
OperationName string `json:"operationName"`
75
75
}
76
76
77
- // only for testing Span is ES database representation of the domain span.
78
- type Span struct {
77
+ // only for testing span is ES database representation of the domain span.
78
+ type span struct {
79
79
TraceID TraceID `json:"traceID"`
80
80
SpanID SpanID `json:"spanID"`
81
81
ParentSpanID SpanID `json:"parentSpanID,omitempty"` // deprecated
82
82
Flags uint32 `json:"flags,omitempty"`
83
83
OperationName string `json:"operationName"`
84
- References []Reference `json:"references"`
84
+ References []reference `json:"references"`
85
85
StartTime uint64 `json:"startTime"` // microseconds since Unix epoch
86
86
// ElasticSearch does not support a UNIX Epoch timestamp in microseconds,
87
87
// so Jaeger maps StartTime to a 'long' type. This extra StartTimeMillis field
88
88
// works around this issue, enabling timerange queries.
89
89
StartTimeMillis uint64 `json:"startTimeMillis"`
90
90
Duration uint64 `json:"duration"` // microseconds
91
- Tags []KeyValue `json:"tags"`
91
+ Tags []keyValue `json:"tags"`
92
92
// Alternative representation of tags for better kibana support
93
93
Tag map [string ]any `json:"tag,omitempty"`
94
- Logs []Log `json:"logs"`
95
- Process Process `json:"process,omitempty"`
94
+ Logs []log `json:"logs"`
95
+ Process process `json:"process,omitempty"`
96
96
}
97
97
98
98
// newFromDomain creates fromDomain used to convert model span to db span
@@ -111,8 +111,8 @@ type fromDomain struct {
111
111
tagDotReplacement string
112
112
}
113
113
114
- // fromDomainEmbedProcess converts model.Span into json.Span format.
115
- // This format includes a ParentSpanID and an embedded Process .
114
+ // fromDomainEmbedProcess converts model.span into json.span format.
115
+ // This format includes a ParentSpanID and an embedded process .
116
116
func (fd fromDomain ) fromDomainEmbedProcess (span * model.Span ) * logzioSpan {
117
117
return fd .convertSpanEmbedProcess (span )
118
118
}
@@ -140,10 +140,10 @@ func (fd fromDomain) convertSpanEmbedProcess(span *model.Span) *logzioSpan {
140
140
return & s
141
141
}
142
142
143
- func (fd fromDomain ) convertReferences (span * model.Span ) []Reference {
144
- out := make ([]Reference , 0 , len (span .References ))
143
+ func (fd fromDomain ) convertReferences (span * model.Span ) []reference {
144
+ out := make ([]reference , 0 , len (span .References ))
145
145
for _ , ref := range span .References {
146
- out = append (out , Reference {
146
+ out = append (out , reference {
147
147
RefType : fd .convertRefType (ref .RefType ),
148
148
TraceID : TraceID (ref .TraceID .String ()),
149
149
SpanID : SpanID (ref .SpanID .String ()),
@@ -159,9 +159,9 @@ func (fromDomain) convertRefType(refType model.SpanRefType) ReferenceType {
159
159
return ChildOf
160
160
}
161
161
162
- func (fd fromDomain ) convertKeyValuesString (keyValues model.KeyValues ) ([]KeyValue , map [string ]any ) {
162
+ func (fd fromDomain ) convertKeyValuesString (keyValues model.KeyValues ) ([]keyValue , map [string ]any ) {
163
163
var tagsMap map [string ]any
164
- var kvs []KeyValue
164
+ var kvs []keyValue
165
165
for _ , kv := range keyValues {
166
166
if kv .GetVType () != model .BinaryType && (fd .allTagsAsFields || fd .tagKeysAsFields [kv .Key ]) {
167
167
if tagsMap == nil {
@@ -173,37 +173,37 @@ func (fd fromDomain) convertKeyValuesString(keyValues model.KeyValues) ([]KeyVal
173
173
}
174
174
}
175
175
if kvs == nil {
176
- kvs = make ([]KeyValue , 0 )
176
+ kvs = make ([]keyValue , 0 )
177
177
}
178
178
return kvs , tagsMap
179
179
}
180
180
181
- func (fromDomain ) convertLogs (logs []model.Log ) []Log {
182
- out := make ([]Log , len (logs ))
183
- for i , log := range logs {
184
- var kvs []KeyValue
185
- for _ , kv := range log .Fields {
181
+ func (fromDomain ) convertLogs (logs []model.Log ) []log {
182
+ out := make ([]log , len (logs ))
183
+ for i , l := range logs {
184
+ var kvs []keyValue
185
+ for _ , kv := range l .Fields {
186
186
kvs = append (kvs , convertKeyValue (kv ))
187
187
}
188
- out [i ] = Log {
189
- Timestamp : model .TimeAsEpochMicroseconds (log .Timestamp ),
188
+ out [i ] = log {
189
+ Timestamp : model .TimeAsEpochMicroseconds (l .Timestamp ),
190
190
Fields : kvs ,
191
191
}
192
192
}
193
193
return out
194
194
}
195
195
196
- func (fd fromDomain ) convertProcess (process * model.Process ) Process {
197
- tags , tagsMap := fd .convertKeyValuesString (process .Tags )
198
- return Process {
199
- ServiceName : process .ServiceName ,
196
+ func (fd fromDomain ) convertProcess (p * model.Process ) process {
197
+ tags , tagsMap := fd .convertKeyValuesString (p .Tags )
198
+ return process {
199
+ ServiceName : p .ServiceName ,
200
200
Tags : tags ,
201
201
Tag : tagsMap ,
202
202
}
203
203
}
204
204
205
- func convertKeyValue (kv model.KeyValue ) KeyValue {
206
- return KeyValue {
205
+ func convertKeyValue (kv model.KeyValue ) keyValue {
206
+ return keyValue {
207
207
Key : kv .Key ,
208
208
Type : ValueType (strings .ToLower (kv .VType .String ())),
209
209
Value : kv .AsString (),
0 commit comments