Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski committed May 29, 2024
1 parent 142acc6 commit b04743b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/internal/ebpf/common/redis_detect_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"bytes"
"strings"

"github.com/grafana/beyla/pkg/internal/request"
trace2 "go.opentelemetry.io/otel/trace"

"github.com/grafana/beyla/pkg/internal/request"
)

const minRedisFrameLen = 3
Expand All @@ -18,6 +19,7 @@ func isRedis(buf []uint8) bool {
return isRedisOp(buf)
}

// nolint:cyclop
func isRedisOp(buf []uint8) bool {
if len(buf) == 0 {
return false
Expand Down
7 changes: 4 additions & 3 deletions pkg/internal/ebpf/common/tcp_detect_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ func ReadTCPRequestIntoSpan(record *ringbuf.Record) (request.Span, bool, error)

// Check if we have a SQL statement
sqlIndex := isSQL(buf)
if sqlIndex >= 0 {
switch {
case sqlIndex >= 0:
return TCPToSQLToSpan(&event, buf[sqlIndex:]), false, nil
} else if isHTTP2(b, &event) {
case isHTTP2(b, &event):
MisclassifiedEvents <- MisclassifiedEvent{EventType: EventTypeKHTTP2, TCPInfo: &event}
} else if isRedis(event.Buf[:l]) && isRedis(event.Rbuf[:]) {
case isRedis(event.Buf[:l]) && isRedis(event.Rbuf[:]):
op, text, ok := parseRedisRequest(buf)

if ok {
Expand Down
1 change: 1 addition & 0 deletions pkg/internal/export/otel/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ func SpanKindString(span *request.Span) string {
return "SPAN_KIND_INTERNAL"
}

// nolint:cyclop
func traceAttributes(span *request.Span, optionalAttrs map[attr.Name]struct{}) []attribute.KeyValue {
var attrs []attribute.KeyValue

Expand Down
1 change: 1 addition & 0 deletions pkg/internal/export/prom/prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ func (r *metricsReporter) collectMetrics(input <-chan []request.Span) {
}
}

// nolint:cyclop
func (r *metricsReporter) observe(span *request.Span) {
t := span.Timings()
r.beylaInfo.WithLabelValues(span.ServiceID.SDKLanguage.String()).Set(1.0)
Expand Down

0 comments on commit b04743b

Please sign in to comment.