如何使用 applicationinsights.json 文件中的依赖项属性为 Java 应用程序依赖项调用配置采样

问题描述 投票:0回答:1

我已使用 Appinsights 在 AKS 中部署了一个 Java 应用程序。我正在使用

applicationinsights.json
在部署的服务中配置 appinsights。 我想对具有
Base name
属性且具有特定值的依赖项调用进行采样,如下图所示。

我使用了下面的

applicationinsights.json
配置文件。但这对我不起作用。 我尝试了严格和正则表达式,但这也不起作用。 有人可以告诉我如何使用
Base name
属性或任何其他属性(如果可能)对上述依赖项调用进行采样。

{
    "role": {
        "name": "ROLE_NAME"
    },
    "heartbeat": {
        "intervalSeconds": 60
    },
    "preview": {
        "processors": [
            {
                "type": "attribute",
                "actions": [
                    {
                        "key": "http.url",
                        "pattern": "(?<redacted>\\?.*)",
                        "replace": "\\?***",
                        "action": "mask"
                    }
                ],
                "id": "/log/maskQueryString"
            }
        ],
        "sampling": {
            "overrides": [
                {
                    "telemetryType": "dependency",
                    "attributes": [
                        {
                            "key": "Base name",
                            "value": "<value of the property>",
                            "matchType": "strict"
                        }
                    ],
                    "percentage": 0
                }
            ]
        }
    }
}
java azure-application-insights azure-application-insights-profiler
1个回答
0
投票

我可以通过在 applicationinsights.json 配置文件中添加以下采样配置来对数据库依赖项调用进行采样

{
    "preview": {
        "sampling": {
            "overrides": [
                {
                    "telemetryType": "dependency",
                    "attributes": [
                        {
                            "key": "db.system",
                            "value": ".*sql.*",
                            "matchType": "regexp"
                        }
                    ],
                    "percentage": 0
                }
            ]
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.