Skip to content
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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sagarvish1989
Copy link

Fixes #
Design discussion issue #

Changes

Please provide a brief description of the changes here.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

Copy link

linux-foundation-easycla bot commented Oct 21, 2024

CLA Missing ID CLA Not Signed

@github-actions github-actions bot added the comp:exporter.onecollector Things related to OpenTelemetry.Exporter.OneCollector label Oct 21, 2024
@@ -54,7 +65,8 @@ public static bool IsEventNameValid(string eventName)

public ResolvedEventFullName ResolveEventFullName(
string? eventNamespace,
string? eventName)
string? eventName,
EventNameDelimiter eventNameDelimiter = EventNameDelimiter.Period)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this do anything?

Copy link
Author

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)'_';
Copy link

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)
Copy link

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

Copy link

@gesiu gesiu Oct 21, 2024

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

Copy link
Author

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;
Copy link

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

Copy link

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)

@Kielek
Copy link
Contributor

Kielek commented Oct 22, 2024

@sagarvish1989, could you please sing EasyCLA?
This is hard requirement to merge anything to this repository.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 30, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Nov 7, 2024
@sagarvish1989
Copy link
Author

Trying to reopen the PR to make it active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:exporter.onecollector Things related to OpenTelemetry.Exporter.OneCollector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants