Service Fabric ETW日志始终不完整 [英] Service Fabric ETW Logs are always incomplete

查看:70
本文介绍了Service Fabric ETW日志始终不完整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚开始使用Service Fabric,到目前为止,唯一的痛点是带有WAD的ETW,它似乎总是因缺少数据(消息,事件消息)而注销.

We have just started using Service Fabric and the only pain point so far has been ETW with WAD, which always seems to log out with missing data (message, eventmessage.)

到目前为止,我们的经验是,它始终可以在Visual Studio中运行(有时必须添加提供程序名称),并且在部署到Azure中的群集时很少可以运行.当它在Azure中运行时-版本控制&在事件源上更新功能或添加另一个功能后,将注销空白数据点.

Our experience so far has that it always works in visual studio (sometimes you have to add the provider name) and that it rarely works when deployed to a cluster in Azure. When it does work in Azure - versioning & updating a function on the event source or adding another will then log out with empty data points.

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

This is the section we have in our ARM script for ETW/WAD which we are deploying using the Azure CLI.

"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,尽管我们尝试了很多变化.

This is our EventSource, though we have tried a ton of variations.

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);
    }
}

这就是我们每次都会遇到的WAD.

This is what we get in WAD every time.

运行.NET 4.5.2/.net内核.

Running .NET 4.5.2 / .net core.

请协助.

编辑-好的,我们在升级到.NET 4.6方面取得了一些成功-看起来好像消息有效负载已被注销.我们现在所缺少的只是eventmessage字段.似乎在VS中,消息"字段现在始终为空.

EDIT - Okay, we've had some success moving up to .NET 4.6 - it looks as if the message payload is being logged out. All we're missing now is the eventmessage field. It also seems that the "message" field is always null now in VS.

EDIT2-使用EventSourceSettings.EtwSelfDescribingEventFormat作为事件源的构造函数参数时,似乎缺少消息字段,如下所示.在VS& amp;中似乎就是这种情况.在WAD中.

EDIT2 - It seems that the message field is missing when using EventSourceSettings.EtwSelfDescribingEventFormat as a constructor argument to your event source like below. This seems to be the case in VS & in WAD.

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

此刻,我可以在没有事件消息(自我描述)之间选择,或者不能对方法进行版本控制(即使增加属性,使用清单样式时,空行仍会转储到WAD中.)

At the moment I can either choose between no eventmessage (Self Describing) or not being able to version the methods (even with incrementing the attribute, empty lines are still dumped into WAD when using manifest style.

推荐答案

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

Self-describing ETW is not currently designed to support the EventAttribute.Message property. Message is a manifest based concept (that is they are not logged in the event, but rather placed in the manifest. Since Self-describing ETW does not have a manifest, the Message property effectively gets ignored.

可以想象扩展与自描述ETW事件相关联的元数据,以便它可以容纳消息字符串,但是当前不存在,因此需要更改ETW.

One could imagine extending the Meta-data associated with Self-describing ETW events so it could hold the Message string, but that does not currently exist and would require a change to ETW.

将消息简单地嵌入有效负载中是避免此问题的预期方式.

Simply embedding the message in the payload is the expected way to avoid the issue.

这篇关于Service Fabric ETW日志始终不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆