public StatelessRunnerServiceLogger( System.Fabric.ServiceContext context) { _context = context; _telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient(); _telemetryClient.Context.User.Id = Environment.UserName; _telemetryClient.Context.Session.Id = Guid.NewGuid().ToString(); _telemetryClient.Context.Device.OperatingSystem = Environment.OSVersion.ToString(); }
public void StopRunAsyncLoop( System.Fabric.ServiceContext context) { if (this.IsEnabled()) { StopRunAsyncLoop( context.ServiceName.ToString(), context.ServiceTypeName, context.GetReplicaOrInstanceId(), context.PartitionId, context.CodePackageActivationContext.ApplicationName, context.CodePackageActivationContext.ApplicationTypeName, context.NodeContext.NodeName); } }
public static void Initialize(System.Fabric.ServiceContext context) { ApplicationName = context.CodePackageActivationContext.ApplicationName; string typeName = context.CodePackageActivationContext.ApplicationTypeName; typeName = typeName.Remove(typeName.Length - 4, 4); string unqualifiedApplicationName = $"{Constant.FabricScheme}/{typeName}"; string environmentName = ApplicationName.Replace(unqualifiedApplicationName, ""); if (environmentName.Length > 1) { // remove the . character to get the environment name extracted EnvironmentName = environmentName.Substring(1, environmentName.Length - 1); } }
public void Waiting( System.Fabric.ServiceContext context, int milliseconds) { if (this.IsEnabled()) { Waiting( context.ServiceName.ToString(), context.ServiceTypeName, context.GetReplicaOrInstanceId(), context.PartitionId, context.CodePackageActivationContext.ApplicationName, context.CodePackageActivationContext.ApplicationTypeName, context.NodeContext.NodeName, milliseconds); } }
public void RunAsyncWorkCompleted( System.Fabric.ServiceContext context, int iteration) { if (this.IsEnabled()) { RunAsyncWorkCompleted( context.ServiceName.ToString(), context.ServiceTypeName, context.GetReplicaOrInstanceId(), context.PartitionId, context.CodePackageActivationContext.ApplicationName, context.CodePackageActivationContext.ApplicationTypeName, context.NodeContext.NodeName, iteration); } }
public static long GetReplicaOrInstanceId(this System.Fabric.ServiceContext context) { var stateless = context as System.Fabric.StatelessServiceContext; if (stateless != null) { return(stateless.InstanceId); } var stateful = context as System.Fabric.StatefulServiceContext; if (stateful != null) { return(stateful.ReplicaId); } throw new NotSupportedException("Context type not supported."); }