本文整理汇总了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;未经允许,请勿转载。 |
请发表评论