@@ -15,13 +15,13 @@ import (
1515)
1616
1717type config struct {
18- analyticsRate float64
19- resourceNamer func (c * gin.Context ) string
20- serviceName string
21- ignoreRequest func (c * gin.Context ) bool
22- isStatusError func (statusCode int ) bool
23- propagateError bool
24- headerTags instrumentation.HeaderTags
18+ analyticsRate float64
19+ resourceNamer func (c * gin.Context ) string
20+ serviceName string
21+ ignoreRequest func (c * gin.Context ) bool
22+ isStatusError func (statusCode int ) bool
23+ useGinErrors bool
24+ headerTags instrumentation.HeaderTags
2525}
2626
2727func newConfig (serviceName string ) * config {
@@ -30,13 +30,13 @@ func newConfig(serviceName string) *config {
3030 }
3131 rate := instr .AnalyticsRate (true )
3232 return & config {
33- analyticsRate : rate ,
34- resourceNamer : defaultResourceNamer ,
35- serviceName : serviceName ,
36- ignoreRequest : func (_ * gin.Context ) bool { return false },
37- isStatusError : isServerError ,
38- propagateError : false ,
39- headerTags : instr .HTTPHeadersAsTags (),
33+ analyticsRate : rate ,
34+ resourceNamer : defaultResourceNamer ,
35+ serviceName : serviceName ,
36+ ignoreRequest : func (_ * gin.Context ) bool { return false },
37+ isStatusError : isServerError ,
38+ useGinErrors : false ,
39+ headerTags : instr .HTTPHeadersAsTags (),
4040 }
4141}
4242
@@ -95,11 +95,11 @@ func isServerError(statusCode int) bool {
9595 return statusCode >= 500 && statusCode < 600
9696}
9797
98- // WithErrorPropagation enables the propagation of gin's errors to the span.
98+ // WithUseGinErrors enables the usage of gin's errors for the span instead of crafting generic errors from the status code .
9999// If there are multiple errors in the gin context, they will be all added to the span.
100- func WithErrorPropagation () OptionFn {
100+ func WithUseGinErrors () OptionFn {
101101 return func (cfg * config ) {
102- cfg .propagateError = true
102+ cfg .useGinErrors = true
103103 }
104104}
105105
0 commit comments