Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Instrument applications with Azure Application Insights and OpenTelemetry for end-to-end observability. Use this skill when users ask about telemetry, tracing, metrics, logging, or monitoring setup. Covers SDK setup, correlation, sampling, dashboards, and alerts per OpenTelemetry standards.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
Implement high-value telemetry with minimal noise and strong trace correlation for production troubleshooting and performance optimization.
Immature: No monitoring, errors discovered by users
Developing: Logs and metrics collected, no correlation or alerting
Managed: Traces linked across services, alerts firing, dashboards useful → Target
Optimized: Real-time anomaly detection, SLO tracking, automated runbooks
Is this a new application or existing?
├─ New → Start with OpenTelemetry SDK from day one
└─ Existing → Assess current logging, add instrumentation incrementally
Which language?
├─ .NET → Application Insights .NET SDK (auto-instrumentation or manual)
├─ Node.js → OpenTelemetry + @opentelemetry/sdk-node
├─ Python → OpenTelemetry + opentelemetry-sdk
├─ Java → OpenTelemetry agent (zero-code) or manual SDK
└─ Other → OpenTelemetry language-specific SDK
How many services (microservices)?
├─ Single → Simple Application Insights setup, no special tracing
├─ 2-5 services → OpenTelemetry with correlation IDs across calls
└─ 5+ services → Distributed trace propagation (W3C Trace Context)
What's the expected volume?
├─ < 1M events/day → 100% sampling acceptable
├─ 1-10M → 10-25% sampling with head-based decisions
└─ > 10M → 1-5% sampling with tail-based (post-request) sampling decisions
Create Application Insights resource:
az monitor app-insights component create \
--resource-group $RG \
--app-name "ai-${app}-${env}" \
--location eastus
# Get instrumentation key
IKEY=$(az monitor app-insights component show --resource-group $RG --app-name "ai-${app}-${env}" --query "instrumentationKey")
Create Log Analytics workspace (for KQL queries):
az monitor log-analytics workspace create \
--resource-group $RG \
--workspace-name "law-${app}-${env}"
# Link to Application Insights
az monitor app-insights component update --resource-group $RG --app-name "ai-${app}-${env}" \
--workspace "/subscriptions/$SUBID/resourceGroups/$RG/providers/Microsoft.OperationalInsights/workspaces/law-${app}-${env}"
Configure retention policy:
Example 1: .NET
# Install NuGet packages
dotnet add package Microsoft.ApplicationInsights.AspNetCore
dotnet add package Microsoft.ApplicationInsights.DependencyCollector
// In Program.cs
builder.Services.AddApplicationInsightsTelemetry();
// Instrumentation key from Key Vault
var ikeySecret = new DefaultAzureCredential();
var kvUri = new Uri($"https://{kvName}.vault.azure.net");
var kvClient = new SecretClient(kvUri, ikeySecret);
var ikeySecret = kvClient.GetSecret("APPINSIGHTS_INSTRUMENTATION_KEY");
Example 2: Node.js with OpenTelemetry
npm install @opentelemetry/api @opentelemetry/sdk-node \
@opentelemetry/auto-instrumentations-node \
@opentelemetry/exporter-trace-otlp-http @opentelemetry/sdk-trace-node
// instrumentation.js (first require in entry point)
const { NodeTracerProvider } = require("@opentelemetry/sdk-node");
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node");
const { OTLPTraceExporter } = require("@opentelemetry/exporter-trace-otlp-http");
const traceExporter = new OTLPTraceExporter({
url: `https://${process.env.APPLICATIONINSIGHTS_ENDPOINT_URL}/v2.1/track`
});
const sdk = new NodeSDK({
traceExporter,
instrumentations: [getNodeAutoInstrumentations()]
});
sdk.start();
Example 3: Python
pip install opentelemetry-api opentelemetry-sdk \
opentelemetry-exporter-azure-monitor \
opentelemetry-instrumentation-flask opentelemetry-instrumentation-requests
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor(
connection_string=os.environ.get("APPLICATIONINSIGHTS_CONNECTION_STRING")
)
Track custom events (business logic):
// .NET
telemetryClient.TrackEvent("UserSignup", new Dictionary<string, string> {
{ "signup_source", "mobile_app" },
{ "user_tier", "premium" }
});
// Node.js
const tracer = trace.getTracer("app");
const span = tracer.startSpan("UserSignup", {
attributes: { "signup_source": "mobile_app", "user_tier": "premium" }
});
Track custom metrics:
// .NET: Track duration
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
ProcessOrder(order);
stopwatch.Stop();
telemetryClient.GetMetric("ProcessOrderDuration").TrackValue(stopwatch.ElapsedMilliseconds);
Add correlation context:
// Automatic: Activity.Current.Id correlates across services
// Manual: Add request ID to headers
using (var activity = new System.Diagnostics.Activity("ProcessPayment").Start()) {
activity.AddTag("order_id", orderId);
CallDownstreamAPI(); // Downstream receives trace context in headers
}
Adaptive sampling (default):
Automatically reduces sample rate when volume spikes
- Default: 25 events/sec threshold
- Above: Reduces to 5% sampling
- Below: Continues 100% sampling
services.Configure<ApplicationInsightsServiceOptions>(options => {
options.SamplingSettings = new SamplingSettings {
MaxTelemetryItemsPerSecond = 20,
EvaluationInterval = TimeSpan.FromMinutes(1),
SampledItemCount = 5
};
});
Fixed sampling (simpler, for testing):
Always sample 10% of requests
Useful for known volume or testing
Tail-based sampling (advanced):
Business KPI dashboard:
// Failed signups in last hour
customEvents
| where name == "SignupFailed"
| where timestamp > ago(1h)
| summarize count() by tostring(customDimensions.failure_reason)
// Average order processing time
customMetrics
| where name == "ProcessOrderDuration"
| summarize avg(value) by bin(timestamp, 5m)
Performance dashboard:
// Request latency (p50, p95, p99)
requests
| summarize p50=percentile(duration,50), p95=percentile(duration,95), p99=percentile(duration,99) by bin(timestamp, 1m)
// Dependency failures
dependencies
| where success == false
| summarize count() by target, type, resultCode
Alert rules (trigger on SLA breach):
Condition: Error rate > 5% in 5 minutes
→ Severity 2 (warning)
→ Notify: on-call via email, PagerDuty
Condition: Response time p99 > 1000ms in 10 minutes
→ Severity 3 (info)
→ Notify: #alerts Slack channel
Condition: Any database connectivity failures
→ Severity 1 (critical)
→ Immediate escalation to DBA
Follow request through services:
User → API Gateway (trace-id: abc123)
→ Auth Service (inherits trace-id: abc123)
→ Database (inherits trace-id: abc123)
All logs linked via same trace-id; one query finds entire flow
Root cause analysis query:
let trace_id = "abc123";
union
(requests | where operation_Id == trace_id),
(dependencies | where operation_Id == trace_id),
(exceptions | where operation_Id == trace_id),
(traces | where operation_Id == trace_id),
(customEvents | where tostring(customDimensions.trace_id) == trace_id)
| project timestamp, type, message, target, success
| order by timestamp asc
Instrumentation Plan
Implementation Checklist
Telemetry Schema
Dashboard & Alert Baseline
Validation Steps
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Ably tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abstract tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abuselpdb tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abyssale tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。