[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FD6PJNCSTVR4M1QTPMCMWP":3,"skill-same:01M6FD6PJNCSTVR4M1QTPMCMWP":51},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":24,"linkOnly":25,"markdownContent":26,"markdownBody":26,"frontMatter":27,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M6FD6PJNCSTVR4M1QTPMCMWP","azure-monitor-query-java",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fazure-monitor-query-java\u002FSKILL.md",[],[18,19,20,21,22,23],"azure","azure monitor query java","monitor","java","query","azure monitor","2026-11-10 10:12:30",false,"# Azure Monitor Query SDK for Java\n\n> **DEPRECATION NOTICE**: This package is deprecated in favor of:\n> - `azure-monitor-query-logs` — For Log Analytics queries\n> - `azure-monitor-query-metrics` — For metrics queries\n>\n> See migration guides: [Logs Migration](https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Fblob\u002Fmain\u002Fsdk\u002Fmonitor\u002Fazure-monitor-query-logs\u002Fmigration-guide.md) | [Metrics Migration](https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Fblob\u002Fmain\u002Fsdk\u002Fmonitor\u002Fazure-monitor-query-metrics\u002Fmigration-guide.md)\n\nClient library for querying Azure Monitor Logs and Metrics.\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-monitor-query\u003C\u002FartifactId>\n    \u003Cversion>1.5.9\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\nOr use Azure SDK BOM:\n\n```xml\n\u003CdependencyManagement>\n    \u003Cdependencies>\n        \u003Cdependency>\n            \u003CgroupId>com.azure\u003C\u002FgroupId>\n            \u003CartifactId>azure-sdk-bom\u003C\u002FartifactId>\n            \u003Cversion>{bom_version}\u003C\u002Fversion>\n            \u003Ctype>pom\u003C\u002Ftype>\n            \u003Cscope>import\u003C\u002Fscope>\n        \u003C\u002Fdependency>\n    \u003C\u002Fdependencies>\n\u003C\u002FdependencyManagement>\n\n\u003Cdependencies>\n    \u003Cdependency>\n        \u003CgroupId>com.azure\u003C\u002FgroupId>\n        \u003CartifactId>azure-monitor-query\u003C\u002FartifactId>\n    \u003C\u002Fdependency>\n\u003C\u002Fdependencies>\n```\n\n## Prerequisites\n\n- Log Analytics workspace (for logs queries)\n- Azure resource (for metrics queries)\n- TokenCredential with appropriate permissions\n\n## Environment Variables\n\n```bash\nLOG_ANALYTICS_WORKSPACE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\nAZURE_RESOURCE_ID=\u002Fsubscriptions\u002F{sub}\u002FresourceGroups\u002F{rg}\u002Fproviders\u002F{provider}\u002F{resource}\n```\n\n## Client Creation\n\n### LogsQueryClient (Sync)\n\n```java\nimport com.azure.identity.DefaultAzureCredentialBuilder;\nimport com.azure.monitor.query.LogsQueryClient;\nimport com.azure.monitor.query.LogsQueryClientBuilder;\n\nLogsQueryClient logsClient = new LogsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildClient();\n```\n\n### LogsQueryAsyncClient\n\n```java\nimport com.azure.monitor.query.LogsQueryAsyncClient;\n\nLogsQueryAsyncClient logsAsyncClient = new LogsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildAsyncClient();\n```\n\n### MetricsQueryClient (Sync)\n\n```java\nimport com.azure.monitor.query.MetricsQueryClient;\nimport com.azure.monitor.query.MetricsQueryClientBuilder;\n\nMetricsQueryClient metricsClient = new MetricsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildClient();\n```\n\n### MetricsQueryAsyncClient\n\n```java\nimport com.azure.monitor.query.MetricsQueryAsyncClient;\n\nMetricsQueryAsyncClient metricsAsyncClient = new MetricsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildAsyncClient();\n```\n\n### Sovereign Cloud Configuration\n\n```java\n\u002F\u002F Azure China Cloud - Logs\nLogsQueryClient logsClient = new LogsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .endpoint(\"https:\u002F\u002Fapi.loganalytics.azure.cn\u002Fv1\")\n    .buildClient();\n\n\u002F\u002F Azure China Cloud - Metrics\nMetricsQueryClient metricsClient = new MetricsQueryClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .endpoint(\"https:\u002F\u002Fmanagement.chinacloudapi.cn\")\n    .buildClient();\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| Logs | Log and performance data from Azure resources via Kusto Query Language |\n| Metrics | Numeric time-series data collected at regular intervals |\n| Workspace ID | Log Analytics workspace identifier |\n| Resource ID | Azure resource URI for metrics queries |\n| QueryTimeInterval | Time range for the query |\n\n## Logs Query Operations\n\n### Basic Query\n\n```java\nimport com.azure.monitor.query.models.LogsQueryResult;\nimport com.azure.monitor.query.models.LogsTableRow;\nimport com.azure.monitor.query.models.QueryTimeInterval;\nimport java.time.Duration;\n\nLogsQueryResult result = logsClient.queryWorkspace(\n    \"{workspace-id}\",\n    \"AzureActivity | summarize count() by ResourceGroup | top 10 by count_\",\n    new QueryTimeInterval(Duration.ofDays(7))\n);\n\nfor (LogsTableRow row : result.getTable().getRows()) {\n    System.out.println(row.getColumnValue(\"ResourceGroup\") + \": \" + row.getColumnValue(\"count_\"));\n}\n```\n\n### Query by Resource ID\n\n```java\nLogsQueryResult result = logsClient.queryResource(\n    \"{resource-id}\",\n    \"AzureMetrics | where TimeGenerated > ago(1h)\",\n    new QueryTimeInterval(Duration.ofDays(1))\n);\n\nfor (LogsTableRow row : result.getTable().getRows()) {\n    System.out.println(row.getColumnValue(\"MetricName\") + \" \" + row.getColumnValue(\"Average\"));\n}\n```\n\n### Map Results to Custom Model\n\n```java\n\u002F\u002F Define model class\npublic class ActivityLog {\n    private String resourceGroup;\n    private String operationName;\n    \n    public String getResourceGroup() { return resourceGroup; }\n    public String getOperationName() { return operationName; }\n}\n\n\u002F\u002F Query with model mapping\nList\u003CActivityLog> logs = logsClient.queryWorkspace(\n    \"{workspace-id}\",\n    \"AzureActivity | project ResourceGroup, OperationName | take 100\",\n    new QueryTimeInterval(Duration.ofDays(2)),\n    ActivityLog.class\n);\n\nfor (ActivityLog log : logs) {\n    System.out.println(log.getOperationName() + \" - \" + log.getResourceGroup());\n}\n```\n\n### Batch Query\n\n```java\nimport com.azure.monitor.query.models.LogsBatchQuery;\nimport com.azure.monitor.query.models.LogsBatchQueryResult;\nimport com.azure.monitor.query.models.LogsBatchQueryResultCollection;\nimport com.azure.core.util.Context;\n\nLogsBatchQuery batchQuery = new LogsBatchQuery();\nString q1 = batchQuery.addWorkspaceQuery(\"{workspace-id}\", \"AzureActivity | count\", new QueryTimeInterval(Duration.ofDays(1)));\nString q2 = batchQuery.addWorkspaceQuery(\"{workspace-id}\", \"Heartbeat | count\", new QueryTimeInterval(Duration.ofDays(1)));\nString q3 = batchQuery.addWorkspaceQuery(\"{workspace-id}\", \"Perf | count\", new QueryTimeInterval(Duration.ofDays(1)));\n\nLogsBatchQueryResultCollection results = logsClient\n    .queryBatchWithResponse(batchQuery, Context.NONE)\n    .getValue();\n\nLogsBatchQueryResult result1 = results.getResult(q1);\nLogsBatchQueryResult result2 = results.getResult(q2);\nLogsBatchQueryResult result3 = results.getResult(q3);\n\n\u002F\u002F Check for failures\nif (result3.getQueryResultStatus() == LogsQueryResultStatus.FAILURE) {\n    System.err.println(\"Query failed: \" + result3.getError().getMessage());\n}\n```\n\n### Query with Options\n\n```java\nimport com.azure.monitor.query.models.LogsQueryOptions;\nimport com.azure.core.http.rest.Response;\n\nLogsQueryOptions options = new LogsQueryOptions()\n    .setServerTimeout(Duration.ofMinutes(10))\n    .setIncludeStatistics(true)\n    .setIncludeVisualization(true);\n\nResponse\u003CLogsQueryResult> response = logsClient.queryWorkspaceWithResponse(\n    \"{workspace-id}\",\n    \"AzureActivity | summarize count() by bin(TimeGenerated, 1h)\",\n    new QueryTimeInterval(Duration.ofDays(7)),\n    options,\n    Context.NONE\n);\n\nLogsQueryResult result = response.getValue();\n\n\u002F\u002F Access statistics\nBinaryData statistics = result.getStatistics();\n\u002F\u002F Access visualization data\nBinaryData visualization = result.getVisualization();\n```\n\n### Query Multiple Workspaces\n\n```java\nimport java.util.Arrays;\n\nLogsQueryOptions options = new LogsQueryOptions()\n    .setAdditionalWorkspaces(Arrays.asList(\"{workspace-id-2}\", \"{workspace-id-3}\"));\n\nResponse\u003CLogsQueryResult> response = logsClient.queryWorkspaceWithResponse(\n    \"{workspace-id-1}\",\n    \"AzureActivity | summarize count() by TenantId\",\n    new QueryTimeInterval(Duration.ofDays(1)),\n    options,\n    Context.NONE\n);\n```\n\n## Metrics Query Operations\n\n### Basic Metrics Query\n\n```java\nimport com.azure.monitor.query.models.MetricsQueryResult;\nimport com.azure.monitor.query.models.MetricResult;\nimport com.azure.monitor.query.models.TimeSeriesElement;\nimport com.azure.monitor.query.models.MetricValue;\nimport java.util.Arrays;\n\nMetricsQueryResult result = metricsClient.queryResource(\n    \"{resource-uri}\",\n    Arrays.asList(\"SuccessfulCalls\", \"TotalCalls\")\n);\n\nfor (MetricResult metric : result.getMetrics()) {\n    System.out.println(\"Metric: \" + metric.getMetricName());\n    for (TimeSeriesElement ts : metric.getTimeSeries()) {\n        System.out.println(\"  Dimensions: \" + ts.getMetadata());\n        for (MetricValue value : ts.getValues()) {\n            System.out.println(\"    \" + value.getTimeStamp() + \": \" + value.getTotal());\n        }\n    }\n}\n```\n\n### Metrics with Aggregations\n\n```java\nimport com.azure.monitor.query.models.MetricsQueryOptions;\nimport com.azure.monitor.query.models.AggregationType;\n\nResponse\u003CMetricsQueryResult> response = metricsClient.queryResourceWithResponse(\n    \"{resource-id}\",\n    Arrays.asList(\"SuccessfulCalls\", \"TotalCalls\"),\n    new MetricsQueryOptions()\n        .setGranularity(Duration.ofHours(1))\n        .setAggregations(Arrays.asList(AggregationType.AVERAGE, AggregationType.COUNT)),\n    Context.NONE\n);\n\nMetricsQueryResult result = response.getValue();\n```\n\n### Query Multiple Resources (MetricsClient)\n\n```java\nimport com.azure.monitor.query.MetricsClient;\nimport com.azure.monitor.query.MetricsClientBuilder;\nimport com.azure.monitor.query.models.MetricsQueryResourcesResult;\n\nMetricsClient metricsClient = new MetricsClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .endpoint(\"{endpoint}\")\n    .buildClient();\n\nMetricsQueryResourcesResult result = metricsClient.queryResources(\n    Arrays.asList(\"{resourceId1}\", \"{resourceId2}\"),\n    Arrays.asList(\"{metric1}\", \"{metric2}\"),\n    \"{metricNamespace}\"\n);\n\nfor (MetricsQueryResult queryResult : result.getMetricsQueryResults()) {\n    for (MetricResult metric : queryResult.getMetrics()) {\n        System.out.println(metric.getMetricName());\n        metric.getTimeSeries().stream()\n            .flatMap(ts -> ts.getValues().stream())\n            .forEach(mv -> System.out.println(\n                mv.getTimeStamp() + \" Count=\" + mv.getCount() + \" Avg=\" + mv.getAverage()));\n    }\n}\n```\n\n## Response Structure\n\n### Logs Response Hierarchy\n\n```\nLogsQueryResult\n├── statistics (BinaryData)\n├── visualization (BinaryData)\n├── error\n└── tables (List\u003CLogsTable>)\n    ├── name\n    ├── columns (List\u003CLogsTableColumn>)\n    │   ├── name\n    │   └── type\n    └── rows (List\u003CLogsTableRow>)\n        ├── rowIndex\n        └── rowCells (List\u003CLogsTableCell>)\n```\n\n### Metrics Response Hierarchy\n\n```\nMetricsQueryResult\n├── granularity\n├── timeInterval\n├── namespace\n├── resourceRegion\n└── metrics (List\u003CMetricResult>)\n    ├── id, name, type, unit\n    └── timeSeries (List\u003CTimeSeriesElement>)\n        ├── metadata (dimensions)\n        └── values (List\u003CMetricValue>)\n            ├── timeStamp\n            ├── count, average, total\n            ├── maximum, minimum\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\nimport com.azure.monitor.query.models.LogsQueryResultStatus;\n\ntry {\n    LogsQueryResult result = logsClient.queryWorkspace(workspaceId, query, timeInterval);\n    \n    \u002F\u002F Check partial failure\n    if (result.getStatus() == LogsQueryResultStatus.PARTIAL_FAILURE) {\n        System.err.println(\"Partial failure: \" + result.getError().getMessage());\n    }\n} catch (HttpResponseException e) {\n    System.err.println(\"Query failed: \" + e.getMessage());\n    System.err.println(\"Status: \" + e.getResponse().getStatusCode());\n}\n```\n\n## Best Practices\n\n1. **Use batch queries** — Combine multiple queries into a single request\n2. **Set appropriate timeouts** — Long queries may need extended server timeout\n3. **Limit result size** — Use `top` or `take` in Kusto queries\n4. **Use projections** — Select only needed columns with `project`\n5. **Check query status** — Handle PARTIAL_FAILURE results gracefully\n6. **Cache results** — Metrics don't change frequently; cache when appropriate\n7. **Migrate to new packages** — Plan migration to `azure-monitor-query-logs` and `azure-monitor-query-metrics`\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| Maven Package | https:\u002F\u002Fcentral.sonatype.com\u002Fartifact\u002Fcom.azure\u002Fazure-monitor-query |\n| GitHub | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Ftree\u002Fmain\u002Fsdk\u002Fmonitor\u002Fazure-monitor-query |\n| API Reference | https:\u002F\u002Flearn.microsoft.com\u002Fjava\u002Fapi\u002Fcom.azure.monitor.query |\n| Kusto Query Language | https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fdata-explorer\u002Fkusto\u002Fquery\u002F |\n| Log Analytics Limits | https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fazure-monitor\u002Fservice-limits#la-query-api |\n| Troubleshooting | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-java\u002Fblob\u002Fmain\u002Fsdk\u002Fmonitor\u002Fazure-monitor-query\u002FTROUBLESHOOTING.md |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fmicrosoft\u002Fskills\u002Fazure-monitor-query-java",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill azure-monitor-query-java",{"tool":43,"command":44},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill azure-monitor-query-java",{"tool":46,"command":47},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill azure-monitor-query-java","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fazure-monitor-query-java\u002FSKILL.md",true,[],[52,66,76,85,91,98],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":62,"publishedAt":24},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[57],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[63,64,65],"model","model hierarchy","model hierarchy skill",{"skillNo":67,"name":68,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":72,"publishedAt":24},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[71],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},[73,74,75],"MCP","zoom","zoom mcp",{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":24},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[82,83,84,74],"sdk","zoom apps sdk","apps",{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":24},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[87],{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":97,"publishedAt":24},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[96],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},[93],{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":24},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[100]]