From 5f9b0b1d591f92e0fa0303dce5646067f77a170e Mon Sep 17 00:00:00 2001 From: Romain Caire Date: Mon, 27 Nov 2023 22:27:51 +0100 Subject: [PATCH] Add tracer as per AuthorizeRequest --- device_authorize_request_handler.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device_authorize_request_handler.go b/device_authorize_request_handler.go index 7155f12b1..715579abd 100644 --- a/device_authorize_request_handler.go +++ b/device_authorize_request_handler.go @@ -9,9 +9,18 @@ import ( "github.com/ory/fosite/i18n" "github.com/ory/x/errorsx" + "github.com/ory/x/otelx" + "go.opentelemetry.io/otel/trace" ) -func (f *Fosite) NewDeviceAuthorizeRequest(ctx context.Context, r *http.Request) (DeviceAuthorizeRequester, error) { +func (f *Fosite) NewDeviceAuthorizeRequest(ctx context.Context, r *http.Request) (_ DeviceAuthorizeRequester, err error) { + ctx, span := trace.SpanFromContext(ctx).TracerProvider().Tracer("github.com/ory/fosite").Start(ctx, "Fosite.NewDeviceAuthorizeRequest") + defer otelx.End(span, &err) + + return f.newDeviceAuthorizeRequest(ctx, r) +} + +func (f *Fosite) newDeviceAuthorizeRequest(ctx context.Context, r *http.Request) (DeviceAuthorizeRequester, error) { request := NewDeviceAuthorizeRequest() request.Lang = i18n.GetLangFromRequest(f.Config.GetMessageCatalog(ctx), r)