コード例 #1
0
        public IOperation CreateOperation(string operationName, byte[] correlationContext)
        {
            try
            {
                byte[]             capturedCorrelationContext = this.CorrelationContext.Capture();
                CorrelationContext localCorrelationcontext    = new CorrelationContext(correlationContext);

                long newOperationId = localCorrelationcontext.AddOperation();

                string newOperationIdString = newOperationId.GetBase64String();
                if (string.IsNullOrWhiteSpace(operationName))
                {
                    Diag("Attempting to create operation with null name. Resetting to randomized value. c7eyVLlbyUM");
                    operationName = "ERR_NO_OPERATION_NAME " + newOperationIdString;
                }

                string cc = localCorrelationcontext.ToString();

                this.CorrelationContext = localCorrelationcontext;

                IOperation createdOperation = new ApplicationInsightsOperation(this, operationName, newOperationId.GetBase64String(), cc);

                return(createdOperation);
            }
            catch (Exception ex)
            {
                DiagnosticTrace.Instance.Error("An unexpected error occurred when attempting to create an operation", ex, "7AKlKXaBwkM");

                return(new NullOperation());
            }
        }
コード例 #2
0
ファイル: TraceTelemetron.cs プロジェクト: pink-hair/Common
        public IOperation CreateOperation(string operationName, byte[] parentContext)
        {
            try
            {
                byte[] capturedCorrelationContext = this.CorrelationContext.Capture();

                CorrelationContext localCorrelationcontext = new CorrelationContext(parentContext);

                long newOperationId = localCorrelationcontext.AddOperation();

                string newOperationIdString = newOperationId.GetBase64String();
                if (string.IsNullOrWhiteSpace(operationName))
                {
                    Diag("Attempting to create operation with null name. Resetting to randomized value. 5NYq0XFr1UM");
                    operationName = "ERR_NO_OPERATION_NAME " + newOperationIdString;
                }

                string cc = localCorrelationcontext.ToString();

                this.CorrelationContext = localCorrelationcontext;

                IOperation createdOperation = new TraceOperation(this, operationName, newOperationIdString, cc);

                return(createdOperation);
            }
            catch (Exception ex)
            {
                DiagnosticTrace.Instance.Error("An unexpected error occurred when attempting to create an operation", ex, "cd11de1d-c4b6-406c-937e-37bc85eb4370");

                return(new NullOperation());
            }
        }
コード例 #3
0
ファイル: TestTelemetron.cs プロジェクト: pink-hair/Common
        public IOperation CreateOperation(string operationName, byte[] parentContext)
        {
            try
            {
                byte[] capturedCorrelationContext = this.CorrelationContext.Capture();

                CorrelationContext localCorrelationcontext = new CorrelationContext(parentContext);

                long   newOperationId = localCorrelationcontext.AddOperation();
                string cc             = localCorrelationcontext.ToString();

                this.CorrelationContext = localCorrelationcontext;

                IOperation createdOperation = new TestOperation(this, operationName, newOperationId.GetBase64String(), cc);

                return(createdOperation);
            }
            catch (Exception ex)
            {
                DiagnosticTrace.Instance.Error("An unexpected error occurred when attempting to create an operation", ex, "cd11de1d-c4b6-406c-937e-37bc85eb4370");

                return(new NullOperation());
            }
        }