Upgrade stylecop to 1.2.0-beta.354 (#2602)
This commit is contained in:
parent
427e50a38a
commit
df756ee50d
|
|
@ -40,7 +40,7 @@
|
||||||
<OpenTracingPkgVer>[0.12.1,0.13)</OpenTracingPkgVer>
|
<OpenTracingPkgVer>[0.12.1,0.13)</OpenTracingPkgVer>
|
||||||
<OTelPreviousStableVer>1.1.0</OTelPreviousStableVer>
|
<OTelPreviousStableVer>1.1.0</OTelPreviousStableVer>
|
||||||
<StackExchangeRedisPkgVer>[2.1.58,3.0)</StackExchangeRedisPkgVer>
|
<StackExchangeRedisPkgVer>[2.1.58,3.0)</StackExchangeRedisPkgVer>
|
||||||
<StyleCopAnalyzersPkgVer>[1.1.118,2.0)</StyleCopAnalyzersPkgVer>
|
<StyleCopAnalyzersPkgVer>[1.2.0-beta.354,2.0)</StyleCopAnalyzersPkgVer>
|
||||||
<SystemCollectionsImmutablePkgVer>1.4.0</SystemCollectionsImmutablePkgVer>
|
<SystemCollectionsImmutablePkgVer>1.4.0</SystemCollectionsImmutablePkgVer>
|
||||||
<SystemDiagnosticSourcePkgVer>6.0.0</SystemDiagnosticSourcePkgVer>
|
<SystemDiagnosticSourcePkgVer>6.0.0</SystemDiagnosticSourcePkgVer>
|
||||||
<SystemReflectionEmitLightweightPkgVer>4.7.0</SystemReflectionEmitLightweightPkgVer>
|
<SystemReflectionEmitLightweightPkgVer>4.7.0</SystemReflectionEmitLightweightPkgVer>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
<Description Resource="OpenTelemetrySDKRules_Description" />
|
<Description Resource="OpenTelemetrySDKRules_Description" />
|
||||||
</Localization>
|
</Localization>
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||||
<!-- SA1000 KeywordsMustBeSpacedCorrectly https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3214 -->
|
<Rule Id="SA1000" Action="Warning" />
|
||||||
<Rule Id="SA1000" Action="None" />
|
|
||||||
<Rule Id="SA1001" Action="Warning" />
|
<Rule Id="SA1001" Action="Warning" />
|
||||||
<Rule Id="SA1002" Action="Warning" />
|
<Rule Id="SA1002" Action="Warning" />
|
||||||
<Rule Id="SA1003" Action="Warning" />
|
<Rule Id="SA1003" Action="Warning" />
|
||||||
|
|
@ -126,7 +125,7 @@
|
||||||
<Rule Id="SA1515" Action="None" />
|
<Rule Id="SA1515" Action="None" />
|
||||||
<Rule Id="SA1516" Action="Warning" />
|
<Rule Id="SA1516" Action="Warning" />
|
||||||
<Rule Id="SA1517" Action="Warning" />
|
<Rule Id="SA1517" Action="Warning" />
|
||||||
<Rule Id="SA1518" Action="Warning" />
|
<Rule Id="SA1518" Action="None" />
|
||||||
<Rule Id="SA1519" Action="Warning" />
|
<Rule Id="SA1519" Action="Warning" />
|
||||||
<Rule Id="SA1520" Action="Warning" />
|
<Rule Id="SA1520" Action="Warning" />
|
||||||
<Rule Id="SA1600" Action="None" />
|
<Rule Id="SA1600" Action="None" />
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,10 @@
|
||||||
<Description Resource="OpenTelemetrySDKRules_Description" />
|
<Description Resource="OpenTelemetrySDKRules_Description" />
|
||||||
</Localization>
|
</Localization>
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||||
<!-- SA1000 KeywordsMustBeSpacedCorrectly https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3214 -->
|
|
||||||
<Rule Id="SA1000" Action="None" />
|
|
||||||
<Rule Id="SA1200" Action="None" />
|
<Rule Id="SA1200" Action="None" />
|
||||||
<Rule Id="SA1401" Action="None" />
|
<Rule Id="SA1401" Action="None" />
|
||||||
<Rule Id="SA1512" Action="None" />
|
<Rule Id="SA1512" Action="None" />
|
||||||
|
<Rule Id="SA1518" Action="None" />
|
||||||
<Rule Id="SA1600" Action="None" />
|
<Rule Id="SA1600" Action="None" />
|
||||||
</Rules>
|
</Rules>
|
||||||
</RuleSet>
|
</RuleSet>
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
</Localization>
|
</Localization>
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||||
<Rule Id="SA0001" Action="None" />
|
<Rule Id="SA0001" Action="None" />
|
||||||
<!-- SA1000 KeywordsMustBeSpacedCorrectly https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3214 -->
|
|
||||||
<Rule Id="SA1000" Action="None" />
|
|
||||||
<Rule Id="SA1200" Action="None" />
|
<Rule Id="SA1200" Action="None" />
|
||||||
<Rule Id="SA1401" Action="None" />
|
<Rule Id="SA1401" Action="None" />
|
||||||
<Rule Id="SA1512" Action="None" />
|
<Rule Id="SA1512" Action="None" />
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ namespace Examples.Console
|
||||||
{
|
{
|
||||||
"grpc" => OtlpExportProtocol.Grpc,
|
"grpc" => OtlpExportProtocol.Grpc,
|
||||||
"http/protobuf" => OtlpExportProtocol.HttpProtobuf,
|
"http/protobuf" => OtlpExportProtocol.HttpProtobuf,
|
||||||
_ => null
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,12 @@ namespace OpenTelemetry.Exporter.Jaeger.Implementation
|
||||||
internal enum JaegerSpanRefType
|
internal enum JaegerSpanRefType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A child span
|
/// A child span.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CHILD_OF = 0,
|
CHILD_OF = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A sibling span
|
/// A sibling span.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
FOLLOWS_FROM = 1,
|
FOLLOWS_FROM = 1,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,27 +22,27 @@ namespace OpenTelemetry.Exporter.Jaeger.Implementation
|
||||||
internal enum JaegerTagType
|
internal enum JaegerTagType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag contains a string
|
/// Tag contains a string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
STRING = 0,
|
STRING = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag contains a double
|
/// Tag contains a double.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DOUBLE = 1,
|
DOUBLE = 1,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag contains a boolean
|
/// Tag contains a boolean.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BOOL = 2,
|
BOOL = 2,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag contains a long
|
/// Tag contains a long.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LONG = 3,
|
LONG = 3,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tag contains binary data
|
/// Tag contains binary data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BINARY = 4,
|
BINARY = 4,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ namespace OpenTelemetry.Exporter
|
||||||
{
|
{
|
||||||
OtlpExportProtocol.Grpc => new OtlpGrpcTraceExportClient(options),
|
OtlpExportProtocol.Grpc => new OtlpGrpcTraceExportClient(options),
|
||||||
OtlpExportProtocol.HttpProtobuf => new OtlpHttpTraceExportClient(options),
|
OtlpExportProtocol.HttpProtobuf => new OtlpHttpTraceExportClient(options),
|
||||||
_ => throw new NotSupportedException($"Protocol {options.Protocol} is not supported.")
|
_ => throw new NotSupportedException($"Protocol {options.Protocol} is not supported."),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static OtlpExportProtocol? ToOtlpExportProtocol(this string protocol) =>
|
public static OtlpExportProtocol? ToOtlpExportProtocol(this string protocol) =>
|
||||||
|
|
@ -100,7 +100,7 @@ namespace OpenTelemetry.Exporter
|
||||||
{
|
{
|
||||||
"grpc" => OtlpExportProtocol.Grpc,
|
"grpc" => OtlpExportProtocol.Grpc,
|
||||||
"http/protobuf" => OtlpExportProtocol.HttpProtobuf,
|
"http/protobuf" => OtlpExportProtocol.HttpProtobuf,
|
||||||
_ => null
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Uri AppendPathIfNotPresent(this Uri uri, string path)
|
public static Uri AppendPathIfNotPresent(this Uri uri, string path)
|
||||||
|
|
|
||||||
|
|
@ -143,20 +143,20 @@ namespace OpenTelemetry.Exporter.Prometheus
|
||||||
|
|
||||||
if (TryGetMetric(ref enumerator, out var state))
|
if (TryGetMetric(ref enumerator, out var state))
|
||||||
{
|
{
|
||||||
await WriteMetric(stream, getUtcNowDateTimeOffset, buffer, metricInfo, metricInfo.HistogramSumUtf8, state.keys, state.values, state.sum).ConfigureAwait(false);
|
await WriteMetric(stream, getUtcNowDateTimeOffset, buffer, metricInfo, metricInfo.HistogramSumUtf8, state.Keys, state.Values, state.Sum).ConfigureAwait(false);
|
||||||
|
|
||||||
await WriteMetric(stream, getUtcNowDateTimeOffset, buffer, metricInfo, metricInfo.HistogramCountUtf8, state.keys, state.values, state.count).ConfigureAwait(false);
|
await WriteMetric(stream, getUtcNowDateTimeOffset, buffer, metricInfo, metricInfo.HistogramCountUtf8, state.Keys, state.Values, state.Count).ConfigureAwait(false);
|
||||||
|
|
||||||
if (state.explicitBounds != null)
|
if (state.ExplicitBounds != null)
|
||||||
{
|
{
|
||||||
long totalCount = 0;
|
long totalCount = 0;
|
||||||
for (int i = 0; i < state.explicitBounds.Length + 1; i++)
|
for (int i = 0; i < state.ExplicitBounds.Length + 1; i++)
|
||||||
{
|
{
|
||||||
totalCount += state.bucketCounts[i];
|
totalCount += state.BucketCounts[i];
|
||||||
|
|
||||||
byte[] bucketValueUtf8 = i == state.explicitBounds.Length
|
byte[] bucketValueUtf8 = i == state.ExplicitBounds.Length
|
||||||
? PrometheusHistogramBucketLabelPositiveInfinityUtf8
|
? PrometheusHistogramBucketLabelPositiveInfinityUtf8
|
||||||
: metricInfo.GetBucketUtf8(state.explicitBounds[i]);
|
: metricInfo.GetBucketUtf8(state.ExplicitBounds[i]);
|
||||||
|
|
||||||
await WriteMetric(
|
await WriteMetric(
|
||||||
stream,
|
stream,
|
||||||
|
|
@ -164,8 +164,8 @@ namespace OpenTelemetry.Exporter.Prometheus
|
||||||
buffer,
|
buffer,
|
||||||
metricInfo,
|
metricInfo,
|
||||||
metricInfo.HistogramBucketUtf8,
|
metricInfo.HistogramBucketUtf8,
|
||||||
state.keys,
|
state.Keys,
|
||||||
state.values,
|
state.Values,
|
||||||
totalCount,
|
totalCount,
|
||||||
additionalKvp: new KeyValuePair<byte[], byte[]>(PrometheusHistogramBucketLabelLessThanUtf8, bucketValueUtf8)).ConfigureAwait(false);
|
additionalKvp: new KeyValuePair<byte[], byte[]>(PrometheusHistogramBucketLabelLessThanUtf8, bucketValueUtf8)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ namespace OpenTelemetry.Exporter.Prometheus
|
||||||
|
|
||||||
static bool TryGetMetric(
|
static bool TryGetMetric(
|
||||||
ref BatchMetricPoint.Enumerator enumerator,
|
ref BatchMetricPoint.Enumerator enumerator,
|
||||||
out (string[] keys, object[] values, double sum, long count, double[] explicitBounds, long[] bucketCounts) state)
|
out (string[] Keys, object[] Values, double Sum, long Count, double[] ExplicitBounds, long[] BucketCounts) state)
|
||||||
{
|
{
|
||||||
if (!enumerator.MoveNext())
|
if (!enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@ namespace OpenTelemetry.Exporter.Prometheus
|
||||||
{
|
{
|
||||||
#if NETCOREAPP3_1_OR_GREATER
|
#if NETCOREAPP3_1_OR_GREATER
|
||||||
private static readonly SpanAction<char, (string, Func<char, bool, bool>)> CreateName
|
private static readonly SpanAction<char, (string, Func<char, bool, bool>)> CreateName
|
||||||
= (Span<char> data, (string name, Func<char, bool, bool> isCharacterAllowedFunc) state) =>
|
= (Span<char> data, (string Name, Func<char, bool, bool> IsCharacterAllowedFunc) state) =>
|
||||||
{
|
{
|
||||||
for (var i = 0; i < state.name.Length; i++)
|
for (var i = 0; i < state.Name.Length; i++)
|
||||||
{
|
{
|
||||||
var c = state.name[i];
|
var c = state.Name[i];
|
||||||
data[i] = state.isCharacterAllowedFunc(c, i == 0)
|
data[i] = state.IsCharacterAllowedFunc(c, i == 0)
|
||||||
? c
|
? c
|
||||||
: '_';
|
: '_';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
// </copyright>
|
// </copyright>
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
|
|
@ -54,11 +55,11 @@ namespace OpenTelemetry.Exporter.Zipkin.Implementation
|
||||||
return new ZipkinEndpoint(serviceName);
|
return new ZipkinEndpoint(serviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ZipkinEndpoint Create((string name, int port) serviceNameAndPort)
|
public static ZipkinEndpoint Create((string Name, int Port) serviceNameAndPort)
|
||||||
{
|
{
|
||||||
var serviceName = serviceNameAndPort.port == default
|
var serviceName = serviceNameAndPort.Port == default
|
||||||
? serviceNameAndPort.name
|
? serviceNameAndPort.Name
|
||||||
: $"{serviceNameAndPort.name}:{serviceNameAndPort.port}";
|
: $"{serviceNameAndPort.Name}:{serviceNameAndPort.Port}";
|
||||||
|
|
||||||
return new ZipkinEndpoint(serviceName);
|
return new ZipkinEndpoint(serviceName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ namespace OpenTelemetry.Trace
|
||||||
{
|
{
|
||||||
SamplingDecision.RecordAndSample => ActivitySamplingResult.AllDataAndRecorded,
|
SamplingDecision.RecordAndSample => ActivitySamplingResult.AllDataAndRecorded,
|
||||||
SamplingDecision.RecordOnly => ActivitySamplingResult.AllData,
|
SamplingDecision.RecordOnly => ActivitySamplingResult.AllData,
|
||||||
_ => ActivitySamplingResult.PropagationData
|
_ => ActivitySamplingResult.PropagationData,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (activitySamplingResult != ActivitySamplingResult.PropagationData)
|
if (activitySamplingResult != ActivitySamplingResult.PropagationData)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,8 @@ public partial class Program
|
||||||
output = $"Loops: {cntLoopsNew:n0}, Loops/Second: {nLoopsPerSecond:n0}, CPU Cycles/Loop: {nCpuCyclesPerLoop:n0}";
|
output = $"Loops: {cntLoopsNew:n0}, Loops/Second: {nLoopsPerSecond:n0}, CPU Cycles/Loop: {nCpuCyclesPerLoop:n0}";
|
||||||
Console.Title = output;
|
Console.Title = output;
|
||||||
}
|
}
|
||||||
}, () =>
|
},
|
||||||
|
() =>
|
||||||
{
|
{
|
||||||
Parallel.For(0, concurrency, (i) =>
|
Parallel.For(0, concurrency, (i) =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -518,9 +518,7 @@ namespace OpenTelemetry.Resources.Tests
|
||||||
var endInd = endIndex == 0 ? keyValuePairs.Length - 1 : endIndex;
|
var endInd = endIndex == 0 ? keyValuePairs.Length - 1 : endIndex;
|
||||||
for (var i = startIndex; i <= endInd; ++i)
|
for (var i = startIndex; i <= endInd; ++i)
|
||||||
{
|
{
|
||||||
Assert.Contains(
|
Assert.Contains(new KeyValuePair<string, object>($"{KeyName}{i}", $"{ValueName}{i}"), keyValuePairs);
|
||||||
new KeyValuePair<string, object>(
|
|
||||||
$"{KeyName}{i}", $"{ValueName}{i}"), keyValuePairs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue