Skip to content

Commit

Permalink
Change InstrumentationLibrary to be non-nullable
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Nov 23, 2020
1 parent 7874cd5 commit 23cba0d
Show file tree
Hide file tree
Showing 26 changed files with 271 additions and 367 deletions.
4 changes: 2 additions & 2 deletions cmd/pdatagen/internal/common_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var commonFile = &File{
},
}

var instrumentationLibrary = &messagePtrStruct{
var instrumentationLibrary = &messageValueStruct{
structName: "InstrumentationLibrary",
description: "// InstrumentationLibrary is a message representing the instrumentation library information.",
originFullName: "otlpcommon.InstrumentationLibrary",
Expand Down Expand Up @@ -66,7 +66,7 @@ var attributeMap = &sliceStruct{

var attributeKeyValue = &messagePtrStruct{}

var instrumentationLibraryField = &messagePtrField{
var instrumentationLibraryField = &messageValueField{
fieldName: "InstrumentationLibrary",
originFieldName: "InstrumentationLibrary",
returnMessage: instrumentationLibrary,
Expand Down
31 changes: 7 additions & 24 deletions consumer/pdata/generated_common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions consumer/pdata/generated_common_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions consumer/pdata/generated_log.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions consumer/pdata/generated_log_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions consumer/pdata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions consumer/pdata/generated_metrics_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions consumer/pdata/generated_trace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions consumer/pdata/generated_trace_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions consumer/pdata/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,8 @@ func generateTestProtoResource() otlpresource.Resource {
}
}

func generateTestProtoInstrumentationLibrary() *otlpcommon.InstrumentationLibrary {
return &otlpcommon.InstrumentationLibrary{
func generateTestProtoInstrumentationLibrary() otlpcommon.InstrumentationLibrary {
return otlpcommon.InstrumentationLibrary{
Name: "test",
Version: "",
}
Expand Down
1 change: 0 additions & 1 deletion consumer/simple/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ func (mb *Metrics) getMetricsSlice() pdata.MetricSlice {
ilm.InitEmpty()

il := ilm.InstrumentationLibrary()
il.InitEmpty()
il.SetName(mb.InstrumentationLibraryName)
il.SetVersion(mb.InstrumentationLibraryVersion)

Expand Down
1 change: 0 additions & 1 deletion consumer/simple/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ func BenchmarkPdataMetrics(b *testing.B) {
metrics.Resize(6)

il := ilm.InstrumentationLibrary()
il.InitEmpty()
il.SetName("example")
il.SetVersion("0.1")

Expand Down
12 changes: 3 additions & 9 deletions exporter/loggingexporter/logging_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,7 @@ func (s *loggingExporter) pushTraceData(
buf.logEntry("* Nil InstrumentationLibrarySpans")
continue
}
if !ils.InstrumentationLibrary().IsNil() {
buf.logInstrumentationLibrary(ils.InstrumentationLibrary())
}
buf.logInstrumentationLibrary(ils.InstrumentationLibrary())

spans := ils.Spans()
for k := 0; k < spans.Len(); k++ {
Expand Down Expand Up @@ -424,9 +422,7 @@ func (s *loggingExporter) pushMetricsData(
buf.logEntry("* Nil InstrumentationLibraryMetrics")
continue
}
if !ilm.InstrumentationLibrary().IsNil() {
buf.logInstrumentationLibrary(ilm.InstrumentationLibrary())
}
buf.logInstrumentationLibrary(ilm.InstrumentationLibrary())
metrics := ilm.Metrics()
for k := 0; k < metrics.Len(); k++ {
buf.logEntry("Metric #%d", k)
Expand Down Expand Up @@ -535,9 +531,7 @@ func (s *loggingExporter) pushLogData(
buf.logEntry("* Nil InstrumentationLibraryLogs")
continue
}
if !ils.InstrumentationLibrary().IsNil() {
buf.logInstrumentationLibrary(ils.InstrumentationLibrary())
}
buf.logInstrumentationLibrary(ils.InstrumentationLibrary())

logs := ils.Logs()
for j := 0; j < logs.Len(); j++ {
Expand Down
Loading

0 comments on commit 23cba0d

Please sign in to comment.