本文整理汇总了C#中Microsoft.ApplicationInsights.DataContracts.TelemetryContext类的典型用法代码示例。如果您正苦于以下问题:C# TelemetryContext类的具体用法?C# TelemetryContext怎么用?C# TelemetryContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TelemetryContext类属于Microsoft.ApplicationInsights.DataContracts命名空间,在下文中一共展示了TelemetryContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()));
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例11: InitializeSetsTelemetryInstrumentationKeyFromArgument
public void InitializeSetsTelemetryInstrumentationKeyFromArgument()
{
var source = new TelemetryContext { InstrumentationKey = "TestValue" };
var target = new TelemetryContext();
target.Initialize(source, "OtherTestValue");
Assert.Equal("OtherTestValue", target.InstrumentationKey);
}
示例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;
}
示例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]);
}
示例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;
}
示例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