Method: Datadog::Kit::AppSec::Events.track_login_failure

Defined in:
lib/datadog/kit/appsec/events.rb

.track_login_failure(trace = nil, span = nil, user_exists:, user_id: nil, **others) ⇒ Object

Attach login failure event information to the trace

This method is experimental and may change in the future.

Parameters:

  • trace (TraceOperation) (defaults to: nil)

    Trace to attach data to. Defaults to active trace.

  • span (SpanOperation) (defaults to: nil)

    Span to attach data to. Defaults to active span on trace. Note that this should be a service entry span. When AppSec is enabled, the expected span and trace are automatically used as defaults.

  • user_id (String) (defaults to: nil)

    User id that attempted login

  • user_exists (bool)

    Whether the user id that did a login attempt exists.

  • others (Hash<String || Symbol, String>)

    Additional free-form event information to attach to the trace.



61
62
63
64
65
66
67
68
69
# File 'lib/datadog/kit/appsec/events.rb', line 61

def (trace = nil, span = nil, user_exists:, user_id: nil, **others)
  set_trace_and_span_context('track_login_failure', trace, span) do |active_trace, active_span|
    others[:'usr.login'] = user_id if user_id && !others.key?(:'usr.login') && !others.key?('usr.login')
    track(, active_trace, active_span, **others)

    active_span.set_tag('appsec.events.users.login.failure.usr.id', user_id) if user_id
    active_span.set_tag('appsec.events.users.login.failure.usr.exists', user_exists)
  end
end