Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Nov 10, 2022
1 parent 981e3e0 commit 82063e7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ private static string GetInstrumentName(string sourceName, string eventName)
}

var maxEventSourceLength = MaxInstrumentNameLength - Prefix.Length - 1 - eventName.Length;
if (maxEventSourceLength < 2)
if (maxEventSourceLength < 2)
{
// event name is too long, there is not enough space for sourceName.
// let ec.<eventName> flow to metrics SDK and filter if needed.
// let ec.<eventName> flow to metrics SDK and it will suppress it if needed.
return string.Concat(Prefix, ".", eventName);
}

Expand All @@ -159,12 +159,12 @@ private static string GetInstrumentName(string sourceName, string eventName)

if (ind < sourceName.Length)
{
abbreviation.Append(char.ToLowerInvariant(sourceName[ind])).Append('.');
if (abbreviation.Length + 2 >= maxEventSourceLength)
{
// stop if there is no room to add another letter and a dot after
break;
}

abbreviation.Append(char.ToLowerInvariant(sourceName[ind])).Append('.');
}

int nextDot = sourceName.IndexOf('.', ind);
Expand Down

0 comments on commit 82063e7

Please sign in to comment.