Skip to content

Commit bd606ce

Browse files
committed
public -> private
1 parent 4f7013a commit bd606ce

File tree

3 files changed

+72
-72
lines changed

3 files changed

+72
-72
lines changed

exporter/logzioexporter/from_domain.go

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type TraceID string
1919
// SpanID is the id of a span
2020
type SpanID string
2121

22-
// ValueType is the type of a value stored in KeyValue struct.
22+
// ValueType is the type of a value stored in keyValue struct.
2323
type ValueType string
2424

2525
const (
@@ -28,71 +28,71 @@ const (
2828
// FollowsFrom means a span follows from another span
2929
FollowsFrom ReferenceType = "FOLLOWS_FROM"
3030

31-
// StringType indicates a string value stored in KeyValue
31+
// StringType indicates a string value stored in keyValue
3232
StringType ValueType = "string"
33-
// BoolType indicates a Boolean value stored in KeyValue
33+
// BoolType indicates a Boolean value stored in keyValue
3434
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
3636
Int64Type ValueType = "int64"
37-
// Float64Type indicates a 64bit float value stored in KeyValue
37+
// Float64Type indicates a 64bit float value stored in keyValue
3838
Float64Type ValueType = "float64"
39-
// BinaryType indicates an arbitrary byte array stored in KeyValue
39+
// BinaryType indicates an arbitrary byte array stored in keyValue
4040
BinaryType ValueType = "binary"
4141
)
4242

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 {
4545
RefType ReferenceType `json:"refType"`
4646
TraceID TraceID `json:"traceID"`
4747
SpanID SpanID `json:"spanID"`
4848
}
4949

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 {
5252
ServiceName string `json:"serviceName"`
53-
Tags []KeyValue `json:"tags"`
53+
Tags []keyValue `json:"tags"`
5454
// Alternative representation of tags for better kibana support
5555
Tag map[string]any `json:"tag,omitempty"`
5656
}
5757

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 {
6060
Timestamp uint64 `json:"timestamp"`
61-
Fields []KeyValue `json:"fields"`
61+
Fields []keyValue `json:"fields"`
6262
}
6363

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 {
6666
Key string `json:"key"`
6767
Type ValueType `json:"type,omitempty"`
6868
Value any `json:"value"`
6969
}
7070

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 {
7373
ServiceName string `json:"serviceName"`
7474
OperationName string `json:"operationName"`
7575
}
7676

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 {
7979
TraceID TraceID `json:"traceID"`
8080
SpanID SpanID `json:"spanID"`
8181
ParentSpanID SpanID `json:"parentSpanID,omitempty"` // deprecated
8282
Flags uint32 `json:"flags,omitempty"`
8383
OperationName string `json:"operationName"`
84-
References []Reference `json:"references"`
84+
References []reference `json:"references"`
8585
StartTime uint64 `json:"startTime"` // microseconds since Unix epoch
8686
// ElasticSearch does not support a UNIX Epoch timestamp in microseconds,
8787
// so Jaeger maps StartTime to a 'long' type. This extra StartTimeMillis field
8888
// works around this issue, enabling timerange queries.
8989
StartTimeMillis uint64 `json:"startTimeMillis"`
9090
Duration uint64 `json:"duration"` // microseconds
91-
Tags []KeyValue `json:"tags"`
91+
Tags []keyValue `json:"tags"`
9292
// Alternative representation of tags for better kibana support
9393
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"`
9696
}
9797

9898
// newFromDomain creates fromDomain used to convert model span to db span
@@ -111,8 +111,8 @@ type fromDomain struct {
111111
tagDotReplacement string
112112
}
113113

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.
116116
func (fd fromDomain) fromDomainEmbedProcess(span *model.Span) *logzioSpan {
117117
return fd.convertSpanEmbedProcess(span)
118118
}
@@ -140,10 +140,10 @@ func (fd fromDomain) convertSpanEmbedProcess(span *model.Span) *logzioSpan {
140140
return &s
141141
}
142142

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))
145145
for _, ref := range span.References {
146-
out = append(out, Reference{
146+
out = append(out, reference{
147147
RefType: fd.convertRefType(ref.RefType),
148148
TraceID: TraceID(ref.TraceID.String()),
149149
SpanID: SpanID(ref.SpanID.String()),
@@ -159,9 +159,9 @@ func (fromDomain) convertRefType(refType model.SpanRefType) ReferenceType {
159159
return ChildOf
160160
}
161161

162-
func (fd fromDomain) convertKeyValuesString(keyValues model.KeyValues) ([]KeyValue, map[string]any) {
162+
func (fd fromDomain) convertKeyValuesString(keyValues model.KeyValues) ([]keyValue, map[string]any) {
163163
var tagsMap map[string]any
164-
var kvs []KeyValue
164+
var kvs []keyValue
165165
for _, kv := range keyValues {
166166
if kv.GetVType() != model.BinaryType && (fd.allTagsAsFields || fd.tagKeysAsFields[kv.Key]) {
167167
if tagsMap == nil {
@@ -173,37 +173,37 @@ func (fd fromDomain) convertKeyValuesString(keyValues model.KeyValues) ([]KeyVal
173173
}
174174
}
175175
if kvs == nil {
176-
kvs = make([]KeyValue, 0)
176+
kvs = make([]keyValue, 0)
177177
}
178178
return kvs, tagsMap
179179
}
180180

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 {
186186
kvs = append(kvs, convertKeyValue(kv))
187187
}
188-
out[i] = Log{
189-
Timestamp: model.TimeAsEpochMicroseconds(log.Timestamp),
188+
out[i] = log{
189+
Timestamp: model.TimeAsEpochMicroseconds(l.Timestamp),
190190
Fields: kvs,
191191
}
192192
}
193193
return out
194194
}
195195

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,
200200
Tags: tags,
201201
Tag: tagsMap,
202202
}
203203
}
204204

205-
func convertKeyValue(kv model.KeyValue) KeyValue {
206-
return KeyValue{
205+
func convertKeyValue(kv model.KeyValue) keyValue {
206+
return keyValue{
207207
Key: kv.Key,
208208
Type: ValueType(strings.ToLower(kv.VType.String())),
209209
Value: kv.AsString(),

exporter/logzioexporter/from_domain_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,35 +98,35 @@ func TestConvertKeyValueValue(t *testing.T) {
9898
key := "key"
9999
tests := []struct {
100100
kv model.KeyValue
101-
expected KeyValue
101+
expected keyValue
102102
}{
103103
{
104104
kv: model.Bool(key, true),
105-
expected: KeyValue{Key: key, Value: "true", Type: "bool"},
105+
expected: keyValue{Key: key, Value: "true", Type: "bool"},
106106
},
107107
{
108108
kv: model.Bool(key, false),
109-
expected: KeyValue{Key: key, Value: "false", Type: "bool"},
109+
expected: keyValue{Key: key, Value: "false", Type: "bool"},
110110
},
111111
{
112112
kv: model.Int64(key, int64(1499)),
113-
expected: KeyValue{Key: key, Value: "1499", Type: "int64"},
113+
expected: keyValue{Key: key, Value: "1499", Type: "int64"},
114114
},
115115
{
116116
kv: model.Float64(key, float64(15.66)),
117-
expected: KeyValue{Key: key, Value: "15.66", Type: "float64"},
117+
expected: keyValue{Key: key, Value: "15.66", Type: "float64"},
118118
},
119119
{
120120
kv: model.String(key, longString),
121-
expected: KeyValue{Key: key, Value: longString, Type: "string"},
121+
expected: keyValue{Key: key, Value: longString, Type: "string"},
122122
},
123123
{
124124
kv: model.Binary(key, []byte(longString)),
125-
expected: KeyValue{Key: key, Value: hex.EncodeToString([]byte(longString)), Type: "binary"},
125+
expected: keyValue{Key: key, Value: hex.EncodeToString([]byte(longString)), Type: "binary"},
126126
},
127127
{
128128
kv: model.KeyValue{VType: 1500, Key: key},
129-
expected: KeyValue{Key: key, Value: "unknown type 1500", Type: "1500"},
129+
expected: keyValue{Key: key, Value: "unknown type 1500", Type: "1500"},
130130
},
131131
}
132132

exporter/logzioexporter/logziospan.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ const (
1515
tagDotReplacementCharacter = "@"
1616
)
1717

18-
// logzioSpan is same as ESSpan with a few different json field names and an addition on type field.
18+
// logzioSpan is same as esSpan with a few different json field names and an addition on type field.
1919
type logzioSpan struct {
2020
TraceID TraceID `json:"traceID"`
2121
SpanID SpanID `json:"spanID"`
2222
OperationName string `json:"operationName,omitempty"`
23-
References []Reference `json:"references"`
23+
References []reference `json:"references"`
2424
Flags uint32 `json:"flags,omitempty"`
2525
StartTime uint64 `json:"startTime"`
2626
StartTimeMillis uint64 `json:"startTimeMillis"`
2727
Timestamp uint64 `json:"@timestamp"`
2828
Duration uint64 `json:"duration"`
29-
Tags []KeyValue `json:"JaegerTags,omitempty"`
29+
Tags []keyValue `json:"JaegerTags,omitempty"`
3030
Tag map[string]any `json:"JaegerTag,omitempty"`
31-
Logs []Log `json:"logs"`
32-
Process Process `json:"process,omitempty"`
31+
Logs []log `json:"logs"`
32+
Process process `json:"process,omitempty"`
3333
Type string `json:"type"`
3434
}
3535

@@ -66,19 +66,19 @@ func transformToLogzioSpanBytes(span *model.Span) ([]byte, error) {
6666
}
6767

6868
// only for testing transformToDbModelSpan coverts logz.io span to ElasticSearch span
69-
func (span *logzioSpan) transformToDbModelSpan() *Span {
70-
return &Span{
71-
OperationName: span.OperationName,
72-
Process: span.Process,
73-
Tags: span.Tags,
74-
Tag: span.Tag,
75-
References: span.References,
76-
Logs: span.Logs,
77-
Duration: span.Duration,
78-
StartTimeMillis: span.StartTimeMillis,
79-
StartTime: span.StartTime,
80-
Flags: span.Flags,
81-
SpanID: span.SpanID,
82-
TraceID: span.TraceID,
69+
func (logziospan *logzioSpan) transformToDbModelSpan() *span {
70+
return &span{
71+
OperationName: logziospan.OperationName,
72+
Process: logziospan.Process,
73+
Tags: logziospan.Tags,
74+
Tag: logziospan.Tag,
75+
References: logziospan.References,
76+
Logs: logziospan.Logs,
77+
Duration: logziospan.Duration,
78+
StartTimeMillis: logziospan.StartTimeMillis,
79+
StartTime: logziospan.StartTime,
80+
Flags: logziospan.Flags,
81+
SpanID: logziospan.SpanID,
82+
TraceID: logziospan.TraceID,
8383
}
8484
}

0 commit comments

Comments
 (0)