From ffbab2cd68d635a9ec524859dcb43887b0e0308f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 25 Aug 2021 22:36:08 +0200 Subject: [PATCH] outpost/ldap: set request_id in sentry Signed-off-by: Jens Langhammer --- internal/outpost/ldap/bind.go | 3 ++- internal/outpost/ldap/search.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/outpost/ldap/bind.go b/internal/outpost/ldap/bind.go index de32efb16..f56e94f07 100644 --- a/internal/outpost/ldap/bind.go +++ b/internal/outpost/ldap/bind.go @@ -23,11 +23,12 @@ type BindRequest struct { func (ls *LDAPServer) Bind(bindDN string, bindPW string, conn net.Conn) (ldap.LDAPResultCode, error) { span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.bind", sentry.TransactionName("authentik.providers.ldap.bind")) + rid := uuid.New().String() + span.SetTag("request_uid", rid) span.SetTag("user.username", bindDN) defer span.Finish() bindDN = strings.ToLower(bindDN) - rid := uuid.New().String() req := BindRequest{ BindDN: bindDN, BindPW: bindPW, diff --git a/internal/outpost/ldap/search.go b/internal/outpost/ldap/search.go index 26f68c44d..c4222cec8 100644 --- a/internal/outpost/ldap/search.go +++ b/internal/outpost/ldap/search.go @@ -24,12 +24,13 @@ type SearchRequest struct { func (ls *LDAPServer) Search(bindDN string, searchReq ldap.SearchRequest, conn net.Conn) (ldap.ServerSearchResult, error) { span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.search", sentry.TransactionName("authentik.providers.ldap.search")) + rid := uuid.New().String() + span.SetTag("request_uid", rid) span.SetTag("user.username", bindDN) span.SetTag("ak_filter", searchReq.Filter) span.SetTag("ak_base_dn", searchReq.BaseDN) bindDN = strings.ToLower(bindDN) - rid := uuid.New().String() req := SearchRequest{ SearchRequest: searchReq, BindDN: bindDN,