Class Event
- Namespace
- Fdyay.IdentityServer.Events
- Assembly
- Fdyay.IdentityServer.Core.dll
Something worth telling a host about.
[SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Event is the name a host inherits from and the parameter type on IEventSink, so renaming it would break every custom event type and sink written against the API this server is a drop-in for. CA1716's concern is VB.NET, where the name is escapable as [Event]; the compatibility cost of a rename is paid by every consumer, and the cost of keeping it by VB callers who write two brackets.")]
public abstract class Event
- Inheritance
-
Event
- Derived
- Inherited Members
Remarks
The contextual fields — ActivityId and the two addresses — are filled in by
DefaultEventService rather than by the code raising the event, because the call sites that raise
events are the ones that should not have to know a request is in flight, or whether there is one at all.
Constructors
Event(string, string, EventTypes, int, string?)
Sets the fields every event of a type shares; a subclass passes its own constants.
protected Event(string category, string name, EventTypes type, int id, string? message = null)
Parameters
categorystringThe area of the server it came from — one of EventCategories.
namestringThe human-readable name a host groups on.
typeEventTypesWhether it reports a success, a refusal, an observation or a server fault.
idintThe stable numeric id — one of EventIds.
messagestringDetail, or null where there is none worth carrying.
Properties
ActivityId
The request's trace identifier, so an event can be tied to a log line.
public string? ActivityId { get; set; }
Property Value
Category
The area of the server this came from — see EventCategories.
public string Category { get; }
Property Value
EventType
Whether this reports a success, a refusal, an observation, or a server fault.
public EventTypes EventType { get; }
Property Value
Id
The stable numeric id — see EventIds.
public int Id { get; }
Property Value
LocalIpAddress
The address the request arrived on.
public string? LocalIpAddress { get; set; }
Property Value
Message
Detail, where there is any worth carrying.
public string? Message { get; set; }
Property Value
Name
A human-readable name, stable enough to group on.
public string Name { get; }
Property Value
ProcessId
The id of the process that raised the event, set by the service. Duende's.
public int ProcessId { get; set; }
Property Value
Remarks
What tells two instances of one deployment apart in a shared sink, where the addresses are the load balancer's and the activity id is unique per request rather than per instance.
RemoteIpAddress
The caller's address, where the event was raised during a request.
public string? RemoteIpAddress { get; set; }
Property Value
TimeStamp
When the event was raised (UTC), set by the service.
public DateTime TimeStamp { get; set; }
Property Value
Methods
PrepareAsync()
Runs once the service has decided to raise the event, before it reaches the sink.
protected virtual Task PrepareAsync()
Returns
Remarks
Duende 8.0.1's, measured: protected internal virtual, a completed task here, and awaited by the event
service after the time, the process and the request's fields are set — so a host's own event can compute what is
only worth computing for an event that is going to be raised, from the fields already filled in.
ToString()
The event as indented JSON, every member that has a value, enums by name. Duende's.
public override string ToString()
Returns
Remarks
Duende 8.0.1's ToString, measured: its log serializer over the runtime type, nulls left out, indented, with
a string enum converter. What a host that logs evt.ToString() gets, and safe to log for the reason every
event here is: none carries a credential (see TokenFingerprint).