< Summary

Information
Class: IceRpc.Telemetry.Internal.StatusCodeExtensions
Assembly: IceRpc.Telemetry
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Telemetry/Internal/StatusCodeExtensions.cs
Tag: 2300_35243572715
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 15
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToErrorType(...)100%22100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Telemetry/Internal/StatusCodeExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace IceRpc.Telemetry.Internal;
 4
 5/// <summary>Provides an extension method for <see cref="StatusCode" /> to identify a failure in the
 6/// <c>error.type</c> tag of an activity.</summary>
 7internal static class StatusCodeExtensions
 8{
 9    /// <summary>Gets the <c>error.type</c> of a failure status code. <see cref="StatusCode" /> is an unchecked enum, so
 10    /// an undefined value maps to <c>_OTHER</c> to keep the cardinality of <c>error.type</c> bounded.</summary>
 11    /// <param name="statusCode">The failure status code.</param>
 12    /// <returns>The name of <paramref name="statusCode" /> when it is defined; otherwise, <c>_OTHER</c>.</returns>
 13    internal static string ToErrorType(this StatusCode statusCode) =>
 1514        Enum.IsDefined(statusCode) ? statusCode.ToString() : "_OTHER";
 15}

Methods/Properties

ToErrorType(IceRpc.StatusCode)