Skip to content

Commit

Permalink
Merge pull request #777 from MicrosoftDocs/main
Browse files Browse the repository at this point in the history
12/11/2024 PM Publish
  • Loading branch information
Taojunshen authored Dec 11, 2024
2 parents 025e1b1 + 64175df commit 35783a5
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 5 deletions.
80 changes: 80 additions & 0 deletions articles/azure-monitor/app/java-standalone-sampling-overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,86 @@ with the text "exporting span".
> Only attributes set at the start of the span are available for sampling,
so attributes such as `http.response.status_code` or request duration which are captured later on can be filtered through [OpenTelemetry Java extensions](https://opentelemetry.io/docs/languages/java/automatic/extensions/). Here is a [sample extension that filters spans based on request duration](https://github.com/Azure-Samples/ApplicationInsights-Java-Samples/tree/main/opentelemetry-api/java-agent/TelemetryFilteredBaseOnRequestDuration).

## Example: Exposing span attributes to suppress SQL dependency calls

This example walks through the experience of finding available attributes to suppress noisy SQL calls. The query below depicts the different SQL calls and associated record counts in the last 30 days:

```kusto
dependencies
| where timestamp > ago(30d)
| where name == 'SQL: DB Query'
| summarize count() by name, operation_Name, data
| sort by count_ desc
```

```output
SQL: DB Query POST /Order DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar; 36712549
SQL: DB Query POST /Receipt DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar; 2220248
SQL: DB Query POST /CheckOutForm DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar; 554074
SQL: DB Query GET /ClientInfo DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar; 37064
```

From the results above, it can be observed that all operations share the same value in the `data` field: `DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar;`. The commonality between all these records makes it a good candidate for a sampling override.

By setting the self-diagnostics to debug, the following log entries will become visible in the output:

`2023-10-26 15:48:25.407-04:00 DEBUG c.m.a.a.i.exporter.AgentSpanExporter - exporting span: SpanData{spanContext=ImmutableSpanContext...`

The area of interest from those logs is the "attributes" section:

```json
{
"attributes": {
"data": {
"thread.name": "DefaultDatabaseBroadcastTransport: MessageReader thread",
"thread.id": 96,
"db.connection_string": "apache:",
"db.statement": "DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar;",
"db.system": "other_sql",
"applicationinsights.internal.item_count": 1
}
}
}
```

Using that output, you can configure a sampling override similar to the one below that will filter our noisy SQL calls:

```json
{
"connectionString": "...",
"preview": {
"sampling": {
"overrides": [
{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.statement",
"value": "DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar;",
"matchType": "strict"
}
],
"percentage": 0
}
]
}
}
}
```

Once the changes are applied, the following query allows us to determine the last time these dependencies were ingested into Application Insights:

```kusto
dependencies
| where timestamp > ago(30d)
| where data contains 'DECLARE @MyVar'
| summarize max(timestamp) by data
| sort by max_timestamp desc
```

```output
DECLARE @MyVar varbinary(20); SET @MyVar = CONVERT(VARBINARY(20), 'Hello World');SET CONTEXT_INFO @MyVar; 11/13/2023 8:52:41 PM
```

## Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
title: Enable monitoring for Azure Kubernetes Service (AKS) cluster
description: Learn how to enable Container insights and Managed Prometheus on an Azure Kubernetes Service (AKS) cluster.
ms.topic: conceptual
ms.date: 03/11/2024
ms.custom: devx-track-azurecli, linux-related-content
author: bwren
ms.author: bwren
ms.reviewer: aul
ms.date: 03/11/2024
---

# Enable monitoring for Kubernetes clusters
Expand Down Expand Up @@ -57,7 +59,7 @@ This article provides onboarding guidance for the following types of clusters. A
- If you previously installed monitoring on a cluster using a script without cluster extensions, follow the instructions at [Disable monitoring of your Kubernetes cluster](kubernetes-monitoring-disable.md) to delete this Helm chart.

> [!NOTE]
> The Managed Prometheus Arc-Enabled Kubernetes extension does not support the following configurations:
> The Managed Prometheus Arc-Enabled Kubernetes (preview) extension does not support the following configurations:
> * Red Hat Openshift distributions, including Azure Red Hat OpenShift (ARO)
> * Windows nodes
Expand Down Expand Up @@ -115,7 +117,7 @@ az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --reso
az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --resource-group <cluster-resource-group> --ksm-metric-labels-allow-list "namespaces=[k8s-label-1,k8s-label-n]" --ksm-metric-annotations-allow-list "pods=[k8s-annotation-1,k8s-annotation-n]"
```

#### Arc-enabled cluster
#### Arc-enabled cluster (preview)


```azurecli
Expand Down Expand Up @@ -192,7 +194,7 @@ If the Azure Managed Grafana instance is already linked to an Azure Monitor work
- Profile module: [https://aka.ms/nested_azuremonitormetrics_profile_clusterResourceId](https://aka.ms/nested_azuremonitormetrics_profile_clusterResourceId)
- Azure Managed Grafana Role Assignment module: [https://aka.ms/nested_grafana_amw_role_assignment](https://aka.ms/nested_grafana_amw_role_assignment)

**Arc-Enabled cluster ARM**
**Arc-Enabled cluster (preview) ARM**

- Template file: [https://aka.ms/azureprometheus-arc-arm-template](https://aka.ms/azureprometheus-arc-arm-template)
- Parameter file: [https://aka.ms/azureprometheus-arc-arm-template-parameters](https://aka.ms/azureprometheus-arc-arm-template-parameters)
Expand Down
1 change: 0 additions & 1 deletion articles/chaos-studio/chaos-studio-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The Chaos Studio agent is tested for compatibility with the following operating
|:---:|:---:|:---:|
| Windows Server 2019 || |
| Windows Server 2016 || |
| Windows Server 2012 R2 || |
| Azure Linux (Mariner) || Installing `stress-ng` [manually](https://github.com/ColinIanKing/stress-ng) required for CPU Pressure, Physical Memory Pressure, Disk I/O Pressure, and Stress-ng faults |
| Red Hat Enterprise Linux 8 || Currently tested up to 8.9 |
| openSUSE Leap 15.2 || |
Expand Down

0 comments on commit 35783a5

Please sign in to comment.