Skip to content

Commit 24c5caf

Browse files
committed
Fix the webhook container
1 parent eb599e2 commit 24c5caf

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

api/pkg/di/container.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,10 @@ func (container *Container) WebhookService() (service *services.WebhookService)
828828
return services.NewWebhookService(
829829
container.Logger(),
830830
container.Tracer(),
831-
container.HTTPClient("webhook"),
831+
&http.Client{
832+
Timeout: 6 * time.Second,
833+
Transport: container.HTTPRoundTripperWithoutRetry("webhook"),
834+
},
832835
container.WebhookRepository(),
833836
container.EventDispatcher(),
834837
)
@@ -865,6 +868,16 @@ func (container *Container) HTTPRoundTripper(name string) http.RoundTripper {
865868
)
866869
}
867870

871+
// HTTPRoundTripperWithoutRetry creates an open telemetry http.RoundTripper without retry
872+
func (container *Container) HTTPRoundTripperWithoutRetry(name string) http.RoundTripper {
873+
container.logger.Debug(fmt.Sprintf("Debug: initializing %s %T", name, http.DefaultTransport))
874+
return otelroundtripper.New(
875+
otelroundtripper.WithName(name),
876+
otelroundtripper.WithMeter(otel.GetMeterProvider().Meter(container.projectID)),
877+
otelroundtripper.WithAttributes(container.OtelResources(container.version, container.projectID).Attributes()...),
878+
)
879+
}
880+
868881
// OtelResources generates default open telemetry resources
869882
func (container *Container) OtelResources(version string, namespace string) *resource.Resource {
870883
return resource.NewWithAttributes(

0 commit comments

Comments
 (0)