如何配置 Azure 诊断存储帐户?

发布于 2024-11-23 20:51:26 字数 1413 浏览 1 评论 0原文

阅读 MSDN 我的印象是该帐户用于存储 Azure 诊断配置如下:(

<ConfigurationSettings>
   <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"
       value="DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=AccountKey"/>
</ConfigurationSettings>

设置名称是固定的“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”字符串)。但后来我还找到了用于设置 DiagnosticMonitor 的代码片段(来自 这个问题,作者为 用户 Søren Randrup:(

<ConfigurationSettings>
     <Setting name="DiagnosticsConnectionString"
        value="DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=AccountKey" />
</ConfigurationSettings>
var dm = DiagnosticMonitor.GetDefaultInitialConfiguration();
dm.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(5);
dm.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
DiagnosticMonitor.Start("DiagnosticsConnectionString", dm);

设置名称是开发人员选择的字符串)。

这看起来很令人困惑 - 我的印象是这是相同的设置,但出于某种原因,不同的人对其进行了不同的配置,

存储帐户在哪里指定,为什么上述两个片段似乎用于同一任务?

Reading MSDN I got an impression that the account used for storing Azure Diagnostics is configured like this:

<ConfigurationSettings>
   <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"
       value="DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=AccountKey"/>
</ConfigurationSettings>

(the settings name is the fixed "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" string). But then I also found code snippets for setting up the DiagnosticMonitor (from this question by user Søren Randrup:

<ConfigurationSettings>
     <Setting name="DiagnosticsConnectionString"
        value="DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=AccountKey" />
</ConfigurationSettings>
var dm = DiagnosticMonitor.GetDefaultInitialConfiguration();
dm.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(5);
dm.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
DiagnosticMonitor.Start("DiagnosticsConnectionString", dm);

(the setting name is a string chosen by the developer).

This looks confusing - I'm under impression that it's the same setting but for whatever reason different people configure it differently.

Where is the storage account specified and why are the two abovementioned snippets seemingly used for the same task?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萌︼了一个春 2024-11-30 20:51:31

当DiagnosticsMonitor首次发布时(1.1或1.2 SDK,IIRC),它是从RoleEntryPoint(用户代码)启动的。这有一些缺点,即,如果您的 RoleEntryPoint 崩溃,DM 也会随之崩溃。 1.3 SDK发布时,改变了设计,将DM作为后台启动任务启动。这允许 DM 在与您的代码不同的进程中运行,因此它不再容易被用户代码崩溃。 “Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”是诊断角色插件中定义的设置(查看 bin/plugins 目录)。

如果您除了导入诊断插件并设置此连接字符串之外什么都不做,您将为某些默认事物启用诊断,但实际上不会传输到您的存储帐户进行分析。

因此,更完整的解决方案是:

  1. 启用 DM 插件并为 Windows Azure 中的存储帐户设置有效的连接字符串。
  2. 远程(使用脚本、ManageAxis、Windows Azure MMC、Cerebrata 或其他工具)设置您想要的监控配置*
  3. 或者,在运行时,在 RoleEntryPoint 中,通过代码强制配置监控器。

这会将您的计数器、日志等实际转移到您的存储帐户中。此时,由您来解释它。有一些产品(例如 ManageAxis 等)可以为您进行分析(图形、自动缩放等),但您主要需要自己查询 DM 生成的数据。

* 我更喜欢这种方法,因为我不喜欢在 RoleEntryPoint 中对此进行编码,并且我有可以监视和维护它的工具。

When DiagnosticsMonitor was first released (1.1 or 1.2 SDK, IIRC), it was started from the RoleEntryPoint (user code). This had some disadvantages, namely, if your RoleEntryPoint crashed, it took the DM down with it. When the 1.3 SDK was released, it changed the design and started the DM as a background startup task. This allows the DM to run in a separate process than your code and hence it no longer is susceptible to being crashed by user code. The "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" is the setting defined in the Diagnostics role plugin (look in your bin/plugins directory).

If you do nothing but import the Diagnostics plugin and set this connection string, you will have diagnostics enabled for some default things, but nothing will actually transfer to your storage account for analysis.

So, a more complete solution is to:

  1. Enable the DM plugin and set a valid connection string to a storage account in Windows Azure.
  2. Either remotely (using tools like scripts, ManageAxis, Windows Azure MMC, Cerebrata, or others) set the configuration for monitoring like you want*
  3. Or, at runtime, in your RoleEntryPoint, imperatively configure the monitor via code.

This gets your counters, logs, whatever, actually transferring into your storage account. At this point, it is up to you to interpret it. There are products (e.g. ManageAxis and others) that do the analysis for you (graph, autoscale, etc.), but you are largely on your own to query the data produced by the DM otherwise.

* I prefer this method as I don't like coding this in my RoleEntryPoint and I have tooling that can watch and maintain it.

手心的温暖 2024-11-30 20:51:31

我相信这是随着 Azure 的发展而发生的事情......在早期,默认情况下不启动诊断 - 这解释了旧的问题和答案。

在最新的 API (1.4) 中,我认为您应该使用第一种方法并使用 GetDefaultInitialConfiguration ... SetCurrentConfiguration 来指定您想要监视的内容。

I believe this is something that has occurred as Azure has developed... in the early days, diagnostics was not started by default - so that explains the old question and answer.

In the latest API (1.4), I think you should use the first method and use GetDefaultInitialConfiguration ... SetCurrentConfiguration in order to specify the things you want to monitor.

黯淡〆 2024-11-30 20:51:31

我也为此苦苦挣扎,所以当我终于让它工作时,整理了以下博客文章

使用适用于 WebRoles 的 SDK 1.6 进行 Windows Azure 诊断

I struggled with this as well, so put together the following blog post when I finally got it working

Windows Azure Diagnostics with SDK 1.6 for WebRoles

风追烟花雨 2024-11-30 20:51:31

有关 Azure 诊断的详细演练,您可以查看 PDC09 上 Matthew Kerners 的演示文稿“Windows Azure 监控、日志记录和管理 API”

http://www.microsoftpdc.com/2009/SVC15

For a detailed walkthrough on Azure Diagnostics, you can check out Matthew Kerners presentation "Windows Azure Monitoring, Logging, and Management APIs" at PDC09

http://www.microsoftpdc.com/2009/SVC15

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文