Skip to content

Commit

Permalink
Remove unused code (#143)
Browse files Browse the repository at this point in the history
* remove DiagnosticContextExtensions.cs and unused items from DiagnosticContextFactory.cs

* update package version

* fix minor package version
  • Loading branch information
Runhard13 authored Dec 13, 2024
1 parent bc5135c commit 0ab98e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 88 deletions.
31 changes: 0 additions & 31 deletions src/Core/DiagnosticContextExtensions.cs

This file was deleted.

57 changes: 3 additions & 54 deletions src/Core/DiagnosticContextFactory.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Mindbox Ltd
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -59,40 +59,6 @@ private static IDiagnosticContext BuildCore(
}
}

public static IDiagnosticContext BuildForMetric(
string metricPath,
bool isFeatureBoundaryCodePoint = false,
MetricsType[]? metricsTypesOverride = null)
{
return BuildForMetric(
metricPath,
true,
isFeatureBoundaryCodePoint,
metricsTypesOverride);
}

public static IDiagnosticContext TryBuildForMetric(
string metricPath,
bool isFeatureBoundaryCodePoint = false,
MetricsType[]? metricsTypesOverride = null)
{
return BuildForMetric(
metricPath,
false,
isFeatureBoundaryCodePoint,
metricsTypesOverride);
}

private static IDiagnosticContext BuildForMetric(
#pragma warning disable IDE0060 // Remove unused parameter
string metricPath,
bool isPluginRequired,
bool isFeatureBoundaryCodePoint,
MetricsType[]? metricsTypesOverride)
#pragma warning restore IDE0060 // Remove unused parameter
{
return new NullDiagnosticContext();
}

public static IDiagnosticContext BuildCustom(
Func<IDiagnosticContext> diagnosticContextProvider,
Expand All @@ -106,21 +72,4 @@ private static bool IsInDiagnosticContextCreation
get => (bool?)CallContext.LogicalGetData(DiagnosticContextCreationLogicalCallContextKey) ?? false;
set => CallContext.LogicalSetData(DiagnosticContextCreationLogicalCallContextKey, value ? true : null);
}

/// <summary>
/// Сделан для мест в которых еще недоступен ApplicationHostController и нет возможности получить плагин
/// </summary>
/// <param name="metricsItem">Пустая метрика транзакции</param>
/// <returns>DiagnosticContext либо NullDiagnosticContext если произошла ошибка.</returns>
internal static IDiagnosticContext BuildForMetricsItem(DiagnosticContextMetricsItem metricsItem)
{
try
{
return new DiagnosticContext(metricsItem);
}
catch (Exception)
{
return new NullDiagnosticContext();
}
}
}
3 changes: 2 additions & 1 deletion src/DiagnosticContext.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</s:String></wpf:ResourceDictionary>
limitations under the License.</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<PackageTags>diagnostics</PackageTags>
</PropertyGroup>
<PropertyGroup>
<VersionMajor>9</VersionMajor>
<VersionMinor>1</VersionMinor>
<VersionMajor>10</VersionMajor>
<VersionMinor>0</VersionMinor>
<BuildNumber>$(BuildNumber)</BuildNumber>
<BuildNumber Condition="'$(BuildNumber)' == ''">0</BuildNumber>
<PackageVersion>$(VersionMajor).$(VersionMinor).$(BuildNumber)</PackageVersion>
Expand Down

0 comments on commit 0ab98e1

Please sign in to comment.