public void ActorMessageFailed(
     string methodName,
     CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers,
     System.Exception ex)
 {
     WebApiServiceEventSource.Current.ActorMessageFailed(
         _context,
         methodName,
         headers,
         ex
         );
     _telemetryClient.TrackException(
         ex,
         new System.Collections.Generic.Dictionary <string, string>()
     {
         { "Name", "ActorMessageFailed" },
         { "ServiceName", _context.ServiceName.ToString() },
         { "ServiceTypeName", _context.ServiceTypeName },
         { "ReplicaOrInstanceId", _context.InstanceId.ToString() },
         { "PartitionId", _context.PartitionId.ToString() },
         { "ApplicationName", _context.CodePackageActivationContext.ApplicationName },
         { "ApplicationTypeName", _context.CodePackageActivationContext.ApplicationTypeName },
         { "NodeName", _context.NodeContext.NodeName },
         { "MethodName", methodName },
         { "User", headers?.GetHeader("name") },
         { "CorrelationId", headers?.GetHeader("correlation-id") },
         { "Message", ex.Message },
         { "Source", ex.Source },
         { "ExceptionTypeName", ex.GetType().FullName },
         { "Exception", ex.AsJson() }
     });
 }
 public void ActorMessageDispatched(
     string methodName,
     CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
 {
     WebApiServiceEventSource.Current.ActorMessageDispatched(
         _context,
         methodName,
         headers
         );
     _telemetryClient.TrackEvent(
         nameof(ActorMessageDispatched),
         new System.Collections.Generic.Dictionary <string, string>()
     {
         { "ServiceName", _context.ServiceName.ToString() },
         { "ServiceTypeName", _context.ServiceTypeName },
         { "ReplicaOrInstanceId", _context.InstanceId.ToString() },
         { "PartitionId", _context.PartitionId.ToString() },
         { "ApplicationName", _context.CodePackageActivationContext.ApplicationName },
         { "ApplicationTypeName", _context.CodePackageActivationContext.ApplicationTypeName },
         { "NodeName", _context.NodeContext.NodeName },
         { "MethodName", methodName },
         { "User", headers?.GetHeader("name") },
         { "CorrelationId", headers?.GetHeader("correlation-id") }
     });
 }
 public void StopCallService(
     System.Uri requestUri,
     CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
 {
     WebApiServiceEventSource.Current.StopCallService(
         _context,
         requestUri,
         headers
         );
 }
        public void StopActorMessageRecieved(
            string methodName,
            CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
        {
            WebApiServiceEventSource.Current.StopActorMessageRecieved(
                _context,
                methodName,
                headers
                );
            var actorMessageRecievedOperationHolder = OperationHolder.StopOperation();

            _telemetryClient.StopOperation(actorMessageRecievedOperationHolder);
            actorMessageRecievedOperationHolder.Dispose();
        }
        public void StopMessageSend(
            System.Uri requestUri,
            CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
        {
            WebApiServiceEventSource.Current.StopMessageSend(
                _context,
                requestUri,
                headers
                );
            var messageSendOperationHolder = OperationHolder.StopOperation();

            _telemetryClient.StopOperation(messageSendOperationHolder);
            messageSendOperationHolder.Dispose();
        }
        public void StartMessageSend(
            System.Uri requestUri,
            CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
        {
            WebApiServiceEventSource.Current.StartMessageSend(
                _context,
                requestUri,
                headers
                );

            var messageSendOperationHolder = _telemetryClient.StartOperation <RequestTelemetry>(requestUri.ToString());

            messageSendOperationHolder.Telemetry.Properties.Add("ServiceName", _context.ServiceName.ToString());
            messageSendOperationHolder.Telemetry.Properties.Add("ServiceTypeName", _context.ServiceTypeName);
            messageSendOperationHolder.Telemetry.Properties.Add("ReplicaOrInstanceId", _context.InstanceId.ToString());
            messageSendOperationHolder.Telemetry.Properties.Add("PartitionId", _context.PartitionId.ToString());
            messageSendOperationHolder.Telemetry.Properties.Add("ApplicationName", _context.CodePackageActivationContext.ApplicationName);
            messageSendOperationHolder.Telemetry.Properties.Add("ApplicationTypeName", _context.CodePackageActivationContext.ApplicationTypeName);
            messageSendOperationHolder.Telemetry.Properties.Add("NodeName", _context.NodeContext.NodeName);
            messageSendOperationHolder.Telemetry.Properties.Add("RequestUri", requestUri.ToString());
            messageSendOperationHolder.Telemetry.Properties.Add("User", headers?.GetHeader("name"));
            messageSendOperationHolder.Telemetry.Properties.Add("CorrelationId", headers?.GetHeader("correlation-id"));
            OperationHolder.StartOperation(messageSendOperationHolder);
        }
        public System.IDisposable CallService(
            System.Uri requestUri,
            CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
        {
            WebApiServiceEventSource.Current.StartCallService(
                _context,
                requestUri,
                headers
                );

            var callServiceOperationHolder = _telemetryClient.StartOperation <DependencyTelemetry>(requestUri.ToString());

            callServiceOperationHolder.Telemetry.Properties.Add("ServiceName", _context.ServiceName.ToString());
            callServiceOperationHolder.Telemetry.Properties.Add("ServiceTypeName", _context.ServiceTypeName);
            callServiceOperationHolder.Telemetry.Properties.Add("ReplicaOrInstanceId", _context.InstanceId.ToString());
            callServiceOperationHolder.Telemetry.Properties.Add("PartitionId", _context.PartitionId.ToString());
            callServiceOperationHolder.Telemetry.Properties.Add("ApplicationName", _context.CodePackageActivationContext.ApplicationName);
            callServiceOperationHolder.Telemetry.Properties.Add("ApplicationTypeName", _context.CodePackageActivationContext.ApplicationTypeName);
            callServiceOperationHolder.Telemetry.Properties.Add("NodeName", _context.NodeContext.NodeName);
            callServiceOperationHolder.Telemetry.Properties.Add("RequestUri", requestUri.ToString());
            callServiceOperationHolder.Telemetry.Properties.Add("User", headers?.GetHeader("name"));
            callServiceOperationHolder.Telemetry.Properties.Add("CorrelationId", headers?.GetHeader("correlation-id"));
            return(new ScopeWrapper <DependencyTelemetry>(_telemetryClient, callServiceOperationHolder, () => StopCallService(requestUri, headers)));
        }
        public void StartActorMessageRecieved(
            string methodName,
            CodeEffect.ServiceFabric.Services.Remoting.FabricTransport.CustomServiceRequestHeader headers)
        {
            WebApiServiceEventSource.Current.StartActorMessageRecieved(
                _context,
                methodName,
                headers
                );

            var actorMessageRecievedOperationHolder = _telemetryClient.StartOperation <RequestTelemetry>("actorMessageRecieved");

            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("ServiceName", _context.ServiceName.ToString());
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("ServiceTypeName", _context.ServiceTypeName);
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("ReplicaOrInstanceId", _context.InstanceId.ToString());
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("PartitionId", _context.PartitionId.ToString());
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("ApplicationName", _context.CodePackageActivationContext.ApplicationName);
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("ApplicationTypeName", _context.CodePackageActivationContext.ApplicationTypeName);
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("NodeName", _context.NodeContext.NodeName);
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("MethodName", methodName);
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("User", headers?.GetHeader("name"));
            actorMessageRecievedOperationHolder.Telemetry.Properties.Add("CorrelationId", headers?.GetHeader("correlation-id"));
            OperationHolder.StartOperation(actorMessageRecievedOperationHolder);
        }