mirror of
https://github.com/hanzoai/krakend-otel.git
synced 2026-09-30 22:49:38 +00:00
fix code style issues
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ func clientAddr(r *http.Request, trustedProxies map[string]bool) string {
|
||||
if r.RemoteAddr == "" {
|
||||
return ""
|
||||
}
|
||||
if trustedProxies == nil || len(trustedProxies) == 0 {
|
||||
if len(trustedProxies) == 0 {
|
||||
return r.RemoteAddr
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ func NewTrackingHandlerWithTrustedProxies(next http.Handler, trustedProxies []st
|
||||
if !gCfg.DisableMetrics {
|
||||
var metricsAttrs []attribute.KeyValue
|
||||
for _, kv := range gCfg.MetricsStaticAttributes {
|
||||
if len(kv.Key) > 0 && len(kv.Value) > 0 {
|
||||
if kv.Key != "" && kv.Value != "" {
|
||||
metricsAttrs = append(metricsAttrs, attribute.String(kv.Key, kv.Value))
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func NewTrackingHandlerWithTrustedProxies(next http.Handler, trustedProxies []st
|
||||
if !gCfg.DisableTraces {
|
||||
tracesAttrs := []attribute.KeyValue{attribute.String("krakend.stage", "global")}
|
||||
for _, kv := range gCfg.TracesStaticAttributes {
|
||||
if len(kv.Key) > 0 && len(kv.Value) > 0 {
|
||||
if kv.Key != "" && kv.Value != "" > 0 {
|
||||
tracesAttrs = append(tracesAttrs, attribute.String(kv.Key, kv.Value))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,7 @@ func (t *tracesHTTP) start(r *http.Request, tr *tracking) *http.Request {
|
||||
trace.WithSpanKind(trace.SpanKindServer))
|
||||
r = r.WithContext(tr.ctx)
|
||||
|
||||
var attrs []attribute.KeyValue
|
||||
attrs = otelhttp.TraceIncomingRequestAttrs(r, t.trustedProxies)
|
||||
attrs := otelhttp.TraceIncomingRequestAttrs(r, t.trustedProxies)
|
||||
|
||||
tr.span.SetAttributes(attrs...)
|
||||
if len(t.fixedAttrs) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user