Azure 服务结构ETW日志始终不完整

Azure 服务结构ETW日志始终不完整,azure,azure-service-fabric,etw,azure-diagnostics,Azure,Azure Service Fabric,Etw,Azure Diagnostics,我们刚刚开始使用Service Fabric,到目前为止唯一的痛点是WAD的ETW,它似乎总是在缺少数据(message、eventmessage)的情况下注销 到目前为止,我们的经验是,它总是在VisualStudio中工作(有时您必须添加提供商名称),而当部署到Azure中的集群时,它很少工作。当它在Azure中工作时-版本控制&更新事件源上的函数或添加另一个函数将使用空数据点注销 这是我们正在使用Azure CLI部署的ETW/WAD的ARM脚本中的部分 "name": "[concat(

我们刚刚开始使用Service Fabric,到目前为止唯一的痛点是WAD的ETW,它似乎总是在缺少数据(message、eventmessage)的情况下注销

到目前为止,我们的经验是,它总是在VisualStudio中工作(有时您必须添加提供商名称),而当部署到Azure中的集群时,它很少工作。当它在Azure中工作时-版本控制&更新事件源上的函数或添加另一个函数将使用空数据点注销

这是我们正在使用Azure CLI部署的ETW/WAD的ARM脚本中的部分

"name": "[concat('VMDiagnosticsVmExt','_vmNodeType0Name')]",
"properties": {
    "type": "IaaSDiagnostics",
    "autoUpgradeMinorVersion": true,
    "protectedSettings": {
        "storageAccountName": "[parameters('applicationDiagnosticsStorageAccountName')]",
        "storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('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"
                            }
                        },
                        {
                            "provider": "Company-Project-API",
                            "scheduledTransferPeriod": "PT1M",
                            "DefaultEvents": {
                                "eventDestination": "ApiEventTable"
                            }
                        }
                    ],
                    "EtwManifestProviderConfiguration": [
                        {
                            "provider": "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8",
                            "scheduledTransferLogLevelFilter": "Information",
                            "scheduledTransferKeywordFilter": "4611686018427387904",
                            "scheduledTransferPeriod": "PT5M",
                            "DefaultEvents": {
                                "eventDestination": "ServiceFabricSystemEventTable"
                            }
                        }
                    ]
                }
            }
        },
        "StorageAccount": "[parameters('applicationDiagnosticsStorageAccountName')]"
    },
    "typeHandlerVersion": "1.5"
}
这是我们的EventSource,尽管我们已经尝试了大量的变体

using Microsoft.Diagnostics.Tracing;

namespace Project.API

[EventSource(Name = "Company-Project-API")]
public sealed class ApiEventSource : EventSource
{
    public static ApiEventSource Current = new ApiEventSource();

    [Event(1, Level = EventLevel.Informational, Message = "{0}", Version = 1)]
    public void Log(string message)
    {
        this.WriteEvent(1, message);
    }
}
这就是我们每次都能得到的

运行.NET 4.5.2/.NET内核

请帮忙

编辑-好的,我们已经成功地升级到了.NET4.6-看起来消息负载正在注销。我们现在只缺少eventmessage字段。现在在VS中,“message”字段似乎总是空的

EDIT2-使用EventSourceSettings.ETWSelfDescriptionEventFormat作为事件源的构造函数参数时,似乎缺少消息字段,如下所示。这似乎是VS&in WAD的情况

public sealed class ApiEventSource : EventSource 
{
    public ApiEventSource() : base(EventSourceSettings.EtwSelfDescribingEventFormat) {}
}

目前,我可以在没有eventmessage(自描述)或无法对方法进行版本设置之间进行选择(即使增加属性,当使用清单样式时,空行仍会转储到WAD中。

自描述ETW当前未设计为支持EventAttribute.Message属性。Message是基于清单的概念(也就是说,它们不记录在事件中,而是放在清单中。由于自描述ETW没有清单,因此消息属性实际上被忽略

可以想象扩展与自描述ETW事件相关联的元数据,使其能够保存消息字符串,但这目前不存在,需要更改ETW


简单地将消息嵌入有效负载是避免该问题的预期方法。

您能分享一个WAD没有接收到消息的示例吗?里面有任何特殊字符吗?@KarolZ在我们的例子中,所有消息都是-一些消息只是“用Y执行X”其中Y是一个简单类型的值。一些是完全限定的URL,我读到的URL应该是更好的html编码。我们已经切换到4.6,现在使用自描述事件源,这似乎好得多-现在我们只是缺少eventmessage和activityId-我们尝试使用这里提到的Start/Stop,但没有任何效果g似乎是自动生成的。任务活动ID需要在用户端正确启用和解码。VS diagnostics data viewer目前不这样做,但我们正在发布Fabric工具来修复它。我将在WAD中查询对此的支持,并在此处的评论中发布更新:WAD当前不支持我要求WAD团队考虑他们即将发布的一个版本。time@NickDarvey切换到4.6并使用自描述事件格式解决了这两个问题,但会丢失eventmessage字段中的所有数据。