本文整理汇总了C#中ITelemetry.Sanitize方法的典型用法代码示例。如果您正苦于以下问题:C# ITelemetry.Sanitize方法的具体用法?C# ITelemetry.Sanitize怎么用?C# ITelemetry.Sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITelemetry
的用法示例。
在下文中一共展示了ITelemetry.Sanitize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Track
internal void Track(ITelemetry telemetry)
{
if (!IsTelemetryInitialized)
{
CoreEventSource.Log.LogVerbose("HockeyClient configuration has not been initialized. Saving telemetry item to a queue.");
queue.Enqueue(telemetry);
if (queue.Count > MaxQueueSize)
{
queue.Dequeue();
}
return;
}
// TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
// This method needs to be public so that we can build and ship new telemetry types without having to ship core.
// It is hidden from intellisense to prevent customer confusion.
if (this.IsTelemetryEnabled())
{
string instrumentationKey = this.Context.InstrumentationKey;
if (string.IsNullOrEmpty(instrumentationKey))
{
instrumentationKey = TelemetryConfiguration.Active.InstrumentationKey;
}
if (string.IsNullOrEmpty(instrumentationKey))
{
return;
}
var telemetryWithProperties = telemetry as ISupportProperties;
if (telemetryWithProperties != null)
{
if (this.Channel.DeveloperMode.HasValue && this.Channel.DeveloperMode.Value)
{
if (!telemetryWithProperties.Properties.ContainsKey("DeveloperMode"))
{
telemetryWithProperties.Properties.Add("DeveloperMode", "true");
}
}
Utils.CopyDictionary(this.Context.Properties, telemetryWithProperties.Properties);
}
telemetry.Context.Initialize(this.Context, instrumentationKey);
foreach (ITelemetryInitializer initializer in TelemetryConfiguration.Active.TelemetryInitializers)
{
try
{
initializer.Initialize(telemetry);
}
catch (Exception exception)
{
CoreEventSource.Log.LogError(string.Format(
CultureInfo.InvariantCulture,
"Exception while initializing {0}, exception message - {1}",
initializer.GetType().FullName,
exception.ToString()));
}
}
telemetry.Sanitize();
this.Channel.Send(telemetry);
this.WriteTelemetryToDebugOutput(telemetry);
}
}
示例2: Track
public void Track(ITelemetry telemetry)
{
// TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
// This method needs to be public so that we can build and ship new telemetry types without having to ship core.
// It is hidden from intellisense to prevent customer confusion.
if (this.IsEnabled())
{
string instrumentationKey = this.Context.InstrumentationKey;
if (string.IsNullOrEmpty(instrumentationKey))
{
instrumentationKey = this.configuration.InstrumentationKey;
}
if (string.IsNullOrEmpty(instrumentationKey))
{
return;
}
this.Initialize(telemetry);
if (string.IsNullOrEmpty(telemetry.Context.InstrumentationKey))
{
return;
}
telemetry.Sanitize();
this.Channel.Send(telemetry);
if (System.Diagnostics.Debugger.IsAttached)
{
this.WriteTelemetryToDebugOutput(telemetry);
}
}
}
示例3: Track
public void Track(ITelemetry telemetry)
{
// TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
// This method needs to be public so that we can build and ship new telemetry types without having to ship core.
// It is hidden from intellisense to prevent customer confusion.
if (this.IsEnabled())
{
this.Initialize(telemetry);
this.WriteTelemetryToDebugOutput(telemetry);
if (string.IsNullOrEmpty(telemetry.Context.InstrumentationKey))
{
return;
}
telemetry.Sanitize();
if (telemetry.Timestamp == default(DateTimeOffset))
{
telemetry.Timestamp = Clock.Instance.Time;
}
// invokes the Process in the first processor in the chain
this.configuration.TelemetryProcessors.Process(telemetry);
}
}