- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下是由 Azure 门户创建的 VM 规模集模板,作为创建 Service Fabric 群集的一部分,为简单起见,省略了一些元素。
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"properties": {
"upgradePolicy": {
"mode": "Automatic"
},
"virtualMachineProfile": {
"extensionProfile": {
"extensions": [
{
"name": "[concat('ServiceFabricNodeVmExt','_vmNodeType0Name')]"
},
{
"name": "[concat('InstallNET62VmExt','_vmNodeType0Name')]"
},
{
"name": "[concat('VMDiagnosticsVmExt','_vmNodeType0Name')]",
"properties": {
"type": "IaaSDiagnostics",
"autoUpgradeMinorVersion": true,
"protectedSettings": {
"storageAccountName": "[variables('applicationDiagnosticsStorageAccountName')]",
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('applicationDiagnosticsStorageAccountName')),'2015-05-01-preview').key1]",
"storageAccountEndPoint": "https://core.windows.net/"
},
"publisher": "Microsoft.Azure.Diagnostics",
"settings": {
"WadCfg": {
"DiagnosticMonitorConfiguration": {
"overallQuotaInMB": "50000",
"EtwProviders": {
"EtwEventSourceProviderConfiguration": [
{
"provider": "Microsoft-ServiceFabric-Actors",
"scheduledTransferKeywordFilter": "1",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableActorEventTable"
}
},
{
"provider": "Microsoft-ServiceFabric-Services",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableServiceEventTable"
}
}
],
"EtwManifestProviderConfiguration": [
{
"provider": "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8",
"scheduledTransferLogLevelFilter": "Information",
"scheduledTransferKeywordFilter": "4611686018427387904",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricSystemEventTable"
}
}
]
}
}
},
"StorageAccount": "[variables('applicationDiagnosticsStorageAccountName')]"
},
"typeHandlerVersion": "1.5"
}
}
]
},
"networkProfile": {},
"osProfile": {},
"storageProfile": {}
}
},
"sku": {
"name": "[variables('vmNodeType0Size')]",
"capacity": "5",
"tier": "Basic"
},
"tags": {
"resourceType": "Service Fabric",
"clusterName": "[parameters('clusterName')]"
}
}
其工作原理是将服务结构的所有构建事件发送到 Blob 存储中的 EWT 表。
然后,当在 Visual Studio 中创建新的 Service Fabric 应用程序时,将创建用于应用程序日志记录的新事件源:
[EventSource(Name = "MyCompany-MessageProcessor.ServiceFabricHost-StatelessServiceProcessor")]
internal sealed class ServiceEventSource : EventSource
{
...
}
不会传输到表存储。
谷歌搜索IaaSDiagnostics WadCfg EtwProviders
没有提供任何关于它们如何工作的文档。
我们如何使 EventSouces 与所有内置事件一起传输到表存储?
最佳答案
与 Microsoft-ServiceFabric-Actors
和 Microsoft-ServiceFabric-Services
提供程序并排,您可以添加自己的事件源名称。
"EtwEventSourceProviderConfiguration": [
{
"provider": "Microsoft-ServiceFabric-Actors",
"scheduledTransferKeywordFilter": "1",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableActorEventTable"
}
},
{
"provider": "S-Innovations-Azure-MessageProcessor-ServiceFabric",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "SInnovationsServiceFabricMessageProcessor"
}
},
{
"provider": "Microsoft-ServiceFabric-Services",
"scheduledTransferPeriod": "PT5M",
"DefaultEvents": {
"eventDestination": "ServiceFabricReliableServiceEventTable"
}
}
],
我选择将来自服务和参与者的两个示例事件源合并为一个:
namespace SInnovations.Azure.MessageProcessor.ServiceFabric.Tracing
{
using System;
using System.Diagnostics.Tracing;
using System.Fabric;
using System.Threading.Tasks;
using Microsoft.ServiceFabric.Actors;
using Microsoft.ServiceFabric.Services.Runtime;
[EventSource(Name = "S-Innovations-Azure-MessageProcessor-ServiceFabric")]
internal sealed class ServiceFabricEventSource : EventSource
{
public static readonly ServiceFabricEventSource Current = new ServiceFabricEventSource();
static ServiceFabricEventSource()
{
// A workaround for the problem where ETW activities do not get tracked until Tasks infrastructure is initialized.
// This problem will be fixed in .NET Framework 4.6.2.
Task.Run(() => { }).Wait();
}
// Instance constructor is private to enforce singleton semantics
private ServiceFabricEventSource() : base() { }
#region Keywords
// Event keywords can be used to categorize events.
// Each keyword is a bit flag. A single event can be associated with multiple keywords (via EventAttribute.Keywords property).
// Keywords must be defined as a public class named 'Keywords' inside EventSource that uses them.
public static class Keywords
{
public const EventKeywords HostInitialization = (EventKeywords)0x1L;
public const EventKeywords Requests = (EventKeywords)0x2L;
public const EventKeywords ServiceInitialization = (EventKeywords)0x4L;
}
#endregion
#region Events
// Define an instance method for each event you want to record and apply an [Event] attribute to it.
// The method name is the name of the event.
// Pass any parameters you want to record with the event (only primitive integer types, DateTime, Guid & string are allowed).
// Each event method implementation should check whether the event source is enabled, and if it is, call WriteEvent() method to raise the event.
// The number and types of arguments passed to every event method must exactly match what is passed to WriteEvent().
// Put [NonEvent] attribute on all methods that do not define an event.
// For more information see https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx
[NonEvent]
public void Message(string message, params object[] args)
{
if (this.IsEnabled())
{
string finalMessage = string.Format(message, args);
Message(finalMessage);
}
}
private const int MessageEventId = 1;
[Event(MessageEventId, Level = EventLevel.Informational, Message = "{0}")]
public void Message(string message)
{
if (this.IsEnabled())
{
WriteEvent(MessageEventId, message);
}
}
[NonEvent]
public void ActorMessage(StatelessActor actor, string message, params object[] args)
{
if (this.IsEnabled())
{
string finalMessage = string.Format(message, args);
ActorMessage(
actor.GetType().ToString(),
actor.Id.ToString(),
actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
actor.ActorService.ServiceInitializationParameters.ServiceTypeName,
actor.ActorService.ServiceInitializationParameters.ServiceName.ToString(),
actor.ActorService.ServiceInitializationParameters.PartitionId,
actor.ActorService.ServiceInitializationParameters.InstanceId,
FabricRuntime.GetNodeContext().NodeName,
finalMessage);
}
}
[NonEvent]
public void ActorMessage(StatefulActorBase actor, string message, params object[] args)
{
if (this.IsEnabled())
{
string finalMessage = string.Format(message, args);
ActorMessage(
actor.GetType().ToString(),
actor.Id.ToString(),
actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
actor.ActorService.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
actor.ActorService.ServiceInitializationParameters.ServiceTypeName,
actor.ActorService.ServiceInitializationParameters.ServiceName.ToString(),
actor.ActorService.ServiceInitializationParameters.PartitionId,
actor.ActorService.ServiceInitializationParameters.ReplicaId,
FabricRuntime.GetNodeContext().NodeName,
finalMessage);
}
}
[NonEvent]
public void ServiceMessage(StatelessService service, string message, params object[] args)
{
if (this.IsEnabled())
{
string finalMessage = string.Format(message, args);
ServiceMessage(
service.ServiceInitializationParameters.ServiceName.ToString(),
service.ServiceInitializationParameters.ServiceTypeName,
service.ServiceInitializationParameters.InstanceId,
service.ServiceInitializationParameters.PartitionId,
service.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
service.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
FabricRuntime.GetNodeContext().NodeName,
finalMessage);
}
}
[NonEvent]
public void ServiceMessage(StatefulService service, string message, params object[] args)
{
if (this.IsEnabled())
{
string finalMessage = string.Format(message, args);
ServiceMessage(
service.ServiceInitializationParameters.ServiceName.ToString(),
service.ServiceInitializationParameters.ServiceTypeName,
service.ServiceInitializationParameters.ReplicaId,
service.ServiceInitializationParameters.PartitionId,
service.ServiceInitializationParameters.CodePackageActivationContext.ApplicationName,
service.ServiceInitializationParameters.CodePackageActivationContext.ApplicationTypeName,
FabricRuntime.GetNodeContext().NodeName,
finalMessage);
}
}
// For very high-frequency events it might be advantageous to raise events using WriteEventCore API.
// This results in more efficient parameter handling, but requires explicit allocation of EventData structure and unsafe code.
// To enable this code path, define UNSAFE conditional compilation symbol and turn on unsafe code support in project properties.
private const int ServiceMessageEventId = 2;
[Event(ServiceMessageEventId, Level = EventLevel.Informational, Message = "{7}")]
private
#if UNSAFE
unsafe
#endif
void ServiceMessage(
string serviceName,
string serviceTypeName,
long replicaOrInstanceId,
Guid partitionId,
string applicationName,
string applicationTypeName,
string nodeName,
string message)
{
#if !UNSAFE
WriteEvent(ServiceMessageEventId, serviceName, serviceTypeName, replicaOrInstanceId, partitionId, applicationName, applicationTypeName, nodeName, message);
#else
const int numArgs = 8;
fixed (char* pServiceName = serviceName, pServiceTypeName = serviceTypeName, pApplicationName = applicationName, pApplicationTypeName = applicationTypeName, pNodeName = nodeName, pMessage = message)
{
EventData* eventData = stackalloc EventData[numArgs];
eventData[0] = new EventData { DataPointer = (IntPtr) pServiceName, Size = SizeInBytes(serviceName) };
eventData[1] = new EventData { DataPointer = (IntPtr) pServiceTypeName, Size = SizeInBytes(serviceTypeName) };
eventData[2] = new EventData { DataPointer = (IntPtr) (&replicaOrInstanceId), Size = sizeof(long) };
eventData[3] = new EventData { DataPointer = (IntPtr) (&partitionId), Size = sizeof(Guid) };
eventData[4] = new EventData { DataPointer = (IntPtr) pApplicationName, Size = SizeInBytes(applicationName) };
eventData[5] = new EventData { DataPointer = (IntPtr) pApplicationTypeName, Size = SizeInBytes(applicationTypeName) };
eventData[6] = new EventData { DataPointer = (IntPtr) pNodeName, Size = SizeInBytes(nodeName) };
eventData[7] = new EventData { DataPointer = (IntPtr) pMessage, Size = SizeInBytes(message) };
WriteEventCore(ServiceMessageEventId, numArgs, eventData);
}
#endif
}
private const int ServiceTypeRegisteredEventId = 3;
[Event(ServiceTypeRegisteredEventId, Level = EventLevel.Informational, Message = "Service host process {0} registered service type {1}", Keywords = Keywords.ServiceInitialization)]
public void ServiceTypeRegistered(int hostProcessId, string serviceType)
{
WriteEvent(ServiceTypeRegisteredEventId, hostProcessId, serviceType);
}
private const int ServiceHostInitializationFailedEventId = 4;
[Event(ServiceHostInitializationFailedEventId, Level = EventLevel.Error, Message = "Service host initialization failed", Keywords = Keywords.ServiceInitialization)]
public void ServiceHostInitializationFailed(string exception)
{
WriteEvent(ServiceHostInitializationFailedEventId, exception);
}
// A pair of events sharing the same name prefix with a "Start"/"Stop" suffix implicitly marks boundaries of an event tracing activity.
// These activities can be automatically picked up by debugging and profiling tools, which can compute their execution time, child activities,
// and other statistics.
private const int ServiceRequestStartEventId = 5;
[Event(ServiceRequestStartEventId, Level = EventLevel.Informational, Message = "Service request '{0}' started", Keywords = Keywords.Requests)]
public void ServiceRequestStart(string requestTypeName)
{
WriteEvent(ServiceRequestStartEventId, requestTypeName);
}
private const int ServiceRequestStopEventId = 6;
[Event(ServiceRequestStopEventId, Level = EventLevel.Informational, Message = "Service request '{0}' finished", Keywords = Keywords.Requests)]
public void ServiceRequestStop(string requestTypeName)
{
WriteEvent(ServiceRequestStopEventId, requestTypeName);
}
private const int ServiceRequestFailedEventId = 7;
[Event(ServiceRequestFailedEventId, Level = EventLevel.Error, Message = "Service request '{0}' failed", Keywords = Keywords.Requests)]
public void ServiceRequestFailed(string requestTypeName, string exception)
{
WriteEvent(ServiceRequestFailedEventId, exception);
}
// For very high-frequency events it might be advantageous to raise events using WriteEventCore API.
// This results in more efficient parameter handling, but requires explicit allocation of EventData structure and unsafe code.
// To enable this code path, define UNSAFE conditional compilation symbol and turn on unsafe code support in project properties.
private const int ActorMessageEventId = 8;
[Event(ActorMessageEventId, Level = EventLevel.Informational, Message = "{9}")]
private
#if UNSAFE
unsafe
#endif
void ActorMessage(
string actorType,
string actorId,
string applicationTypeName,
string applicationName,
string serviceTypeName,
string serviceName,
Guid partitionId,
long replicaOrInstanceId,
string nodeName,
string message)
{
#if !UNSAFE
WriteEvent(
ActorMessageEventId,
actorType,
actorId,
applicationTypeName,
applicationName,
serviceTypeName,
serviceName,
partitionId,
replicaOrInstanceId,
nodeName,
message);
#else
const int numArgs = 10;
fixed (char* pActorType = actorType, pActorId = actorId, pApplicationTypeName = applicationTypeName, pApplicationName = applicationName, pServiceTypeName = serviceTypeName, pServiceName = serviceName, pNodeName = nodeName, pMessage = message)
{
EventData* eventData = stackalloc EventData[numArgs];
eventData[0] = new EventData { DataPointer = (IntPtr) pActorType, Size = SizeInBytes(actorType) };
eventData[1] = new EventData { DataPointer = (IntPtr) pActorId, Size = SizeInBytes(actorId) };
eventData[2] = new EventData { DataPointer = (IntPtr) pApplicationTypeName, Size = SizeInBytes(applicationTypeName) };
eventData[3] = new EventData { DataPointer = (IntPtr) pApplicationName, Size = SizeInBytes(applicationName) };
eventData[4] = new EventData { DataPointer = (IntPtr) pServiceTypeName, Size = SizeInBytes(serviceTypeName) };
eventData[5] = new EventData { DataPointer = (IntPtr) pServiceName, Size = SizeInBytes(serviceName) };
eventData[6] = new EventData { DataPointer = (IntPtr) (&partitionId), Size = sizeof(Guid) };
eventData[7] = new EventData { DataPointer = (IntPtr) (&replicaOrInstanceId), Size = sizeof(long) };
eventData[8] = new EventData { DataPointer = (IntPtr) pNodeName, Size = SizeInBytes(nodeName) };
eventData[9] = new EventData { DataPointer = (IntPtr) pMessage, Size = SizeInBytes(message) };
WriteEventCore(ActorMessageEventId, numArgs, eventData);
}
#endif
}
private const int ActorHostInitializationFailedEventId = 9;
[Event(ActorHostInitializationFailedEventId, Level = EventLevel.Error, Message = "Actor host initialization failed", Keywords = Keywords.HostInitialization)]
public void ActorHostInitializationFailed(string exception)
{
WriteEvent(ActorHostInitializationFailedEventId, exception);
}
#endregion
#region Private Methods
#if UNSAFE
private int SizeInBytes(string s)
{
if (s == null)
{
return 0;
}
else
{
return (s.Length + 1) * sizeof(char);
}
}
#endif
#endregion
}
}
关于azure - 如何使用 EtwProviders 让 ETW 与 Service Fabric 的 VM 规模集的 ARM 模板配合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35825764/
我目前正在使用 Microsoft 网络监视器来解析调试事件跟踪。它不是一个坏工具,但也不是很好。你知道一些更好的解决方案吗? 最佳答案 这些是用于探索自定义 ETW 跟踪的读者: SvcPerf -
我正在使用 Windows API 的事件跟踪,并且不时运行我的应用程序,但它在打开 ETW 跟踪 Controller session 后无法关闭它。 基本上我做::StartTrace([out]
问题:如何查看所有打开的 ETW session ,包括其根路径?我期望一些 PowerShell 命令,如 Get-EtwTraceSession ,但我没有看到任何内容。 背景 我使用 Event
性能计数器是 ETW 的一部分吗?如果不是,两者有什么区别? 最佳答案 性能计数器和 ETW 是不同的技术。性能计数器不通过 ETW 公开。 基本区别:性能计数器提供有关系统行为的高级度量(想想计时器
我正在使用新的 EventSource 类从我的应用程序写入 Windows 事件日志,到目前为止它很棒。但是,我观察到有两件事会导致可能相关的问题:传递给 Event 属性的格式字符串在写入事件日志
我打算使用 ETW,因为它: 强制构建日志记录 低延迟 在另一个进程上消费事件的能力 想法是使用语义日志应用程序 block 等外部进程使用 ETW 事件,并将这些事件转发到中央位置。 我的问题是。如
我有一个使用 native 插件的应用程序。对于这些插件,我有自己的二进制格式。每个插件都在运行时使用类似于将 DLL 映射到进程空间的方法加载。这意味着,每个插件都有自己的 ImageBase,.t
我们使用 AppFabric Monitoring 来检查执行时间并跟踪日志消息。这在一年后运行良好,但一些服务器突然停止监视我们的 WCF 服务。 我在 AppFabric 监控方面有一些经验,并且
我为 CLR 提供程序记录 ETW 事件: xperf -start clr -on e13c0d23-ccbc-4e12-931b-d9cc2eee27e4 -f clr.etl ... xperf
是否有使用 ETW 记录异常的标准方法? 据我所知,这样做的唯一方法是记录消息和可能的内部异常消息,因为异常类型没有强类型参数。 最佳答案 启用时,所有 CLR 异常(第一次机会,以及可能最终导致应用
我正在尝试让我的 Azure 辅助角色的日志出现在 Application Insights 中。当我运行 Get-AzureServiceDiagnosticsExtension 时,我得到以下信息
如何确定 ETW session 是否正在丢弃事件? 如果正在丢弃事件,我如何配置跟踪 session 以便事件不被丢弃? 我编写了一个自定义 ETW 提供程序来帮助进行一些调试工作。我目前正在使用
任务并行库使用 Event Tracing for Windows (ETW)用于记录。显然,在 Windows Phone 或 Windows Store .NET Runtime 下,TPL 或
我想实现一个 ETW C 中的消费者用于来自 Microsoft-Windows-TCPIP 提供程序的事件。但是,我找不到此提供程序生成的事件类型。 我已经做了一些类似的工作来使用来自 Micros
这个问题在这里已经有了答案: How do I log events in Windows IoT? (1 个回答) 关闭 5 年前。 我正在为 Windows 10 IoT 开发基于 UWP 的应
一些人告诉我,ETW 提供了一种机制来捕获用户模式进程进行的系统调用。我已经列举了可用的提供者,并且只提出了两个可能提供此信息的可能性。第一个是 Microsoft-Windows-Kernel-Au
在不使用 list 的情况下卸载/删除以前安装的事件源的最佳方法是什么? 例如。如果我有类似的东西: [EventSource(Name = "Corporation-Module-X")]
我正在尝试使用新的 EventSource(来自 nuget 的 Microsoft.Diagnostics.Tracing.EventSource)及其对 ETW channel 的新支持,以便写入
我们刚刚开始使用 Service Fabric,到目前为止唯一的痛点是使用 WAD 进行 ETW,它似乎总是因丢失数据(消息、事件消息)而注销。 到目前为止,我们的经验是它在 Visual Studi
我们刚刚开始使用 Service Fabric,到目前为止唯一的痛点是使用 WAD 进行 ETW,它似乎总是因丢失数据(消息、事件消息)而注销。 到目前为止,我们的经验是它在 Visual Studi
我是一名优秀的程序员,十分优秀!