chore: update dependencies
This commit is contained in:
		
							
								
								
									
										17
									
								
								vendor/go.opentelemetry.io/otel/semconv/v1.7.0/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/go.opentelemetry.io/otel/semconv/v1.7.0/http.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -21,6 +21,8 @@ import (
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/otel/trace"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/otel/attribute"
 | 
			
		||||
	"go.opentelemetry.io/otel/codes"
 | 
			
		||||
)
 | 
			
		||||
@@ -269,6 +271,21 @@ func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) {
 | 
			
		||||
	return spanCode, ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message
 | 
			
		||||
// as specified by the OpenTelemetry specification for a span.
 | 
			
		||||
// Exclude 4xx for SERVER to set the appropriate status.
 | 
			
		||||
func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) {
 | 
			
		||||
	spanCode, valid := validateHTTPStatusCode(code)
 | 
			
		||||
	if !valid {
 | 
			
		||||
		return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code)
 | 
			
		||||
	}
 | 
			
		||||
	category := code / 100
 | 
			
		||||
	if spanKind == trace.SpanKindServer && category == 4 {
 | 
			
		||||
		return codes.Unset, ""
 | 
			
		||||
	}
 | 
			
		||||
	return spanCode, ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Validates the HTTP status code and returns corresponding span status code.
 | 
			
		||||
// If the `code` is not a valid HTTP status code, returns span status Error
 | 
			
		||||
// and false.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user