public void AddTags(IRequestSpan span)
 {
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalHostname, ((IPEndPoint)LocalEndPoint).Address.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalPort, ((IPEndPoint)LocalEndPoint).Port.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemoteHostname, ((IPEndPoint)EndPoint).Address.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemotePort, ((IPEndPoint)EndPoint).Port.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalId, ConnectionId.ToString());
 }
Example #2
0
 public static void AddTags(this IConnection connection, IRequestSpan span)
 {
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalHostname, connection.LocalEndPoint.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalPort, ((IPEndPoint)connection.LocalEndPoint).Port.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemoteHostname, connection.EndPoint.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemotePort, ((IPEndPoint)connection.EndPoint).Port.ToString());
     span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalId, connection.ConnectionId.ToString());
 }
        internal static IRequestSpan WithRemoteAddress(this IRequestSpan span, Uri remoteUri)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemoteHostname, remoteUri.Host);
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.RemotePort, $"{remoteUri.Port}");
            }

            return(span);
        }
 private static void AddCompressionTags(IRequestSpan span, double ratio, bool used)
 {
     if (span.CanWrite)
     {
         span.SetAttribute(InnerRequestSpans.CompressionSpan.Attributes.CompressionRatio,
                           ratio.ToString("0.0000", CultureInfo.InvariantCulture));
         span.SetAttribute(InnerRequestSpans.CompressionSpan.Attributes.CompressionUsed,
                           used);
     }
 }
        public static IRequestSpan WithCommonTags(this IRequestSpan span)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(OuterRequestSpans.Attributes.System.Key, OuterRequestSpans.Attributes.System.Value);
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.NetTransport.Key,
                                  InnerRequestSpans.DispatchSpan.Attributes.NetTransport.Value);
            }

            return(span);
        }
        internal static IRequestSpan WithOperationId(this IRequestSpan span, AnalyticsOptions request)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.OperationId, request.ClientContextIdValue ?? Guid.NewGuid().ToString());
            }

            return(span);
        }
        internal static IRequestSpan WithOperationId(this IRequestSpan span, QueryOptions options)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.OperationId, options.CurrentContextId ?? Guid.NewGuid().ToString());
            }

            return(span);
        }
        internal static IRequestSpan WithOperationId(this IRequestSpan span, IOperation operation)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.OperationId, operation.Opaque);
            }

            return(span);
        }
        internal static IRequestSpan WithOperation(this IRequestSpan span, string operation)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(OuterRequestSpans.Attributes.Operation, operation);
            }

            return(span);
        }
        internal static IRequestSpan WithStatement(this IRequestSpan span, string statement)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(OuterRequestSpans.Attributes.Statement, statement);
            }

            return(span);
        }
        internal static IRequestSpan WithLocalAddress(this IRequestSpan span)
        {
            if (span.CanWrite)
            {
                span.SetAttribute(InnerRequestSpans.DispatchSpan.Attributes.LocalHostname, _dnsHostName ??= Dns.GetHostName());
            }

            return(span);
        }
        public static IRequestSpan LogOrphaned(this IRequestSpan span)
        {
            try
            {
                if (span.CanWrite)
                {
                    span.SetAttribute("orphaned", "true");
                }
            }
            catch
            {
                //ignore likely a duplicate attribute
            }

            return(span);
        }