Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change InstrumentationLibrary to be non-nullable #2196

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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