Skip to content

Commit d90962d

Browse files
authored
Fix compilation in Darwin + updated linter + linter complaints fixed (#1743)
* fix sdk injector * update linter + fix lints * fix ringbuf package * fix format * fix error introduced by formatter * Fix missing type alias
1 parent 6e7397a commit d90962d

33 files changed

+99
-53
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bpf2go:
133133
prereqs: install-hooks bpf2go
134134
@echo "### Check if prerequisites are met, and installing missing dependencies"
135135
mkdir -p $(TEST_OUTPUT)/run
136-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,v1.61.0)
136+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,v1.64.7)
137137
$(call go-install-tool,$(GO_OFFSETS_TRACKER),github.com/grafana/go-offsets-tracker/cmd/go-offsets-tracker,$(call gomod-version,grafana/go-offsets-tracker))
138138
$(call go-install-tool,$(GOIMPORTS_REVISER),github.com/incu6us/goimports-reviser/v3,v3.6.4)
139139
$(call go-install-tool,$(GO_LICENSES),github.com/google/go-licenses,v1.6.0)

pkg/export/otel/metric/internal/aggregate/exponential_histogram.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ type expoHistogramDataPoint[N int64 | float64] struct {
4848
zeroCount uint64
4949
}
5050

51+
// nolint:revive
52+
// lint disabled as this is an inherited code
5153
func newExpoHistogramDataPoint[N int64 | float64](attrs attribute.Set, maxSize, maxScale int, noMinMax, noSum bool) *expoHistogramDataPoint[N] {
5254
f := math.MaxFloat64
5355
max := N(f) // if N is int64, max will overflow to -9223372036854775808

pkg/export/otel/metrics_internal.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,20 @@ func (p *InternalMetricsReporter) Start(ctx context.Context) {
129129
p.beylaInfo.Record(ctx, 1, instrument.WithAttributes(attribute.String("goarch", runtime.GOARCH), attribute.String("goos", runtime.GOOS), attribute.String("goversion", runtime.Version()), attribute.String("version", buildinfo.Version), attribute.String("revision", buildinfo.Revision)))
130130
}
131131

132-
func (p *InternalMetricsReporter) TracerFlush(len int) {
133-
p.tracerFlushes.Record(p.ctx, float64(len))
132+
func (p *InternalMetricsReporter) TracerFlush(length int) {
133+
p.tracerFlushes.Record(p.ctx, float64(length))
134134
}
135135

136-
func (p *InternalMetricsReporter) OTELMetricExport(len int) {
137-
p.otelMetricExports.Add(p.ctx, float64(len))
136+
func (p *InternalMetricsReporter) OTELMetricExport(length int) {
137+
p.otelMetricExports.Add(p.ctx, float64(length))
138138
}
139139

140140
func (p *InternalMetricsReporter) OTELMetricExportError(err error) {
141141
p.otelMetricExportErrs.Add(p.ctx, 1, instrument.WithAttributes(attribute.String("error", err.Error())))
142142
}
143143

144-
func (p *InternalMetricsReporter) OTELTraceExport(len int) {
145-
p.otelTraceExports.Add(p.ctx, float64(len))
144+
func (p *InternalMetricsReporter) OTELTraceExport(length int) {
145+
p.otelTraceExports.Add(p.ctx, float64(length))
146146
}
147147

148148
func (p *InternalMetricsReporter) OTELTraceExportError(err error) {

pkg/export/otel/metrics_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,11 @@ func TestMetricsInterval(t *testing.T) {
629629
})
630630
}
631631

632-
func (f *fakeInternalMetrics) OTELMetricExport(len int) {
632+
func (f *fakeInternalMetrics) OTELMetricExport(length int) {
633633
fakeMux.Lock()
634634
defer fakeMux.Unlock()
635635
f.cnt.Add(1)
636-
f.sum.Add(int32(len))
636+
f.sum.Add(int32(length))
637637
}
638638

639639
func (f *fakeInternalMetrics) OTELMetricExportError(_ error) {

pkg/export/otel/traces_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,9 +1188,9 @@ type fakeInternalTraces struct {
11881188
errs atomic.Int32
11891189
}
11901190

1191-
func (f *fakeInternalTraces) OTELTraceExport(len int) {
1191+
func (f *fakeInternalTraces) OTELTraceExport(length int) {
11921192
f.cnt.Add(1)
1193-
f.sum.Add(int32(len))
1193+
f.sum.Add(int32(length))
11941194
}
11951195

11961196
func (f *fakeInternalTraces) OTELTraceExportError(_ error) {

pkg/internal/ebpf/common/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
"github.com/cilium/ebpf"
1414
"github.com/cilium/ebpf/link"
15-
"github.com/cilium/ebpf/ringbuf"
1615

1716
"github.com/grafana/beyla/v2/pkg/config"
17+
"github.com/grafana/beyla/v2/pkg/internal/ebpf/ringbuf"
1818
"github.com/grafana/beyla/v2/pkg/internal/request"
1919
)
2020

pkg/internal/ebpf/common/common_darwin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ func HasHostNetworkAccess() (bool, error) {
1616
return false, nil
1717
}
1818

19-
func FindNetworkNamespace(pid int32) (string, error) {
19+
func FindNetworkNamespace(_ int32) (string, error) {
2020
return "", nil
2121
}
2222

23-
func RootDirectoryForPID(pid int32) string {
23+
func RootDirectoryForPID(_ int32) string {
2424
return ""
2525
}

pkg/internal/ebpf/common/go_kafka_transform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"encoding/binary"
66
"unsafe"
77

8-
"github.com/cilium/ebpf/ringbuf"
98
"go.opentelemetry.io/otel/trace"
109

10+
"github.com/grafana/beyla/v2/pkg/internal/ebpf/ringbuf"
1111
"github.com/grafana/beyla/v2/pkg/internal/request"
1212
)
1313

pkg/internal/ebpf/common/http2grpc_transform.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import (
88
"strings"
99
"unsafe"
1010

11-
"github.com/cilium/ebpf/ringbuf"
1211
lru "github.com/hashicorp/golang-lru/v2"
1312
"go.opentelemetry.io/otel/trace"
1413
"golang.org/x/net/http2"
1514

1615
"github.com/grafana/beyla/v2/pkg/internal/ebpf/bhpack"
16+
"github.com/grafana/beyla/v2/pkg/internal/ebpf/ringbuf"
1717
"github.com/grafana/beyla/v2/pkg/internal/request"
1818
)
1919

@@ -423,8 +423,8 @@ const (
423423

424424
const frameHeaderLen = 9
425425

426-
func readHTTP2Frame(buf []uint8, len int) (*frameHeader, bool) {
427-
if len < frameHeaderLen {
426+
func readHTTP2Frame(buf []uint8, length int) (*frameHeader, bool) {
427+
if length < frameHeaderLen {
428428
return nil, false
429429
}
430430

pkg/internal/ebpf/common/http2grpc_transform_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,17 @@ func TestDynamicTableUpdates(t *testing.T) {
241241
assert.Equal(t, "*", s.Path) // this value is the same I just changed the first character from r to p
242242
}
243243

244-
func makeBPFHTTP2Info(buf, rbuf []byte, len int) BPFHTTP2Info {
244+
func makeBPFHTTP2Info(buf, rbuf []byte, length int) BPFHTTP2Info {
245245
var info BPFHTTP2Info
246246
copy(info.Data[:], buf)
247247
copy(info.RetData[:], rbuf)
248-
info.Len = int32(len)
248+
info.Len = int32(length)
249249

250250
return info
251251
}
252252

253-
func makeBPFHTTP2InfoNewRequest(buf, rbuf []byte, len int) BPFHTTP2Info {
254-
info := makeBPFHTTP2Info(buf, rbuf, len)
253+
func makeBPFHTTP2InfoNewRequest(buf, rbuf []byte, length int) BPFHTTP2Info {
254+
info := makeBPFHTTP2Info(buf, rbuf, length)
255255
info.ConnInfo.D_port = 1
256256
info.ConnInfo.S_port = 1
257257
info.NewConnId = 1

0 commit comments

Comments
 (0)