-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design review to allow underscore in event name #2232
base: main
Are you sure you want to change the base?
Design review to allow underscore in event name #2232
Conversation
|
@@ -54,7 +65,8 @@ public static bool IsEventNameValid(string eventName) | |||
|
|||
public ResolvedEventFullName ResolveEventFullName( | |||
string? eventNamespace, | |||
string? eventName) | |||
string? eventName, | |||
EventNameDelimiter eventNameDelimiter = EventNameDelimiter.Period) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this do anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not needed. Will remove.
@@ -124,7 +136,8 @@ private static byte[] BuildEventFullName(string eventNamespace, string eventName | |||
{ | |||
WriteEventFullNameComponent(eventNamespace, destination, ref cursor); | |||
|
|||
destination[cursor++] = (byte)'.'; | |||
byte delimiter = eventNameDelimiter == EventNameDelimiter.Period ? (byte)'.' : (byte)'_'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use a lookup table
@@ -112,7 +124,7 @@ public ResolvedEventFullName ResolveEventFullName( | |||
return resolvedEventFullName; | |||
} | |||
|
|||
private static byte[] BuildEventFullName(string eventNamespace, string eventName) | |||
private static byte[] BuildEventFullName(string eventNamespace, string eventName, EventNameDelimiter eventNameDelimiter = EventNameDelimiter.Period) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably by the time this function is reached, the eventNameDelimiter should be a byte and not an enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, unless we really want this to be settable on a per-event basis, this shouldn't be a parameter - you should just reference the property of the EventNameManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
private static readonly Regex EventNamespaceValidationRegex = new(@"^[A-Za-z](?:\.?[A-Za-z0-9]+?)*$", RegexOptions.Compiled); | ||
private static readonly Regex EventNameValidationRegex = new(@"^[A-Za-z][A-Za-z0-9]*$", RegexOptions.Compiled); | ||
|
||
private readonly string defaultEventNamespace; | ||
private readonly string defaultEventName; | ||
private readonly EventNameDelimiter defaultEventNameDelimiter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be 'eventNameDelimiter'.
The 'defaultEventNamespace' and 'defaultEventName' properties are about the values for a default event, not the default values for an arbitrary event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is - someone could call log(dataFields: foo) without passing an event name, and the event name would be the default event name. (pseudocode, something like that)
@sagarvish1989, could you please sing EasyCLA? |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Trying to reopen the PR to make it active |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Fixes #
Design discussion issue #
Changes
Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes