• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DataContracts.TelemetryContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.ApplicationInsights.DataContracts.TelemetryContext的典型用法代码示例。如果您正苦于以下问题:C# TelemetryContext类的具体用法?C# TelemetryContext怎么用?C# TelemetryContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TelemetryContext类属于Microsoft.ApplicationInsights.DataContracts命名空间,在下文中一共展示了TelemetryContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DependencyTelemetry

 /// <summary>
 /// Initializes a new instance of the <see cref="DependencyTelemetry"/> class.
 /// </summary>
 public DependencyTelemetry()
 {
     this.Data = new RemoteDependencyData() { kind = DataPointType.Aggregation };
     this.context = new TelemetryContext(this.Data.properties);
     this.Data.dependencyKind = BondDependencyKind.Other;
     this.Id = Convert.ToBase64String(BitConverter.GetBytes(WeakConcurrentRandom.Instance.Next()));
 }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:10,代码来源:DependencyTelemetry.cs


示例2: Initialize

 public void Initialize(TelemetryContext context)
 {
     context.User.Id = Environment.UserName;
     context.Session.Id = Guid.NewGuid().ToString();
     context.Device.OperatingSystem = Environment.OSVersion.ToString();
     context.Device.Language = CultureInfo.CurrentCulture.DisplayName;
 }
开发者ID:chiccorosso,项目名称:Sdl-Community,代码行数:7,代码来源:UserSessionInitializer.cs


示例3: InitializeSetsSdkVersionPropertyOfGivenTelemetry

        public void InitializeSetsSdkVersionPropertyOfGivenTelemetry()
        {
            var initializer = new SdkVersionPropertyContextInitializer();
            var telemetryContext = new TelemetryContext();
            initializer.Initialize(telemetryContext);

            Assert.NotNull(telemetryContext.Internal.SdkVersion);
        }
开发者ID:JoseCarlosMM,项目名称:ApplicationInsights-dotnet,代码行数:8,代码来源:SdkVersionPropertyContextInitializerTest.cs


示例4: WriteTelemetryContext

 public static void WriteTelemetryContext(IJsonWriter json, TelemetryContext context)
 {
     if (context != null)
     {
         json.WriteProperty("iKey", context.InstrumentationKey);
         json.WriteProperty("tags", context.Tags);
     }
 }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:8,代码来源:Telemetry.cs


示例5: Initialize

        /// <summary>
        /// Initializes the given <see cref="T:Microsoft.ApplicationInsights.DataContracts.TelemetryContext"/>.
        /// </summary>
        public void Initialize(TelemetryContext context)
        {
            if (context == null)
                return;

            if (string.IsNullOrWhiteSpace(context.Component.Version))
                context.Component.Version = _applicationVersion;
        }
开发者ID:alancameronwills,项目名称:SLAB_AppInsights,代码行数:11,代码来源:ApplicationVersionContextInitializer.cs


示例6: Initialize

        /// <summary>
        /// Initializes the given <see cref="T:Microsoft.ApplicationInsights.DataContracts.TelemetryContext"/>.
        /// </summary>
        public void Initialize(TelemetryContext context)
        {
            if (context == null)
                return;

            if (string.IsNullOrWhiteSpace(context.Device.OperatingSystem))
                context.Device.OperatingSystem = _osVersion.Value;
        }
开发者ID:alancameronwills,项目名称:SLAB_AppInsights,代码行数:11,代码来源:OsVersionContextInitializer.cs


示例7: Initialize

 /// <summary>
 /// Adds a telemetry property for the version of SDK.
 /// </summary>
 public void Initialize(TelemetryContext context)
 {
     var version = LazyInitializer.EnsureInitialized(ref this.sdkVersion, this.GetAssemblyVersion);
     if (string.IsNullOrEmpty(context.Internal.SdkVersion))
     {
         context.Internal.SdkVersion = version;
     }
 }
开发者ID:Assaf-Neufeld,项目名称:ApplicationInsights-dotnet,代码行数:11,代码来源:SdkVersionPropertyContextInitializer.cs


示例8: MetricTelemetry

        /// <summary>
        /// Initializes a new instance of the <see cref="MetricTelemetry"/> class with empty 
        /// properties.
        /// </summary>
        public MetricTelemetry()
        {
            this.Data = new MetricData();
            this.Metric = new DataPoint();
            this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>());

            // We always have a single 'metric'.
            this.Data.metrics.Add(this.Metric);
        }
开发者ID:jwChung,项目名称:ApplicationInsights-dotnet,代码行数:13,代码来源:MetricTelemetry.cs


示例9: InitializeDoesNotOverrideTelemetryInstrumentationKey

        public void InitializeDoesNotOverrideTelemetryInstrumentationKey()
        {
            var source = new TelemetryContext { InstrumentationKey = "SourceValue" };
            var target = new TelemetryContext { InstrumentationKey = "TargetValue" };

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal("TargetValue", target.InstrumentationKey);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:9,代码来源:TelemetryContextTest.cs


示例10: RequestTelemetry

        /// <summary>
        /// Initializes a new instance of the <see cref="RequestTelemetry"/> class.
        /// </summary>
        public RequestTelemetry()
        {
            this.Data = new RequestData();
            this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>());
            this.Id = Convert.ToBase64String(BitConverter.GetBytes(WeakConcurrentRandom.Instance.Next()));

            this.ResponseCode = "200";
            this.Success = true;
        }
开发者ID:iusafaro,项目名称:ApplicationInsights-dotnet,代码行数:12,代码来源:RequestTelemetry.cs


示例11: InitializeSetsTelemetryInstrumentationKeyFromArgument

        public void InitializeSetsTelemetryInstrumentationKeyFromArgument()
        {
            var source = new TelemetryContext { InstrumentationKey = "TestValue" };
            var target = new TelemetryContext();

            target.Initialize(source, "OtherTestValue");

            Assert.Equal("OtherTestValue", target.InstrumentationKey);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:9,代码来源:TelemetryContextTest.cs


示例12: RequestTelemetry

        /// <summary>
        /// Initializes a new instance of the <see cref="RequestTelemetry"/> class.
        /// </summary>
        public RequestTelemetry()
        {
            this.Data = new RequestData();
            this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>());

            // Initialize required fields
            this.Context.Operation.Id = WeakConcurrentRandom.Instance.Next().ToString(CultureInfo.InvariantCulture);
            this.ResponseCode = "200";
            this.Success = true;
        }
开发者ID:JoseCarlosMM,项目名称:ApplicationInsights-dotnet,代码行数:13,代码来源:RequestTelemetry.cs


示例13: InitializeDoesNotOverwriteTags

        public void InitializeDoesNotOverwriteTags()
        {
            string tagName = "TestTag";
            var source = new TelemetryContext { Tags = { { tagName, "Source Value" } } };
            var target = new TelemetryContext { Tags = { { tagName, "Target Value" } } };

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal("Target Value", target.Tags[tagName]);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:10,代码来源:TelemetryContextTest.cs


示例14: Initialize

 public void Initialize(TelemetryContext context)
 {
     context.User.Id = Environment.UserName;
     context.Session.Id = Guid.NewGuid().ToString("D");
     context.Device.Id = Environment.MachineName;
     context.Device.RoleInstance = Environment.MachineName;
     context.Device.OperatingSystem = Environment.OSVersion.ToString();
     context.Component.Version = typeof(SessionInitializer).Assembly.GetName().Version.ToString();
     context.Device.RoleName = Assembly.GetEntryAssembly().GetName().Name;
 }
开发者ID:joyhui,项目名称:NuGet.Jobs,代码行数:10,代码来源:SessionInitializer.cs


示例15: ContextInitializerDoesNotOverrideMachineName

        public void ContextInitializerDoesNotOverrideMachineName()
        {
            var source = new DomainNameRoleInstanceContextInitializer();
            var telemetryContext = new TelemetryContext();
            telemetryContext.Device.RoleInstance = "Test";

            source.Initialize(telemetryContext);

            Assert.Equal("Test", telemetryContext.Device.RoleInstance);
        }
开发者ID:jango2015,项目名称:ApplicationInsights-aspnet5,代码行数:10,代码来源:DomainNameRoleInstanceContextInitializerTests.cs


示例16: InitializeCopiesTags

        public void InitializeCopiesTags()
        {
            string tagName = "TestTag";
            string tagValue = "TestValue";
            var source = new TelemetryContext { Tags = { { tagName, tagValue } } };
            var target = new TelemetryContext();

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal(tagValue, target.Tags[tagName]);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:11,代码来源:TelemetryContextTest.cs


示例17: Initialize

        /// <summary>
        /// Initializes a new instance of the <see cref="DomainNameRoleInstanceContextInitializer"/> class.
        /// </summary>
        public void Initialize(TelemetryContext context)
        {
            if (context == null)
            {
                // TODO: add diagnostics
            }

            if (string.IsNullOrEmpty(context.Device.RoleInstance))
            {
                var name = LazyInitializer.EnsureInitialized(ref this.roleInstanceName, this.GetMachineName);
                context.Device.RoleInstance = name;
            }
        }
开发者ID:jango2015,项目名称:ApplicationInsights-aspnet5,代码行数:16,代码来源:DomainNameRoleInstanceContextInitializer.cs


示例18: ReadingVersionWithNoManifestYieldsDefaultValue

        public void ReadingVersionWithNoManifestYieldsDefaultValue()
        {
            ComponentContextInitializer source = new ComponentContextInitializer();
            var telemetryContext = new TelemetryContext();

            Assert.Null(telemetryContext.Component.Version);

            using (new ManifestSaver())
            {
                ComponentContextReader.Instance = new TestComponentContextReader(null);
                source.Initialize(telemetryContext);
            }

            Assert.Equal(ComponentContextReader.UnknownComponentVersion, telemetryContext.Component.Version);
        }
开发者ID:JoseCarlosMM,项目名称:ApplicationInsights-dotnet,代码行数:15,代码来源:ComponentContextInitializerTest.cs


示例19: ReadingVersionWithNoIdentityElementYieldsDefaultValue

        public void ReadingVersionWithNoIdentityElementYieldsDefaultValue()
        {
            ComponentContextInitializer source = new ComponentContextInitializer();
            var telemetryContext = new TelemetryContext();

            Assert.Null(telemetryContext.Component.Version);

            using (new ManifestSaver())
            {
                XElement root = new XElement(XName.Get("Deployment", "http://schemas.microsoft.com/windowsphone/2012/deployment"));
                ComponentContextReader.Instance = new TestComponentContextReader(root);
                source.Initialize(telemetryContext);
            }

            Assert.Equal(ComponentContextReader.UnknownComponentVersion, telemetryContext.Component.Version);
        }
开发者ID:JoseCarlosMM,项目名称:ApplicationInsights-dotnet,代码行数:16,代码来源:ComponentContextInitializerTest.cs


示例20: ReadingDeviceTypeYieldsCorrectValue

        public void ReadingDeviceTypeYieldsCorrectValue()
        {
            DeviceContextInitializer source = new DeviceContextInitializer();
            var telemetryContext = new TelemetryContext();

            Assert.Null(telemetryContext.Device.Type);

            source.Initialize(telemetryContext);

            string expected = "Other";
#if SILVERLIGHT || WINDOWS_PHONE
            expected = "Phone";
#elif NET35 || NET40 || NET45
            expected = "PC";
#endif
            Assert.Equal(expected, telemetryContext.Device.Type);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:17,代码来源:DeviceContextInitializerTest.cs



注:本文中的Microsoft.ApplicationInsights.DataContracts.TelemetryContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Extensibility.TelemetryConfiguration类代码示例发布时间:2022-05-26
下一篇:
C# DataContracts.RequestTelemetry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap