Skip to content

Commit

Permalink
[receiver/cloudfoundryreceiver] Simplify code by combining method calls
Browse files Browse the repository at this point in the history
Co-authored-by: Cem Deniz Kabakci <cem.kabakci@springer.com>
  • Loading branch information
jriguera and CemDK committed May 23, 2024
1 parent 928f6a4 commit 6994583
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions receiver/cloudfoundryreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,15 @@ func (cfr *cloudFoundryReceiver) streamLogs(
}

func createLibraryMetricsSlice(metrics pmetric.Metrics) pmetric.MetricSlice {
resourceMetrics := metrics.ResourceMetrics()
resourceMetric := resourceMetrics.AppendEmpty()
resourceMetric.Resource().Attributes()
libraryMetricsSlice := resourceMetric.ScopeMetrics()
libraryMetrics := libraryMetricsSlice.AppendEmpty()
resourceMetric := metrics.ResourceMetrics().AppendEmpty()
libraryMetrics := resourceMetric.ScopeMetrics().AppendEmpty()
libraryMetrics.Scope().SetName(instrumentationLibName)
return libraryMetrics.Metrics()
}

func createLibraryLogsSlice(logs plog.Logs) plog.LogRecordSlice {
resourceLogs := logs.ResourceLogs()
resourceLog := resourceLogs.AppendEmpty()
resourceLog.Resource().Attributes()
libraryLogsSlice := resourceLog.ScopeLogs()
libraryLogs := libraryLogsSlice.AppendEmpty()
resourceLog := logs.ResourceLogs().AppendEmpty()
libraryLogs := resourceLog.ScopeLogs().AppendEmpty()
libraryLogs.Scope().SetName(instrumentationLibName)
return libraryLogs.LogRecords()
}

0 comments on commit 6994583

Please sign in to comment.