From 82063e73bf4c416f65fd76f272768ca68435f151 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 9 Nov 2022 18:16:01 -0800 Subject: [PATCH] lint --- .../EventCountersMetrics.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs index 18ed7441da..7fa32ee95d 100644 --- a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs +++ b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs @@ -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. flow to metrics SDK and filter if needed. + // let ec. flow to metrics SDK and it will suppress it if needed. return string.Concat(Prefix, ".", eventName); } @@ -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);