{"id":"a4c398ba-c4d4-4791-bfb1-855f3906129c","shortId":"PGZmtB","kind":"skill","title":"azure-monitor-opentelemetry-exporter-java","tagline":"Azure Monitor OpenTelemetry Exporter for Java. Export OpenTelemetry traces, metrics, and logs to Azure Monitor/Application Insights.","description":"# Azure Monitor OpenTelemetry Exporter for Java\n\n> **⚠️ DEPRECATION NOTICE**: This package is deprecated. Migrate to `azure-monitor-opentelemetry-autoconfigure`.\n>\n> See [Migration Guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/MIGRATION.md) for detailed instructions.\n\nExport OpenTelemetry telemetry data to Azure Monitor / Application Insights.\n\n## Installation (Deprecated)\n\n```xml\n<dependency>\n    <groupId>com.azure</groupId>\n    <artifactId>azure-monitor-opentelemetry-exporter</artifactId>\n    <version>1.0.0-beta.x</version>\n</dependency>\n```\n\n## Recommended: Use Autoconfigure Instead\n\n```xml\n<dependency>\n    <groupId>com.azure</groupId>\n    <artifactId>azure-monitor-opentelemetry-autoconfigure</artifactId>\n    <version>LATEST</version>\n</dependency>\n```\n\n## Environment Variables\n\n```bash\nAPPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/\n```\n\n## Basic Setup with Autoconfigure (Recommended)\n\n### Using Environment Variable\n\n```java\nimport io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;\nimport io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder;\nimport io.opentelemetry.api.OpenTelemetry;\nimport com.azure.monitor.opentelemetry.exporter.AzureMonitorExporter;\n\n// Connection string from APPLICATIONINSIGHTS_CONNECTION_STRING env var\nAutoConfiguredOpenTelemetrySdkBuilder sdkBuilder = AutoConfiguredOpenTelemetrySdk.builder();\nAzureMonitorExporter.customize(sdkBuilder);\nOpenTelemetry openTelemetry = sdkBuilder.build().getOpenTelemetrySdk();\n```\n\n### With Explicit Connection String\n\n```java\nAutoConfiguredOpenTelemetrySdkBuilder sdkBuilder = AutoConfiguredOpenTelemetrySdk.builder();\nAzureMonitorExporter.customize(sdkBuilder, \"{connection-string}\");\nOpenTelemetry openTelemetry = sdkBuilder.build().getOpenTelemetrySdk();\n```\n\n## Creating Spans\n\n```java\nimport io.opentelemetry.api.trace.Tracer;\nimport io.opentelemetry.api.trace.Span;\nimport io.opentelemetry.context.Scope;\n\n// Get tracer\nTracer tracer = openTelemetry.getTracer(\"com.example.myapp\");\n\n// Create span\nSpan span = tracer.spanBuilder(\"myOperation\").startSpan();\n\ntry (Scope scope = span.makeCurrent()) {\n    // Your application logic\n    doWork();\n} catch (Throwable t) {\n    span.recordException(t);\n    throw t;\n} finally {\n    span.end();\n}\n```\n\n## Adding Span Attributes\n\n```java\nimport io.opentelemetry.api.common.AttributeKey;\nimport io.opentelemetry.api.common.Attributes;\n\nSpan span = tracer.spanBuilder(\"processOrder\")\n    .setAttribute(\"order.id\", \"12345\")\n    .setAttribute(\"customer.tier\", \"premium\")\n    .startSpan();\n\ntry (Scope scope = span.makeCurrent()) {\n    // Add attributes during execution\n    span.setAttribute(\"items.count\", 3);\n    span.setAttribute(\"total.amount\", 99.99);\n    \n    processOrder();\n} finally {\n    span.end();\n}\n```\n\n## Custom Span Processor\n\n```java\nimport io.opentelemetry.sdk.trace.SpanProcessor;\nimport io.opentelemetry.sdk.trace.ReadWriteSpan;\nimport io.opentelemetry.sdk.trace.ReadableSpan;\nimport io.opentelemetry.context.Context;\n\nprivate static final AttributeKey<String> CUSTOM_ATTR = AttributeKey.stringKey(\"custom.attribute\");\n\nSpanProcessor customProcessor = new SpanProcessor() {\n    @Override\n    public void onStart(Context context, ReadWriteSpan span) {\n        // Add custom attribute to every span\n        span.setAttribute(CUSTOM_ATTR, \"customValue\");\n    }\n\n    @Override\n    public boolean isStartRequired() {\n        return true;\n    }\n\n    @Override\n    public void onEnd(ReadableSpan span) {\n        // Post-processing if needed\n    }\n\n    @Override\n    public boolean isEndRequired() {\n        return false;\n    }\n};\n\n// Register processor\nAutoConfiguredOpenTelemetrySdkBuilder sdkBuilder = AutoConfiguredOpenTelemetrySdk.builder();\nAzureMonitorExporter.customize(sdkBuilder);\n\nsdkBuilder.addTracerProviderCustomizer(\n    (sdkTracerProviderBuilder, configProperties) -> \n        sdkTracerProviderBuilder.addSpanProcessor(customProcessor)\n);\n\nOpenTelemetry openTelemetry = sdkBuilder.build().getOpenTelemetrySdk();\n```\n\n## Nested Spans\n\n```java\npublic void parentOperation() {\n    Span parentSpan = tracer.spanBuilder(\"parentOperation\").startSpan();\n    try (Scope scope = parentSpan.makeCurrent()) {\n        childOperation();\n    } finally {\n        parentSpan.end();\n    }\n}\n\npublic void childOperation() {\n    // Automatically links to parent via Context\n    Span childSpan = tracer.spanBuilder(\"childOperation\").startSpan();\n    try (Scope scope = childSpan.makeCurrent()) {\n        // Child work\n    } finally {\n        childSpan.end();\n    }\n}\n```\n\n## Recording Exceptions\n\n```java\nSpan span = tracer.spanBuilder(\"riskyOperation\").startSpan();\ntry (Scope scope = span.makeCurrent()) {\n    performRiskyWork();\n} catch (Exception e) {\n    span.recordException(e);\n    span.setStatus(StatusCode.ERROR, e.getMessage());\n    throw e;\n} finally {\n    span.end();\n}\n```\n\n## Metrics (via OpenTelemetry)\n\n```java\nimport io.opentelemetry.api.metrics.Meter;\nimport io.opentelemetry.api.metrics.LongCounter;\nimport io.opentelemetry.api.metrics.LongHistogram;\n\nMeter meter = openTelemetry.getMeter(\"com.example.myapp\");\n\n// Counter\nLongCounter requestCounter = meter.counterBuilder(\"http.requests\")\n    .setDescription(\"Total HTTP requests\")\n    .setUnit(\"requests\")\n    .build();\n\nrequestCounter.add(1, Attributes.of(\n    AttributeKey.stringKey(\"http.method\"), \"GET\",\n    AttributeKey.longKey(\"http.status_code\"), 200L\n));\n\n// Histogram\nLongHistogram latencyHistogram = meter.histogramBuilder(\"http.latency\")\n    .setDescription(\"Request latency\")\n    .setUnit(\"ms\")\n    .ofLongs()\n    .build();\n\nlatencyHistogram.record(150, Attributes.of(\n    AttributeKey.stringKey(\"http.route\"), \"/api/users\"\n));\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| Connection String | Application Insights connection string with instrumentation key |\n| Tracer | Creates spans for distributed tracing |\n| Span | Represents a unit of work with timing and attributes |\n| SpanProcessor | Intercepts span lifecycle for customization |\n| Exporter | Sends telemetry to Azure Monitor |\n\n## Migration to Autoconfigure\n\nThe `azure-monitor-opentelemetry-autoconfigure` package provides:\n- Automatic instrumentation of common libraries\n- Simplified configuration\n- Better integration with OpenTelemetry SDK\n\n### Migration Steps\n\n1. Replace dependency:\n   ```xml\n   <!-- Remove -->\n   <dependency>\n       <groupId>com.azure</groupId>\n       <artifactId>azure-monitor-opentelemetry-exporter</artifactId>\n   </dependency>\n   \n   <!-- Add -->\n   <dependency>\n       <groupId>com.azure</groupId>\n       <artifactId>azure-monitor-opentelemetry-autoconfigure</artifactId>\n   </dependency>\n   ```\n\n2. Update initialization code per [Migration Guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/MIGRATION.md)\n\n## Best Practices\n\n1. **Use autoconfigure** — Migrate to `azure-monitor-opentelemetry-autoconfigure`\n2. **Set meaningful span names** — Use descriptive operation names\n3. **Add relevant attributes** — Include contextual data for debugging\n4. **Handle exceptions** — Always record exceptions on spans\n5. **Use semantic conventions** — Follow OpenTelemetry semantic conventions\n6. **End spans in finally** — Ensure spans are always ended\n7. **Use try-with-resources** — Scope management with try-with-resources pattern\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| Maven Package | https://central.sonatype.com/artifact/com.azure/azure-monitor-opentelemetry-exporter |\n| GitHub | https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/monitor/azure-monitor-opentelemetry-exporter |\n| Migration Guide | https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/MIGRATION.md |\n| Autoconfigure Package | https://central.sonatype.com/artifact/com.azure/azure-monitor-opentelemetry-autoconfigure |\n| OpenTelemetry Java | https://opentelemetry.io/docs/languages/java/ |\n| Application Insights | https://learn.microsoft.com/azure/azure-monitor/app/app-insights-overview |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["azure","monitor","opentelemetry","exporter","java","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills"],"capabilities":["skill","source-sickn33","skill-azure-monitor-opentelemetry-exporter-java","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-java","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34928 github stars · SKILL.md body (8,625 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T18:50:32.609Z","embedding":null,"createdAt":"2026-04-18T21:32:51.902Z","updatedAt":"2026-04-24T18:50:32.609Z","lastSeenAt":"2026-04-24T18:50:32.609Z","tsv":"'/api/users':418 '/artifact/com.azure/azure-monitor-opentelemetry-autoconfigure':603 '/artifact/com.azure/azure-monitor-opentelemetry-exporter':589 '/azure/azure-monitor/app/app-insights-overview':613 '/azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/migration.md':598 '/azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/migration.md)':47,510 '/azure/azure-sdk-for-java/tree/main/sdk/monitor/azure-monitor-opentelemetry-exporter':593 '/docs/languages/java/':608 '1':392,485,513 '1.0.0':69 '12345':197 '150':414 '2':501,523 '200l':400 '3':212,532 '4':541 '5':549 '6':557 '7':567 '99.99':215 'action':626 'ad':183 'add':206,251,533 'alway':544,565 'applic':58,171,425,609,620 'applicationinsight':86,113 'ask':664 'attr':236,259 'attribut':185,207,253,447,535 'attributekey':234 'attributekey.longkey':397 'attributekey.stringkey':237,394,416 'attributes.of':393,415 'autoconfigur':41,73,81,96,462,468,500,515,522,599 'autoconfiguredopentelemetrysdk.builder':120,134,288 'autoconfiguredopentelemetrysdkbuild':118,132,286 'automat':321,471 'azur':2,7,20,23,38,56,65,78,458,465,491,497,519 'azure-monitor-opentelemetry-autoconfigur':37,77,464,496,518 'azure-monitor-opentelemetry-export':64,490 'azure-monitor-opentelemetry-exporter-java':1 'azuremonitorexporter.customize':121,135,289 'bash':85 'basic':93 'best':511 'beta.x':70 'better':478 'boolean':263,280 'boundari':672 'build':390,412 'catch':174,353 'central.sonatype.com':588,602 'central.sonatype.com/artifact/com.azure/azure-monitor-opentelemetry-autoconfigure':601 'central.sonatype.com/artifact/com.azure/azure-monitor-opentelemetry-exporter':587 'child':336 'childoper':315,320,330 'childspan':328 'childspan.end':339 'childspan.makecurrent':335 'clarif':666 'clear':639 'code':399,504 'com.azure':63,76,489,495 'com.azure.monitor.opentelemetry.exporter.azuremonitorexporter':109 'com.example.myapp':158,378 'common':474 'concept':420,421 'configproperti':293 'configur':477 'connect':87,110,114,129,138,423,427 'connection-str':137 'context':247,248,326 'contextu':537 'convent':552,556 'counter':379 'creat':144,159,433 'criteria':675 'custom':219,235,252,258,453 'custom.attribute':238 'customer.tier':199 'customprocessor':240,295 'customvalu':260 'data':54,538 'debug':540 'depend':487 'deprec':29,34,61 'describ':627,643 'descript':422,529 'detail':49 'distribut':436 'dowork':173 'e':355,357,362 'e.getmessage':360 'end':558,566 'ensur':562 'env':116 'environ':83,99,655 'environment-specif':654 'everi':255 'except':341,354,543,546 'execut':209,622 'expert':660 'explicit':128 'export':5,10,13,26,51,68,454,494 'fals':283 'final':181,217,233,316,338,363,561 'follow':553 'get':153,396 'getopentelemetrysdk':126,143,299 'github':590 'github.com':46,509,592,597 'github.com/azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/migration.md':596 'github.com/azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/migration.md)':45,508 'github.com/azure/azure-sdk-for-java/tree/main/sdk/monitor/azure-monitor-opentelemetry-exporter':591 'guid':44,507,595 'handl':542 'histogram':401 'http':386 'http.latency':405 'http.method':395 'http.requests':383 'http.route':417 'http.status':398 'import':102,104,106,108,147,149,151,187,189,223,225,227,229,369,371,373 'includ':536 'ingestionendpoint':91 'initi':503 'input':669 'insight':22,59,426,610 'instal':60 'instead':74 'instruct':50 'instrument':430,472 'instrumentationkey':89 'integr':479 'intercept':449 'io.opentelemetry.api.common.attributekey':188 'io.opentelemetry.api.common.attributes':190 'io.opentelemetry.api.metrics.longcounter':372 'io.opentelemetry.api.metrics.longhistogram':374 'io.opentelemetry.api.metrics.meter':370 'io.opentelemetry.api.opentelemetry':107 'io.opentelemetry.api.trace.span':150 'io.opentelemetry.api.trace.tracer':148 'io.opentelemetry.context.context':230 'io.opentelemetry.context.scope':152 'io.opentelemetry.sdk.autoconfigure.autoconfiguredopentelemetrysdk':103 'io.opentelemetry.sdk.autoconfigure.autoconfiguredopentelemetrysdkbuilder':105 'io.opentelemetry.sdk.trace.readablespan':228 'io.opentelemetry.sdk.trace.readwritespan':226 'io.opentelemetry.sdk.trace.spanprocessor':224 'isendrequir':281 'isstartrequir':264 'items.count':211 'java':6,12,28,101,131,146,186,222,302,342,368,605 'key':419,431 'latenc':408 'latencyhistogram':403 'latencyhistogram.record':413 'latest':82 'learn.microsoft.com':612 'learn.microsoft.com/azure/azure-monitor/app/app-insights-overview':611 'librari':475 'lifecycl':451 'limit':631 'link':322,582 'log':18 'logic':172 'longcount':380 'longhistogram':402 'manag':574 'match':640 'maven':585 'meaning':525 'meter':375,376 'meter.counterbuilder':382 'meter.histogrambuilder':404 'metric':16,365 'migrat':35,43,460,483,506,516,594 'miss':677 'monitor':3,8,24,39,57,66,79,459,466,492,498,520 'monitor/application':21 'ms':410 'myoper':164 'name':527,531 'need':277 'nest':300 'new':241 'notic':30 'oflong':411 'onend':270 'onstart':246 'opentelemetri':4,9,14,25,40,52,67,80,123,124,140,141,296,297,367,467,481,493,499,521,554,604 'opentelemetry.getmeter':377 'opentelemetry.gettracer':157 'opentelemetry.io':607 'opentelemetry.io/docs/languages/java/':606 'oper':530 'order.id':196 'output':649 'overrid':243,261,267,278 'overview':630 'packag':32,469,586,600 'parent':324 'parentoper':305,309 'parentspan':307 'parentspan.end':317 'parentspan.makecurrent':314 'pattern':580 'per':505 'performriskywork':352 'permiss':670 'post':274 'post-process':273 'practic':512 'premium':200 'privat':231 'process':275 'processor':221,285 'processord':194,216 'provid':470 'public':244,262,268,279,303,318 'readablespan':271 'readwritespan':249 'recommend':71,97 'record':340,545 'refer':581 'regist':284 'relev':534 'replac':486 'repres':439 'request':387,389,407 'requestcount':381 'requestcounter.add':391 'requir':668 'resourc':572,579,583 'return':265,282 'review':661 'riskyoper':346 'safeti':671 'scope':167,168,203,204,312,313,333,334,349,350,573,642 'sdk':482 'sdkbuilder':119,122,133,136,287,290 'sdkbuilder.addtracerprovidercustomizer':291 'sdkbuilder.build':125,142,298 'sdktracerproviderbuild':292 'sdktracerproviderbuilder.addspanprocessor':294 'see':42 'semant':551,555 'send':455 'set':524 'setattribut':195,198 'setdescript':384,406 'setunit':388,409 'setup':94 'simplifi':476 'skill':618,634 'skill-azure-monitor-opentelemetry-exporter-java' 'source-sickn33' 'span':145,160,161,162,184,191,192,220,250,256,272,301,306,327,343,344,434,438,450,526,548,559,563 'span.end':182,218,364 'span.makecurrent':169,205,351 'span.recordexception':177,356 'span.setattribute':210,213,257 'span.setstatus':358 'spanprocessor':239,242,448 'specif':656 'startspan':165,201,310,331,347 'static':232 'statuscode.error':359 'step':484 'stop':662 'string':88,111,115,130,139,424,428 'substitut':652 'success':674 'task':638 'telemetri':53,456 'test':658 'throw':179,361 'throwabl':175 'time':445 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'total':385 'total.amount':214 'trace':15,437 'tracer':154,155,156,432 'tracer.spanbuilder':163,193,308,329,345 'treat':647 'tri':166,202,311,332,348,570,577 'true':266 'try-with-resourc':569,576 'unit':441 'updat':502 'url':584 'use':72,98,514,528,550,568,616,632 'valid':657 'var':117 'variabl':84,100 'via':325,366 'void':245,269,304,319 'work':337,443 'workflow':624 'xml':62,75,488 'xxx':90 'xxx.in.applicationinsights.azure.com':92","prices":[{"id":"bf956b86-4381-4bd3-a3ff-235bc62fa1d7","listingId":"a4c398ba-c4d4-4791-bfb1-855f3906129c","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:32:51.902Z"}],"sources":[{"listingId":"a4c398ba-c4d4-4791-bfb1-855f3906129c","source":"github","sourceId":"sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-java","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-opentelemetry-exporter-java","isPrimary":false,"firstSeenAt":"2026-04-18T21:32:51.902Z","lastSeenAt":"2026-04-24T18:50:32.609Z"}],"details":{"listingId":"a4c398ba-c4d4-4791-bfb1-855f3906129c","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"azure-monitor-opentelemetry-exporter-java","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34928,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"fa1c65b981dfc0f0d5bc93f003d932b37846cd55","skill_md_path":"skills/azure-monitor-opentelemetry-exporter-java/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-monitor-opentelemetry-exporter-java"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"azure-monitor-opentelemetry-exporter-java","description":"Azure Monitor OpenTelemetry Exporter for Java. Export OpenTelemetry traces, metrics, and logs to Azure Monitor/Application Insights."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-monitor-opentelemetry-exporter-java"},"updatedAt":"2026-04-24T18:50:32.609Z"}}