outpost/ldap: set request_id in sentry

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-25 22:36:08 +02:00
parent 734e5fcab4
commit ffbab2cd68
2 changed files with 4 additions and 2 deletions

View File

@ -23,11 +23,12 @@ type BindRequest struct {
func (ls *LDAPServer) Bind(bindDN string, bindPW string, conn net.Conn) (ldap.LDAPResultCode, error) { func (ls *LDAPServer) Bind(bindDN string, bindPW string, conn net.Conn) (ldap.LDAPResultCode, error) {
span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.bind", span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.bind",
sentry.TransactionName("authentik.providers.ldap.bind")) sentry.TransactionName("authentik.providers.ldap.bind"))
rid := uuid.New().String()
span.SetTag("request_uid", rid)
span.SetTag("user.username", bindDN) span.SetTag("user.username", bindDN)
defer span.Finish() defer span.Finish()
bindDN = strings.ToLower(bindDN) bindDN = strings.ToLower(bindDN)
rid := uuid.New().String()
req := BindRequest{ req := BindRequest{
BindDN: bindDN, BindDN: bindDN,
BindPW: bindPW, BindPW: bindPW,

View File

@ -24,12 +24,13 @@ type SearchRequest struct {
func (ls *LDAPServer) Search(bindDN string, searchReq ldap.SearchRequest, conn net.Conn) (ldap.ServerSearchResult, error) { 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")) 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("user.username", bindDN)
span.SetTag("ak_filter", searchReq.Filter) span.SetTag("ak_filter", searchReq.Filter)
span.SetTag("ak_base_dn", searchReq.BaseDN) span.SetTag("ak_base_dn", searchReq.BaseDN)
bindDN = strings.ToLower(bindDN) bindDN = strings.ToLower(bindDN)
rid := uuid.New().String()
req := SearchRequest{ req := SearchRequest{
SearchRequest: searchReq, SearchRequest: searchReq,
BindDN: bindDN, BindDN: bindDN,