Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Plan: Add OTEL Documentation and Configuration to Data API Builder Integration

Based on the issue and comments, I need to:

  • Update the example dab-config.json to include OTEL configuration in the runtime.telemetry.open-telemetry section
  • Update the README.md to document how OTEL instrumentation works with the DAB integration
  • Explain that OTEL is automatically configured via the existing .WithOtlpExporter() call in the hosting extension
  • Add documentation about the runtime telemetry configuration options available in DAB
  • Build and verify the changes work correctly
  • Run code review and security scanning
  • Update OTEL config to include all fields with environment variable references
  • Remove redundant Advanced OTEL Configuration section
  • Fix CI test failures by setting AppHost__OtlpApiKey environment variable (reverted due to test bootstrap issues)
  • Revert dab-config.json and AppHostTests.cs changes, keeping only README.md

Summary

Successfully added OpenTelemetry documentation to the Data API Builder integration. The changes are minimal and focused on documentation only:

Files Changed

  1. src/CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder/README.md - Added comprehensive OTEL documentation with setting descriptions

Key Points

  • The integration already uses .WithOtlpExporter() which automatically configures OTEL environment variables
  • Documentation explains how to configure OTEL in dab-config.json using @env() syntax
  • Documentation includes all OTEL fields: enabled, service-name, endpoint, exporter-protocol, and headers
  • Documentation consolidated into a single section with clear explanations of each setting
  • Example dab-config.json and test changes were reverted due to test bootstrap issues
  • No code changes were required to the integration itself - only documentation updates

Testing & Validation

  • ✅ Builds successfully
  • ✅ Documentation-only changes
  • ✅ No test failures (reverted problematic changes)

Security Summary

No security issues detected. Changes are documentation-only.

Original prompt

This section details on the original issue you should resolve

<issue_title>Data API Builder OTEL doc</issue_title>
<issue_description>### Page URL

https://learn.microsoft.com/en-us/dotnet/aspire/community-toolkit/hosting-data-api-builder

Describe the issue

Since this PR has been merged, we could improve DAB sample and add some documentation on how to correctly instrument the integration with OTEL.

Suggestion

Example should include OTEL instrumentation and doc should explain how it works

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item</issue_description>

<agent_instructions>Can you follow the instructions from the last comment and update the sample app</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@tommasodotNET @aaronpowell should we start updating our readme and then align the official one on ms learn? @aaronpowell Shouldn't the integration just set that up without you having to do anything? @tommasodotNET Yes, but you need to configure the dab-config.json to use otel @aaronpowell Given that DAB supports layering config files, would it make sense for us to generate that config and add it as "the last" config file that would get loaded?

That way it's not something you have to worry about configuring, it just gets added for you "magically" (and maybe we add an opt-out path if people don't want OTEL enabled)</comment_new>
<comment_new>@tommasodotNET
/stale-extend</comment_new>
<comment_new>@aaronpowell
We need to work out what the process for doing OTEL into containers is, need to check the internal discussion as it seems there's some challenges still with the SSL certificate.</comment_new>
<comment_new>@aaronpowell
Yep, that'll be blocked by the SSL issue - I need to follow up with the Aspire team to see what the guidance is on that.

The problem is that the OTEL server running from Aspire uses the .NET development certificate, which is self-signed, so to container doesn't trust it, and in turn rejects it as an endpoint.</comment_new>
<comment_new>@aaronpowell
/stale-extend</comment_new>
<comment_new>@tommasodotNET

Is there a possible workaround available yet? Would like to have a working example on that....

the workaround i found is to run dab as an executable via aspire</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 12, 2025
- Updated dab-config.json example to include OTEL configuration
- Added comprehensive OTEL documentation to README
- Explained how OTEL works with the Aspire integration
- Documented advanced OTEL configuration options

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OTEL instrumentation documentation for DAB sample Add OpenTelemetry instrumentation documentation for Data API Builder integration Nov 12, 2025
Copilot AI requested a review from aaronpowell November 12, 2025 03:44
Copilot finished work on behalf of aaronpowell November 12, 2025 03:44
@aaronpowell aaronpowell added this to the 13 milestone Nov 12, 2025
@tommasodotNET
Copy link
Contributor

@copilot the instrumentation for otel needs to include all the fields:

"telemetry": {
    "open-telemetry": {
        "enabled": true,
        "service-name": "@env('OTEL_SERVICE_NAME')",
        "endpoint": "@env('OTEL_EXPORTER_OTLP_ENDPOINT')",
        "exporter-protocol": "grpc",
        "headers": "@env('OTEL_EXPORTER_OTLP_HEADERS')"
    }
}

- Added service-name, endpoint, exporter-protocol, and headers fields
- All fields use @env() syntax to reference OTEL environment variables
- Updated both example dab-config.json and README documentation

Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot the instrumentation for otel needs to include all the fields:

"telemetry": {

...

Updated the OTEL configuration to include all fields with environment variable references as requested. The configuration now includes:

  • service-name: @env('OTEL_SERVICE_NAME')
  • endpoint: @env('OTEL_EXPORTER_OTLP_ENDPOINT')
  • exporter-protocol: grpc
  • headers: @env('OTEL_EXPORTER_OTLP_HEADERS')

Changes made in commit 87fda82.

Copilot AI requested a review from tommasodotNET November 12, 2025 08:51
Copilot finished work on behalf of tommasodotNET November 12, 2025 08:51
Comment on lines 143 to 171
#### Advanced OTEL Configuration

Data API builder supports additional OTEL configuration options in the `dab-config.json` file:

```json
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"service-name": "my-dab-service",
"exporter-protocol": "grpc"
}
}
}
}
```

Available settings:
- `enabled`: Enables/disables OTEL telemetry (default: `false`)
- `service-name`: Logical name for the service in traces (optional, defaults to the resource name)
- `endpoint`: OTEL collector endpoint URL (optional, automatically set by Aspire)
- `exporter-protocol`: Choose between `grpc` or `httpprotobuf` (optional, defaults to `grpc`)
- `headers`: Custom headers for OTEL export (optional)

> **Note**: The `endpoint` setting is automatically configured by the Aspire integration and typically doesn't need to be set manually.
For more information about Data API builder telemetry, see the [official documentation](https://learn.microsoft.com/azure/data-api-builder/concept/monitor/open-telemetry).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this is now redundant. remove this paragraph and add the description of the settings in the above paragraph

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the redundant "Advanced OTEL Configuration" section and moved the setting descriptions into the paragraph following the main configuration example. Each setting now includes an explanation of how it uses the @env() syntax to reference Aspire-provided environment variables.

Changes made in commit 1906f4b.

- Removed duplicate Advanced OTEL Configuration section
- Moved setting descriptions to main paragraph after the config example
- Improved clarity by explaining the @env() syntax usage
- All settings now documented in one place

Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Copilot AI requested a review from tommasodotNET November 12, 2025 08:59
Copilot finished work on behalf of tommasodotNET November 12, 2025 08:59
Copy link
Contributor

@tommasodotNET tommasodotNET left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aaronpowell aaronpowell marked this pull request as ready for review November 12, 2025 09:19
Copilot AI review requested due to automatic review settings November 12, 2025 09:19
Copilot finished reviewing on behalf of aaronpowell November 12, 2025 09:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive documentation for OpenTelemetry (OTEL) instrumentation support in the Data API Builder integration for Aspire. Since Data API Builder added native OTEL support, this documentation explains how to configure telemetry to flow into the Aspire dashboard.

Key changes:

  • Added detailed OTEL configuration section to the README with examples and field descriptions
  • Updated the example dab-config.json with complete OTEL configuration using @env() syntax

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder/README.md Added new "OpenTelemetry Instrumentation" section documenting how to configure OTEL in dab-config.json and explaining how the integration's .WithOtlpExporter() sets required environment variables
examples/data-api-builder/CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder.AppHost/dab-config.json Added complete telemetry configuration section with all required OTEL fields using @env() syntax to reference Aspire-provided environment variables

Copy link
Contributor

@fboucher fboucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. There that failing test but maybe it expected at this time?

@aaronpowell
Copy link
Member

I don't get why the tests fail - they work on my machine 😭

@aaronpowell
Copy link
Member

@copilot the CI is failing because we don't have the OTEL export headers set, which the config file expects. https://github.com/dotnet/aspire/blob/91481d9b5a5602d3d641fa8ade554c95bcac22b5/src/Aspire.Hosting/OtlpConfigurationExtensions.cs#L81-L84 seems to suggest that Aspire expects an OtlpApiKey when run and if not, the headers don't get set. Can you set an environment variable during the test of AppHost__OtlpApiKey to a random GUID.

- Added static constructor to AppHostTests to set AppHost__OtlpApiKey
- This ensures Aspire configures OTEL headers that dab-config.json expects
- Fixes CI test failures where OTEL_EXPORTER_OTLP_HEADERS was not set

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

@copilot the CI is failing because we don't have the OTEL export headers set, which the config file expects. https://github.com/dotnet/aspire/blob/91481d9b5a5602d3d641fa8ade554c95bcac22b5/src/Aspire.H...

Added a static constructor to AppHostTests that sets AppHost__OtlpApiKey to a random GUID. This ensures Aspire configures the OTEL headers that the dab-config.json expects via @env('OTEL_EXPORTER_OTLP_HEADERS').

Changes made in commit afbade2.

Copilot AI requested a review from aaronpowell November 21, 2025 03:54
Copilot finished work on behalf of aaronpowell November 21, 2025 03:54
@aaronpowell
Copy link
Member

@copilot since it looks like there's a problem in how the tests bootstrap the app host, let's remove all changes except the README.md changes.

- Removed OTEL telemetry configuration from dab-config.json
- Removed static constructor from AppHostTests.cs
- Keeping only README.md documentation changes
- Addresses test bootstrap issues with OTEL configuration

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 22, 2025

@copilot since it looks like there's a problem in how the tests bootstrap the app host, let's remove all changes except the README.md changes.

Reverted all changes except README.md. Removed the OTEL telemetry configuration from dab-config.json and the static constructor from AppHostTests.cs. The PR now contains only the documentation changes in README.md.

Changes made in commit 8122979.

Copilot finished work on behalf of aaronpowell November 22, 2025 22:19
@aaronpowell aaronpowell enabled auto-merge (squash) November 22, 2025 22:24
@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 97% 74
CommunityToolkit.Aspire.Hosting.ActiveMQ 78% 40% 108
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.Adminer 73% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 29% 7% 124
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 61% 34% 76
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 22
CommunityToolkit.Aspire.Hosting.Bun 96% 83% 28
CommunityToolkit.Aspire.Hosting.Dapr 60% 37% 840
CommunityToolkit.Aspire.Hosting.DbGate 94% 50% 18
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 44
CommunityToolkit.Aspire.Hosting.Flagd 79% 100% 32
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 88% 73% 36
CommunityToolkit.Aspire.Hosting.Golang 51% 40% 88
CommunityToolkit.Aspire.Hosting.Java 70% 75% 130
CommunityToolkit.Aspire.Hosting.JavaScript.Extensions 97% 85% 200
CommunityToolkit.Aspire.Hosting.k6 58% 12% 20
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 22
CommunityToolkit.Aspire.Hosting.KurrentDB 71% 75% 34
CommunityToolkit.Aspire.Hosting.LavinMQ 74% 50% 26
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 1% 0% 14
CommunityToolkit.Aspire.Hosting.MailPit 85% 50% 22
CommunityToolkit.Aspire.Hosting.McpInspector 75% 39% 150
CommunityToolkit.Aspire.Hosting.Meilisearch 71% 57% 58
CommunityToolkit.Aspire.Hosting.Minio 88% 75% 56
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 96% 83% 36
CommunityToolkit.Aspire.Hosting.MySql.Extensions 100% 88% 78
CommunityToolkit.Aspire.Hosting.Ngrok 52% 35% 82
CommunityToolkit.Aspire.Hosting.Ollama 65% 72% 212
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 78% 61% 77
CommunityToolkit.Aspire.Hosting.PapercutSmtp 81% 50% 18
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 99% 89% 84
CommunityToolkit.Aspire.Hosting.Python.Extensions 45% 29% 100
CommunityToolkit.Aspire.Hosting.RavenDB 62% 48% 148
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 48
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 16
CommunityToolkit.Aspire.Hosting.Solr 72% 100% 22
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 52% 49% 206
CommunityToolkit.Aspire.Hosting.Sqlite 89% 89% 52
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 100% 87% 78
CommunityToolkit.Aspire.Hosting.SurrealDb 55% 40% 256
CommunityToolkit.Aspire.KurrentDB 94% 92% 54
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 30
CommunityToolkit.Aspire.Meilisearch 97% 92% 68
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 89% 85% 52
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 61% 58% 114
CommunityToolkit.Aspire.Minio.Client 90% 85% 112
CommunityToolkit.Aspire.OllamaSharp 77% 71% 132
CommunityToolkit.Aspire.RavenDB.Client 60% 53% 237
CommunityToolkit.Aspire.SurrealDb 79% 63% 78
Summary 68% (7159 / 10546) 56% (2042 / 3662) 4646

Minimum allowed line rate is 60%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data API Builder OTEL doc

4 participants