简体   繁体   English

无法使用Node.js中的应用程序见解trackEvent()方法记录冗长的消息

[英]Not able to log lengthy messages using application insights trackEvent() method in Node.js

We are trying to log some lengthy message using AppInsights trackEvent() message. 我们正在尝试使用AppInsights trackEvent()消息记录一些冗长的消息。 But it is not logging into AppInsights and not giving any error. 但这不是在登录AppInsights,也不会出现任何错误。

Please help me in logging lengthy string. 请帮助我记录冗长的字符串。

Please let us know the max limit for the trackEvent() 请让我们知道trackEvent()的最大限制

if you want to log messages then you should be using the trackTrace methods of the AI SDK, not trackEvent . 如果要记录消息 ,则应使用AI SDK的trackTrace方法,而不是trackEvent trackTrace is intended for long messages and has a huge limit: (32k!) See https://github.com/Microsoft/ApplicationInsights-dotnet/blob/develop/Schema/PublicSchema/MessageData.bond#L13 trackTrace适用于长消息,并且有很大的限制:(32k!)请参阅https://github.com/Microsoft/ApplicationInsights-dotnet/blob/develop/Schema/PublicSchema/MessageData.bond#L13

trackEvent is intended for named "events" like "opened file" or "clicked retry" or "canceled frobulating", where you might want to make charts, and track usage of a thing over time. trackEvent用于命名的“事件”,例如“打开的文件”或“单击的重试”或“取消打扰”,您可能希望在其中制作图表并跟踪事物的使用情况。

you can attach custom properties (string key, string value) and custom metrics (string key, double value) to anything. 您可以将自定义属性(字符串键,字符串值)和自定义指标(字符串键,双精度值)附加到任何内容。 and if you set the operationId field on things in the sdk, anything with the same operationId can be easily found together via queries or visualized in the Azure Portal or in Visual Studio: 如果在sdk中的对象上设置了operationId字段,则可以通过查询轻松地找到所有具有相同operationId也可以在Azure门户或Visual Studio中将其可视化: 跟踪操作

There are indeed limitation regarding the length. 关于长度的确存在限制。 For example, the limit of the Name property of an event is 512 characters. 例如,事件的Name属性的限制为512个字符。 See https://github.com/Microsoft/ApplicationInsights-dotnet/blob/master/src/Core/Managed/Shared/Extensibility/Implementation/Property.cs#L23 参见https://github.com/Microsoft/ApplicationInsights-dotnet/blob/master/src/Core/Managed/Shared/Extensibility/Implementation/Property.cs#L23

You can split it on substrings and put in Properties collection, each collection value length is 8 * 1024. I got this as a tip when I asked for it. 您可以将其拆分为子字符串,然后放入“属性”集合中,每个集合的值长度为8 * 1024。 See https://social.msdn.microsoft.com/Forums/en-US/84bd5ade-0b21-47cc-9b39-c6c7a292d87e/dependencytelemetry-sql-command-gets-truncated?forum=ApplicationInsights . 请参阅https://social.msdn.microsoft.com/Forums/zh-CN/84bd5ade-0b21-47cc-9b39-c6c7a292d87e/dependencytelemetry-sql-command-gets-truncated?forum=ApplicationInsights Never tried it myself though 从来没有尝试过

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM