- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在 Azure Application Insights 中监视大量应用程序。在所有这些中,我向事件、跟踪等添加了一些自定义属性,以便我可以在门户中进行过滤/分组。
是否可以将相同的自定义属性添加到与 Azure Functions 的内置应用程序洞察集成中?
已阅读文档,但找不到任何相关内容。
编辑:
我维护着在各种环境中托管的大量应用程序。其中大约 15 个是 Azure Functions。我通过日志处理程序从所有应用程序将遥测数据发送到同一应用程序洞察实例。为了过滤/分组信息,我通过日志处理程序自动将“CustomerName”和“CustomerInstance”属性添加到所有事件。
当我从 Azure 函数获取标准事件时,很难以有用的方式呈现信息并将其与其他事件关联起来。通过对函数应用程序进行一些巧妙的命名,我可以在分析中解析请求 URL,但不能在门户中解析。
最佳答案
您可以使用 telemetry.Context.Properties.Add()
方法显式添加这些自定义属性。
我用函数 v2 做了一个演示,如下所示:
1.在Visual Studio中创建函数v2
2.然后在Visual Studio中,通过nuget包管理器添加Microsoft.ApplicationInsights
2.8.1(最新版本)
3.在 Function.cs 中,编写以下代码:
using Microsoft.ApplicationInsights;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using System;
namespace FunctionApp17
{
public static class Function1
{
private static string key = System.Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY",EnvironmentVariableTarget.Process);
private static TelemetryClient telemetry = new TelemetryClient() { InstrumentationKey= key };
[FunctionName("Function1")]
public static void Run([TimerTrigger("*/10 * * * * *")]TimerInfo myTimer, ILogger log)
{
if (!telemetry.Context.Properties.ContainsKey("Function_appName"))
{
telemetry.Context.Properties.Add("Function_appName", "myfuncapp111");
}
else
{
telemetry.Context.Properties["Function_appName"] = "myfuncapp111";
}
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
telemetry.TrackEvent("event111");
telemetry.TrackTrace("trace111");
}
}
}
4.发布到azure,并在您的函数应用->应用程序设置中添加检测 key :
5.函数应用程序运行后,导航到您的应用程序见解 -> 搜索,您可以添加在代码中定义的过滤器。
关于azure - Azure Functions 应用程序见解中的自定义属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53322789/
我发现自己迫切需要您的见解。 这是我感兴趣的对象: class Mergable m where merge :: m -> m -> Maybe m mergeList :: [m]
我正在尝试将网站添加到 insights 中,并且在过去已经成功地做到了这一点。但是,当我尝试添加时,我收到“在根网页上找不到管理数据”错误。我按照指示将 '' 添加到根目录,但 insights 仍
我对如何在 C++ 中使用 vector 感到有点沮丧。我广泛使用它们,尽管我不确定我是如何使用它们的。以下是问题? 如果我有一个 vector ,可以说:std::vector v_strMyVec
我们正在尝试通过广告帐户洞察从 Marketing API 获取一些数据。 我们已找到所需的大部分字段,但找不到与网络界面中提供的“3 秒视频观看次数”属性相对应的字段。 以下字段可用: video_
我刚开始使用 Facebook,老实说,我发现它非常令人困惑,术语和文档在很多情况下似乎非常模糊。有人可以用简单的英语解释我如何实现以下目标吗? 将图片发布到 Facebook(在用户页面上),然后检
我需要使用 Azure Insights 监控辅助角色的 CPU 利用率,有人有这方面的教程吗? 提前致谢, 最佳答案 您可以尝试使用此处提到的 Azure 监控服务 API https://conv
我对 Facebook Insight 和 OData 都很陌生。一般来说,我对编程很陌生,所以请耐心等待。(我刚刚了解了 Maven、依赖关系、JDBC 等等)。 我的主要问题是我没有足够的知识了解
我正在尝试根据 PageSpeed Insights 的建议来优化我的网站。我的网站链接是Evant 。我对两个建议有疑问;首先是消除渲染阻塞 CSS。我尝试预加载其中一些,但事实证明,当我这样做时,
我最近开始开发 Rest api,并偶然发现了这些术语 - jetty、jackson 和 jersey。我在普通 Eclipse 上使用 jersey 成功开发了 Rest api。 我相信jack
我在这里完成了所有步骤: https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads/ ...并在我的应用中正确安装了 SDK:
我正在使用下面的代码来获取我的 channel 洞察数据的链接。不知何故,我的代码返回 null 作为链接。 /*代码***/ public static final String FEED_URL
我是一名优秀的程序员,十分优秀!