Skip to content

Commit 251d2d4

Browse files
authored
fix(otelgin): remove redundant error handling from HTML (#6373)
Originating from #5088 (comment)
1 parent dfd6b16 commit 251d2d4

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2222
- Fix broken AWS presigned URLs when using instrumentation in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws`. (#5975)
2323
- Fixed the value for configuring the OTLP exporter to use `grpc` instead of `grpc/protobuf` in `go.opentelemetry.io/contrib/config`. (#6338)
2424
- Allow marshaling types in `go.opentelemetry.io/contrib/config`. (#6347)
25+
- Removed the redundant handling of panic from the `HTML` function in `go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin`. (#6373)
2526

2627
<!-- Released section -->
2728
<!-- Don't change this section unless doing release -->

instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@ func HTML(c *gin.Context, code int, name string, obj interface{}) {
125125
}()
126126
opt := oteltrace.WithAttributes(attribute.String("go.template", name))
127127
_, span := tracer.Start(savedContext, "gin.renderer.html", opt)
128-
defer func() {
129-
if r := recover(); r != nil {
130-
err := fmt.Errorf("error rendering template:%s: %s", name, r)
131-
span.RecordError(err)
132-
span.SetStatus(codes.Error, "template failure")
133-
span.End()
134-
panic(r)
135-
}
136-
span.End()
137-
}()
128+
defer span.End()
138129
c.HTML(code, name, obj)
139130
}

0 commit comments

Comments
 (0)