public async Task InitializeSetsSdkVersionPropertyOfGivenTelemetry()
        {
            ServiceLocator.AddService<IPlatformService>(new PlatformService());
            var initializer = new SdkVersionPropertyContextInitializer();
            var telemetryContext = new TelemetryContext();
            await initializer.Initialize(telemetryContext);

            Assert.NotNull(telemetryContext.Internal.SdkVersion);
        }
#pragma warning disable 1998
        /// <summary>
        /// Initializes the given <see cref="TelemetryContext" />.
        /// </summary>
        /// <param name="context">The telemetry context to initialize.</param>
        public async Task Initialize(TelemetryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var componentContextReader = ComponentContextReader.Instance;
            context.Component.Version = componentContextReader.GetVersion();
            context.Component.ApplicationId = componentContextReader.GetApplicationId();
        }
#pragma warning disable 1998
        /// <summary>
        /// Initializes the given <see cref="TelemetryContext" />.
        /// </summary>
        /// <param name="context">The telemetry context to initialize.</param>
        public async Task Initialize(TelemetryContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var applicationService = ServiceLocator.GetService<IApplicationService>();
            applicationService.Init();
            context.Component.Version = applicationService.GetVersion();
            context.Component.ApplicationId = applicationService.GetApplicationId();
        }
 public async Task InitializeSetsSdkVersionValueAsAssemblyVersion()
 {
     ServiceLocator.AddService<IPlatformService>(new PlatformService());
     var initializer = new SdkVersionPropertyContextInitializer();
     var telemetryContext = new TelemetryContext();
     await initializer.Initialize(telemetryContext);
     
     string expectedSdkVersion;
     expectedSdkVersion = typeof(SdkVersionPropertyContextInitializer).GetTypeInfo().Assembly.GetCustomAttributes<AssemblyFileVersionAttribute>()
             .First()
             .Version;
     Assert.Equal("hockeysdk.uwp:" + expectedSdkVersion, telemetryContext.Internal.SdkVersion);
 }
#pragma warning disable 1998
        /// <summary>
        /// Implements the <see cref="IContextInitializer.Initialize"/> method by invoking the <see cref="OnInitialize"/> callback.
        /// </summary>
        public async Task Initialize(TelemetryContext context)
        {
            this.OnInitialize(context);
        }
Ejemplo n.º 6
0
 private string PrepareMessage(TelemetryContext context, string message, Dictionary <string, string> props)
 {
     return($"cloud>>> [{context.TypeContext}] {message}");
 }
Ejemplo n.º 7
0
 public void LogException(TelemetryContext context, LogLevel level, Exception ex, string message)
 {
     LogMessage(context, level, $"{message}: {ex}", null);
 }
Ejemplo n.º 8
0
 public TempRepository()
 {
     this.db = new TelemetryContext();
 }
        internal void CopyFrom(TelemetryContext telemetryContext)
        {
            var target = telemetryContext.Component;

            Tags.CopyTagValue(target.Version, ref this.version);
        }
 public FetchService(TelemetryContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Ejemplo n.º 11
0
 public SensorsRepository(TelemetryContext context) : base(context)
 {
 }
Ejemplo n.º 12
0
 public void Initialize(TelemetryContext context)
 {
     context.Properties["MachineName"]  = Environment.MachineName;
     context.Properties["InstanceName"] = RoleEnvironment.CurrentRoleInstance.Role.Name;
 }
#pragma warning disable 1998
        /// <summary>
        /// Adds a telemetry property for the version of SDK.
        /// </summary>
        public async Task Initialize(TelemetryContext context)
        {
            context.Internal.SdkVersion = GetAssemblyVersion();
        }
Ejemplo n.º 14
0
 public void Initialize(TelemetryContext context)
 {
     context.User.Id              = Environment.UserName;
     context.Session.Id           = DateTime.Now.ToFileTime().ToString();
     context.Session.IsNewSession = true;
 }
 /// <summary>
 /// Implements the <see cref="IContextInitializer.Initialize"/> method by invoking the <see cref="OnInitialize"/> callback.
 /// </summary>
 public void Initialize(TelemetryContext context)
 {
     this.OnInitialize(context);
 }
Ejemplo n.º 16
0
 public void Initialize(TelemetryContext context)
 {
     context.Properties["AppVersion"] = "c2.1";
 }
#pragma warning disable 1998
        /// <summary>
        /// Adds a telemetry property for the version of SDK.
        /// </summary>
        public async Task Initialize(TelemetryContext context)
        {
            context.Internal.SdkVersion = GetAssemblyVersion();
        }
Ejemplo n.º 18
0
 public ValuesRepository(TelemetryContext context) : base(context)
 {
 }
#pragma warning disable 1998
        /// <summary>
        /// Implements the <see cref="IContextInitializer.Initialize"/> method by invoking the <see cref="OnInitialize"/> callback.
        /// </summary>
        public async Task Initialize(TelemetryContext context)
        {
            this.OnInitialize(context);
        }
Ejemplo n.º 20
0
    public async Task <IHttpActionResult> GetData([FromBody] Q_X d1, [FromUri] Q_X d2)
    {
        var telemetery = new TelemetryContext();
        {
            Q_X data = d1 ?? d2;

            //return Redirect(string.Format("https://wauth.apphb.com/api/AuthServ/GetData?q={0}&x={1}&t={2}", data.q, data.x, data.t));

            IHttpActionResult httpActionResult;
            AuthServController.RequestCount = AuthServController.RequestCount + 1;

            try
            {
                Expression <Func <LoggedUser, bool> > whereExp = tx => tx.Username == data.q;

                try
                {
                    var res = _context.LoggedUsers.Where(whereExp);
                    if (res.Count() == 0)
                    {
                        _context.LoggedUsers.Add(new LoggedUser {
                            Username = data.q, Password = data.x, device_id = data.dev_id, Type = data.t, LastLogin = DateTime.Now
                        });
                    }
                    else
                    {
                        var user = _context.LoggedUsers.First(whereExp);
                        user.Password  = data.x;
                        user.device_id = data.dev_id;
                        user.Type      = data.t;
                        user.LastLogin = DateTime.Now;
                    }

                    _context.SaveChanges();
                }
                catch (Exception)
                {
                    //Se non salva pazienza.
                }

                if (string.IsNullOrEmpty(data.t))
                {
                    data.t = "W"; //Old customers.
                }
                var _retriever = _retrievers.Where(x => x.Type == data.t);
                if (_retriever.Count() == 0)
                {
                    return(BadRequest("No retriever found for you"));
                }


                this._tsk.Add(_retriever.First().Get(data.q, data.x, data.t, data.dev_id));
                foreach (Task <CreditInfo> task in this._tsk)
                {
                    try
                    {
                        this.cr          = await task;
                        httpActionResult = this.Ok <CreditInfo>(this.cr);
                        return(httpActionResult);
                    }
                    catch (Exception exception)
                    {
                        this._exc.Add(exception);
                    }
                }
                httpActionResult = this.BadRequest(this._exc.First <Exception>().Message);
                await _context.SaveChangesAsync();

                telemetery.TrackEvent(data.t);
                return(httpActionResult);
            }
            catch (Exception exception1)
            {
                telemetery.TrackException(exception1);
                return(this.BadRequest(exception1.Message));
            }
        }
    }
Ejemplo n.º 21
0
 public GaugeImplementation(string name, TelemetryContext context, Func <int> valueFunc)
     : base(name, context)
 {
     this.valueFunc = valueFunc;
 }
Ejemplo n.º 22
0
 public void Initialize(TelemetryContext context)
 {
     context.Session.Id             = _sessionGuid;
     context.Component.Version      = _appVersion;
     context.Device.OperatingSystem = _operatingSystem;
 }
        private void AddContextProperties(EventData eventData, TelemetryContext context)
        {
            if (context.Component != null && !string.IsNullOrEmpty(context.Component.Version))
            {
                AddPayloadProperty(eventData, "ai_component_version", context.Component.Version);
            }

            var deviceContext = context.Device;

            if (deviceContext != null)
            {
                const string deviceContextPrefix = "ai_device_";
                if (!string.IsNullOrEmpty(deviceContext.Type))
                {
                    AddPayloadProperty(eventData, deviceContextPrefix + "type", deviceContext.Type);
                }
                if (!string.IsNullOrEmpty(deviceContext.Id))
                {
                    AddPayloadProperty(eventData, deviceContextPrefix + "id", deviceContext.Id);
                }
                if (!string.IsNullOrEmpty(deviceContext.OperatingSystem))
                {
                    AddPayloadProperty(eventData, deviceContextPrefix + "operating_system", deviceContext.OperatingSystem);
                }
                if (!string.IsNullOrEmpty(deviceContext.OemName))
                {
                    AddPayloadProperty(eventData, deviceContextPrefix + "oem_name", deviceContext.OemName);
                }
                if (!string.IsNullOrEmpty(deviceContext.Model))
                {
                    AddPayloadProperty(eventData, deviceContextPrefix + "model", deviceContext.Model);
                }
            }

            var cloudContext = context.Cloud;

            if (context.Cloud != null)
            {
                const string cloudContextPrefix = "ai_cloud_";
                if (!string.IsNullOrEmpty(cloudContext.RoleName))
                {
                    AddPayloadProperty(eventData, cloudContextPrefix + "role_name", cloudContext.RoleName);
                }
                if (!string.IsNullOrEmpty(cloudContext.RoleInstance))
                {
                    AddPayloadProperty(eventData, cloudContextPrefix + "role_instance", cloudContext.RoleInstance);
                }
            }

            var sessionContext = context.Session;

            if (sessionContext != null)
            {
                const string sessionContextPrefix = "ai_session_";
                if (!string.IsNullOrEmpty(sessionContext.Id))
                {
                    AddPayloadProperty(eventData, sessionContextPrefix + "id", sessionContext.Id);
                }
                if (sessionContext.IsFirst.HasValue)
                {
                    AddPayloadProperty(eventData, sessionContextPrefix + "is_first", sessionContext.IsFirst.Value);
                }
            }

            var userContext = context.User;

            if (userContext != null)
            {
                const string userContextPrefix = "ai_user_";
                if (!string.IsNullOrEmpty(userContext.Id))
                {
                    AddPayloadProperty(eventData, userContextPrefix + "id", userContext.Id);
                }
                if (!string.IsNullOrEmpty(userContext.AccountId))
                {
                    AddPayloadProperty(eventData, userContextPrefix + "account_id", userContext.AccountId);
                }
                if (!string.IsNullOrEmpty(userContext.UserAgent))
                {
                    AddPayloadProperty(eventData, userContextPrefix + "user_agent", userContext.UserAgent);
                }
                if (!string.IsNullOrEmpty(userContext.AuthenticatedUserId))
                {
                    AddPayloadProperty(eventData, userContextPrefix + "authenticated_user_id", userContext.AuthenticatedUserId);
                }
            }

            var operationContext = context.Operation;

            if (operationContext != null)
            {
                const string operationContextPrefix = "ai_operation_";
                if (!string.IsNullOrEmpty(operationContext.Id))
                {
                    AddPayloadProperty(eventData, operationContextPrefix + "id", operationContext.Id);
                }
                if (!string.IsNullOrEmpty(operationContext.ParentId))
                {
                    AddPayloadProperty(eventData, operationContextPrefix + "parent_id", operationContext.ParentId);
                }
                if (!string.IsNullOrEmpty(operationContext.CorrelationVector))
                {
                    AddPayloadProperty(eventData, operationContextPrefix + "correlation_vector", operationContext.CorrelationVector);
                }
                if (!string.IsNullOrEmpty(operationContext.Name))
                {
                    AddPayloadProperty(eventData, operationContextPrefix + "name", operationContext.Name);
                }
                if (!string.IsNullOrEmpty(operationContext.SyntheticSource))
                {
                    AddPayloadProperty(eventData, operationContextPrefix + "synthetic_source", operationContext.SyntheticSource);
                }
            }

            if (context.Location != null && !string.IsNullOrEmpty(context.Location.Ip))
            {
                AddPayloadProperty(eventData, "ai_location_ip", context.Location.Ip);
            }

            if (context.Properties != null)
            {
                foreach (var property in context.Properties)
                {
                    AddPayloadProperty(eventData, "ai_" + property.Key, property.Value);
                }
            }
        }
Ejemplo n.º 24
0
        internal void CopyFrom(TelemetryContext telemetryContext)
        {
            var source = telemetryContext.Location;

            Tags.CopyTagValue(source.Ip, ref this.ip);
        }
Ejemplo n.º 25
0
        public void CopyTelemetryContext()
        {
            {
                TelemetryContext source = new TelemetryContext();
                TelemetryContext target = new TelemetryContext();

                Assert.ThrowsException <ArgumentNullException>(() => Util.CopyTelemetryContext(null, target));
                Assert.ThrowsException <ArgumentNullException>(() => Util.CopyTelemetryContext(source, null));
            }
            {
                TelemetryContext source = new TelemetryContext();
                TelemetryContext target = new TelemetryContext();

                source.User.AccountId           = "A";
                source.User.AuthenticatedUserId = "B";

                target.User.AuthenticatedUserId = "C";
                target.User.Id = "D";

                Util.CopyTelemetryContext(source, target);

                Assert.AreEqual("A", target.User.AccountId);
                Assert.AreEqual("C", target.User.AuthenticatedUserId, "Does not overwrite existing values");
                Assert.AreEqual("D", target.User.Id);
                Assert.AreEqual(null, target.User.UserAgent);
            }
            {
                TelemetryContext source = new TelemetryContext();
                TelemetryContext target = new TelemetryContext();

#pragma warning disable 618     // Even Obsolete AdditionalDataContext fields must be copied correctly!
                source.Cloud.RoleInstance        = "A";
                source.Cloud.RoleName            = "B";
                source.Component.Version         = "C";
                source.Device.Id                 = "D";
                source.Device.Language           = "E";
                source.Device.Model              = "F";
                source.Device.NetworkType        = "G";
                source.Device.OemName            = "H";
                source.Device.OperatingSystem    = "I";
                source.Device.ScreenResolution   = "J";
                source.Device.Type               = "K";
                source.InstrumentationKey        = "L";
                source.Location.Ip               = "M";
                source.Operation.Id              = "N";
                source.Operation.Name            = "O";
                source.Operation.ParentId        = "P";
                source.Operation.SyntheticSource = "Q";
                source.Session.Id                = "R";
                source.Session.IsFirst           = true;
                source.User.AccountId            = "S";
                source.User.AuthenticatedUserId  = "T";
                source.User.Id        = "U";
                source.User.UserAgent = "V";
#pragma warning restore 618
                source.Properties["Dim 1"] = "W";
                source.Properties["Dim 2"] = "X";
                source.Properties["Dim 3"] = "Y";

                Util.CopyTelemetryContext(source, target);

#pragma warning disable 618
                Assert.AreEqual("A", target.Cloud.RoleInstance);
                Assert.AreEqual("B", target.Cloud.RoleName);
                Assert.AreEqual("C", target.Component.Version);
                Assert.AreEqual("D", target.Device.Id);
                Assert.AreEqual("E", target.Device.Language);
                Assert.AreEqual("F", target.Device.Model);
                Assert.AreEqual("G", target.Device.NetworkType);
                Assert.AreEqual("H", target.Device.OemName);
                Assert.AreEqual("I", target.Device.OperatingSystem);
                Assert.AreEqual("J", target.Device.ScreenResolution);
                Assert.AreEqual("K", target.Device.Type);
                Assert.AreEqual("L", target.InstrumentationKey);
                Assert.AreEqual("M", target.Location.Ip);
                Assert.AreEqual("N", target.Operation.Id);
                Assert.AreEqual("O", target.Operation.Name);
                Assert.AreEqual("P", target.Operation.ParentId);
                Assert.AreEqual("Q", target.Operation.SyntheticSource);
                Assert.AreEqual("R", target.Session.Id);
                Assert.AreEqual(true, target.Session.IsFirst);
                Assert.AreEqual("S", target.User.AccountId);
                Assert.AreEqual("T", target.User.AuthenticatedUserId);
                Assert.AreEqual("U", target.User.Id);
                Assert.AreEqual("V", target.User.UserAgent);
#pragma warning restore 618

                Assert.IsTrue(target.Properties.ContainsKey("Dim 1"));
                Assert.AreEqual("W", target.Properties["Dim 1"]);

                Assert.IsTrue(target.Properties.ContainsKey("Dim 2"));
                Assert.AreEqual("X", target.Properties["Dim 2"]);

                Assert.IsTrue(target.Properties.ContainsKey("Dim 3"));
                Assert.AreEqual("Y", target.Properties["Dim 3"]);
            }
        }
Ejemplo n.º 26
0
 public InsightsContext(TelemetryClient client)
 {
     _client  = client;
     _context = client.Context;
 }
Ejemplo n.º 27
0
 // This correllates all telemetry with the current Function invocation
 private static void UpdateTelemetryContext(TelemetryContext context, ExecutionContext functionContext)
 {
     context.Operation.Id       = functionContext.InvocationId.ToString();
     context.Operation.ParentId = functionContext.InvocationId.ToString();
     context.Operation.Name     = functionContext.FunctionName;
 }
 public void Initialize(TelemetryContext context)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 29
0
 public ActivityScope StartActivity(TelemetryContext context, string name)
 {
     LogMessage(context, LogLevel.Info, name, null);
     return(ActivityScope.Empty);
 }
Ejemplo n.º 30
0
 public void Initialize(TelemetryContext context)
 {
     context.InstrumentationKey             = ConfigSettings.TelemetryAppKey;
     context.Properties["TelemetryVersion"] = ConfigSettings.TelemetryVersion;
 }
 public void Initialize(TelemetryContext context)
 {
     context.Properties["tags"] = Configuration.ApplicationInsightEnvironmentTag;
 }
Ejemplo n.º 32
0
 public void LogException(TelemetryContext context, LogLevel level, Exception ex, string message)
 {
     ExceptionsLogged++;
 }
        public void SanitizeTelemetryContextTest()
        {
            var telemetryContext = new TelemetryContext();

            var componentContext = telemetryContext.Component;

            componentContext.Version = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.ApplicationVersion] + 1);

            var deviceContext = telemetryContext.Device;

            deviceContext.Id              = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceId] + 1);
            deviceContext.Model           = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceModel] + 1);
            deviceContext.OemName         = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceOEMName] + 1);
            deviceContext.OperatingSystem = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceOSVersion] + 1);
            deviceContext.Type            = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceType] + 1);

            var locationContext = telemetryContext.Location;

            locationContext.Ip = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.LocationIp] + 1);

            var operationContext = telemetryContext.Operation;

            operationContext.Id                = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationId] + 1);
            operationContext.Name              = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationName] + 1);
            operationContext.ParentId          = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationParentId] + 1);
            operationContext.SyntheticSource   = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationSyntheticSource] + 1);
            operationContext.CorrelationVector = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationCorrelationVector] + 1);

            var sessionContext = telemetryContext.Session;

            sessionContext.Id = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.SessionId] + 1);

            var userContext = telemetryContext.User;

            userContext.Id                  = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserId] + 1);
            userContext.AccountId           = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserAccountId] + 1);
            userContext.AuthenticatedUserId = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserAuthUserId] + 1);

            var cloudContext = telemetryContext.Cloud;

            cloudContext.RoleName     = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.CloudRole] + 1);
            cloudContext.RoleInstance = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.CloudRoleInstance] + 1);

            var internalContext = telemetryContext.Internal;

            internalContext.SdkVersion   = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalSdkVersion] + 1);
            internalContext.AgentVersion = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalAgentVersion] + 1);
            internalContext.NodeName     = new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalNodeName] + 1);

            var tags = telemetryContext.SanitizedTags;

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.ApplicationVersion]), tags[ContextTagKeys.Keys.ApplicationVersion]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceId]), tags[ContextTagKeys.Keys.DeviceId]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceModel]), tags[ContextTagKeys.Keys.DeviceModel]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceOEMName]), tags[ContextTagKeys.Keys.DeviceOEMName]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceOSVersion]), tags[ContextTagKeys.Keys.DeviceOSVersion]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.DeviceType]), tags[ContextTagKeys.Keys.DeviceType]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.LocationIp]), tags[ContextTagKeys.Keys.LocationIp]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationId]), tags[ContextTagKeys.Keys.OperationId]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationName]), tags[ContextTagKeys.Keys.OperationName]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationParentId]), tags[ContextTagKeys.Keys.OperationParentId]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationSyntheticSource]), tags[ContextTagKeys.Keys.OperationSyntheticSource]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.OperationCorrelationVector]), tags[ContextTagKeys.Keys.OperationCorrelationVector]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.SessionId]), tags[ContextTagKeys.Keys.SessionId]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserId]), tags[ContextTagKeys.Keys.UserId]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserAccountId]), tags[ContextTagKeys.Keys.UserAccountId]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.UserAuthUserId]), tags[ContextTagKeys.Keys.UserAuthUserId]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.CloudRole]), tags[ContextTagKeys.Keys.CloudRole]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.CloudRoleInstance]), tags[ContextTagKeys.Keys.CloudRoleInstance]);

            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalSdkVersion]), tags[ContextTagKeys.Keys.InternalSdkVersion]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalAgentVersion]), tags[ContextTagKeys.Keys.InternalAgentVersion]);
            Assert.AreEqual(new string('Z', Property.TagSizeLimits[ContextTagKeys.Keys.InternalNodeName]), tags[ContextTagKeys.Keys.InternalNodeName]);
        }
Ejemplo n.º 34
0
 public void Initialize(TelemetryContext context)
 {
     context.Properties["MachineName"] = Environment.MachineName;
 }
Ejemplo n.º 35
0
        private async Task<TelemetryContext> CreateInitializedContextAsync()
        {
            var context = new TelemetryContext();
            foreach (IContextInitializer initializer in TelemetryConfiguration.Active.ContextInitializers)
            {
                await initializer.Initialize(context);
            }

            return context;
        }
Ejemplo n.º 36
0
 public ActivityScope StartActivity(TelemetryContext context, string name)
 {
     ActivitiesStarted++;
     return(ActivityScope.Empty);
 }
Ejemplo n.º 37
0
 public void LogMessage(TelemetryContext context, LogLevel level, string message, Dictionary <string, string> props)
 {
     MessagesLogged++;
 }
Ejemplo n.º 38
0
 public HistogramImplementation(string name, TelemetryContext context, HistogramAggregations aggregations)
     : base(name, context)
 {
     this.shouldCalculateMinMax      = (aggregations & HistogramAggregations.MinMax) == HistogramAggregations.MinMax;
     this.shouldCalculatePercentiles = (aggregations & HistogramAggregations.Percentiles) == HistogramAggregations.Percentiles;
 }