Azure应用程序见解.自定义属性长度限制 [英] Azure Application Insight. Custom attribute length restriction

查看:58
本文介绍了Azure应用程序见解.自定义属性长度限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Azure App Insight 用作日志记录工具,并通过以下代码存储日志数据:

I'm using Azure App Insight as a logging tool and store log data by the following code:

    private void SendTrace(LoggingEvent loggingEvent)
    {
        loggingEvent.GetProperties();
        string message = "TestMessage";

        var trace = new TraceTelemetry(message)
        {
            SeverityLevel = SeverityLevel.Information
        };

        trace.Properties.Add("TetstKey", "TestValue");
        var telemetryClient = new TelemetryClient();
        telemetryClient.Context.InstrumentationKey = this.InstrumentationKey;
        telemetryClient.Track(trace);
    }

一切正常.我在 App洞察力 App洞察力分析(在 trace 表中)中看到了记录的记录.我的自定义属性写在特殊的应用洞察力行部分- customDimensions .例如,上面的代码将在 customDimensions 部分中添加带有"TestKey" 键和" TestValue" 值的新属性.

everything works well. I see logged record in App insight as well as in App insight analytics (in trace table). My custom attributes are written in special app insight row section - customDimensions. For example, the above code will add new attribute with "TestKey" key and "TestValue" value into customDimensions section.

但是当我尝试写一些大文本(例如 JSON 包含超过15k个字母的文档)时,我仍然可以做到这一点,没有任何例外,但是可写文本将在某些文档后被截断长度.结果, customDimensions 部分中的自定义属性值也将被裁剪,并且仅包含文档的第一部分.据我了解,有最大文本长度的限制,可以在应用程序洞察自定义属性中编写.

But when I try to write some big text (for example JSON document with more then 15k letters) I still can do it without any exceptions, but the writable text will be cut off after some document length. As the result, the custom attribute value in customDimensions section will be cropped too and will have only first part of document. As I understand there is the restriction for max text length which is allowed to be written in app insight custom attribute.

有人可以知道我该如何解决吗?

Could someone know how can I get around with this?

推荐答案

消息的最大允许限制为32768.对于属性集合中的项目,值的最大限制为8192.

The message has the highest allowed limit of 32768. For items in the property collection, value has max limit of 8192.

因此,您可以尝试以下选项之一:

So you can try one of the following options:

  1. 通过在其中放置大文本来充分利用消息字段.

  1. Use message field to the fullest by putting the big text there.

将数据拆分为多个,然后分别添加到属性集合中.

Split the data into multiple, and add to properties collection separately.

例如:

trace.Properties.Add("key_part1","Bigtext1_upto8192");

trace.Properties.Add("key_part1", "Bigtext1_upto8192");

trace.Properties.Add("key_part2","Bigtext2_upto8192");

trace.Properties.Add("key_part2", "Bigtext2_upto8192");

参考: https://github.com/MicrosoftDocs/azure-docs/blob/master/includes/application-insights-limits.md

这篇关于Azure应用程序见解.自定义属性长度限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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