本文整理汇总了C#中FunctionId.GetPropertyName方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionId.GetPropertyName方法的具体用法?C# FunctionId.GetPropertyName怎么用?C# FunctionId.GetPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionId
的用法示例。
在下文中一共展示了FunctionId.GetPropertyName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetBlockId
private void SetBlockId(IVsTelemetryEvent telemetryEvent, FunctionId functionId, int blockId)
{
var blockIdName = functionId.GetPropertyName(BlockId);
telemetryEvent.SetIntProperty(blockIdName, blockId);
}
示例2: LogBlockEnd
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int blockId, int delta, CancellationToken cancellationToken)
{
var kvLogMessage = logMessage as KeyValueLogMessage;
if (kvLogMessage == null)
{
return;
}
try
{
// guard us from exception thrown by telemetry
var telemetryEvent = CreateTelemetryEvent(functionId, End);
SetBlockId(telemetryEvent, functionId, blockId);
var durationName = functionId.GetPropertyName(Duration);
telemetryEvent.SetIntProperty(durationName, delta);
var cancellationName = functionId.GetPropertyName(CancellationRequested);
telemetryEvent.SetBoolProperty(cancellationName, cancellationToken.IsCancellationRequested);
_session.PostEvent(telemetryEvent);
}
catch
{
}
}
示例3: CreateTelemetryEvent
private IVsTelemetryEvent CreateTelemetryEvent(FunctionId functionId, string eventKey = null, KeyValueLogMessage logMessage = null)
{
var eventName = functionId.GetEventName(eventKey);
var telemetryEvent = _service.CreateEvent(eventName);
if (logMessage == null || !logMessage.ContainsProperty)
{
return telemetryEvent;
}
foreach (var kv in logMessage.Properties)
{
var propertyName = functionId.GetPropertyName(kv.Key);
// call SetProperty. VS telemetry will take care of finding correct
// API based on given object type for us.
//
// numeric data will show up in ES with measurement prefix.
telemetryEvent.SetProperty(propertyName, kv.Value);
}
return telemetryEvent;
}