mirror of
				https://github.com/traefik/traefik.git
				synced 2025-11-03 18:01:31 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			590 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			590 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package observability
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
	"fmt"
 | 
						|
 | 
						|
	"go.opentelemetry.io/otel/codes"
 | 
						|
	"go.opentelemetry.io/otel/trace"
 | 
						|
)
 | 
						|
 | 
						|
// SetStatusErrorf flags the span as in error and log an event.
 | 
						|
func SetStatusErrorf(ctx context.Context, format string, args ...interface{}) {
 | 
						|
	if span := trace.SpanFromContext(ctx); span != nil {
 | 
						|
		span.SetStatus(codes.Error, fmt.Sprintf(format, args...))
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func Proto(proto string) string {
 | 
						|
	switch proto {
 | 
						|
	case "HTTP/1.0":
 | 
						|
		return "1.0"
 | 
						|
	case "HTTP/1.1":
 | 
						|
		return "1.1"
 | 
						|
	case "HTTP/2":
 | 
						|
		return "2"
 | 
						|
	case "HTTP/3":
 | 
						|
		return "3"
 | 
						|
	default:
 | 
						|
		return proto
 | 
						|
	}
 | 
						|
}
 |