Exemplo n.º 1
0
        private void IncludeAllCounters(string sourcePath)
        {
            if (CountersToIncludeBySourcePath == null)
            {
                CountersToIncludeBySourcePath = new Dictionary <string,
                                                                (bool, HashSet <string>)>(StringComparer.OrdinalIgnoreCase);
            }

            if (CountersToIncludeBySourcePath.TryGetValue(sourcePath, out var val) && val.CountersToInclude != null)
            {
                throw new InvalidOperationException("IIncludeBuilder : You cannot use AllCounters() after using Counter(string name) or Counters(string[] names)");
            }

            CountersToIncludeBySourcePath[sourcePath] = (true, null);
        }
Exemplo n.º 2
0
        private void AssertNotAllAndAddNewEntryIfNeeded(string path)
        {
            if (CountersToIncludeBySourcePath != null &&
                CountersToIncludeBySourcePath.TryGetValue(path, out var val) &&
                val.AllCounters)
            {
                throw new InvalidOperationException("IIncludeBuilder : You cannot use Counter(name) after using AllCounters() ");
            }

            if (CountersToIncludeBySourcePath == null)
            {
                CountersToIncludeBySourcePath = new Dictionary <string,
                                                                (bool, HashSet <string>)>(StringComparer.OrdinalIgnoreCase);
            }

            if (CountersToIncludeBySourcePath.ContainsKey(path) == false)
            {
                CountersToIncludeBySourcePath[path] = (false, new HashSet <string>(StringComparer.OrdinalIgnoreCase));
            }
        }