Skip to content

Conversation

@tommasodotNET
Copy link
Contributor

@tommasodotNET tommasodotNET commented Mar 14, 2025

Why make this change?

What is this change?

This PR enhances the OTEL instrumentation for the REST APIs by adding custom traces and metrics.

I have removed ASP NET Core standard instrumentation since it does not provide great value given the custom nature of the webservice. I have written two main Helper classes: TelemetryMetricsHelper and TelemetryTracesHelper to provide a single point of management for custom traces and metrics.

Metrics can be filtered for status_code, api_type, endpoint and method.

I have also fixed the loggings which are now sent to the configured OTEL endpoint.

Logs

image

Metrics

Screenshot 2025-03-14 190730

Traces

image (2)
image (3)
image (4)

How was this tested?

  • Integration Tests
  • Unit Tests

Sample Request(s)

To test everything locally I recommend using this repo that allows to run the local build of the dab cli and send metrics to the .NET Aspire OTEL endoint.

@JerryNixon
Copy link
Contributor

@Aniruddh25 is March realistic?

@tommasodotNET
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 2617 in repo Azure/data-api-builder

@sezal98
Copy link
Contributor

sezal98 commented Mar 27, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@sezal98
Copy link
Contributor

sezal98 commented Apr 1, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079
Copy link
Contributor

@tommasodotNET I made some changes to your PR, it was mostly changing methods to use more specific classes instead of string where I found it possible. I also fixed small formatting issues that were causing the unit tests to fail.

@RubenCerna2079
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079
Copy link
Contributor

@tommasodotNET I also found out a new issue with the tests related to a format issue in the dab-config.CosmosDb_NoSql.json, so I fixed it as it seems that was the only test failing.

@RubenCerna2079
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@tommasodotNET
Copy link
Contributor Author

Thanks @RubenCerna2079 for your support

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

LGTM, given all tests are passing. This has come a long way!

ship it!!

@RubenCerna2079
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@RubenCerna2079 RubenCerna2079 merged commit c9e732e into Azure:main Apr 23, 2025
11 checks passed
@Aniruddh25 Aniruddh25 added this to the 1.5 milestone May 11, 2025
RubenCerna2079 added a commit that referenced this pull request May 16, 2025
…#2617)

## Why make this change?

- Closes #2554
- Enhances OTEL instrumentation with custom traces and metrics for the
REST APIs

## What is this change?

This PR enhances the OTEL instrumentation for the REST APIs by adding
custom traces and metrics.

I have removed ASP NET Core standard instrumentation since it does not
provide great value given the custom nature of the webservice. I have
written two main Helper classes: `TelemetryMetricsHelper` and
`TelemetryTracesHelper` to provide a single point of management for
custom traces and metrics.

Metrics can be filtered for `status_code`, `api_type`, `endpoint` and
`method`.

I have also fixed the loggings which are now sent to the configured OTEL
endpoint.

### Logs

![image](https://github.com/user-attachments/assets/2b2b21ab-b16e-4678-8a3f-2c6bc3ab7168)

### Metrics
![Screenshot 2025-03-14
190730](https://github.com/user-attachments/assets/322f6111-8580-49c2-b6ff-5cddc191178c)

### Traces
![image
(2)](https://github.com/user-attachments/assets/1e9f320a-7445-44d6-a1c6-b0d5eb21fa8f)
![image
(3)](https://github.com/user-attachments/assets/efc754c1-a646-4500-9ebf-4f5cfba34b85)
![image
(4)](https://github.com/user-attachments/assets/cadc9665-934f-48bd-a1bc-afedbf5fe395)




## How was this tested?

- [ ] Integration Tests
- [ ] Unit Tests

## Sample Request(s)

To test everything locally I recommend using [this
repo](https://github.com/tommasodotNET/dab-workbench) that allows to run
the local build of the dab cli and send metrics to the .NET Aspire OTEL
endoint.

---------

Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: RubenCerna2079 <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
Co-authored-by: Ruben Cerna <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
RubenCerna2079 added a commit that referenced this pull request May 29, 2025
…#2617)

## Why make this change?

- Closes #2554
- Enhances OTEL instrumentation with custom traces and metrics for the
REST APIs

## What is this change?

This PR enhances the OTEL instrumentation for the REST APIs by adding
custom traces and metrics.

I have removed ASP NET Core standard instrumentation since it does not
provide great value given the custom nature of the webservice. I have
written two main Helper classes: `TelemetryMetricsHelper` and
`TelemetryTracesHelper` to provide a single point of management for
custom traces and metrics.

Metrics can be filtered for `status_code`, `api_type`, `endpoint` and
`method`.

I have also fixed the loggings which are now sent to the configured OTEL
endpoint.

### Logs

![image](https://github.com/user-attachments/assets/2b2b21ab-b16e-4678-8a3f-2c6bc3ab7168)

### Metrics
![Screenshot 2025-03-14
190730](https://github.com/user-attachments/assets/322f6111-8580-49c2-b6ff-5cddc191178c)

### Traces
![image
(2)](https://github.com/user-attachments/assets/1e9f320a-7445-44d6-a1c6-b0d5eb21fa8f)
![image
(3)](https://github.com/user-attachments/assets/efc754c1-a646-4500-9ebf-4f5cfba34b85)
![image
(4)](https://github.com/user-attachments/assets/cadc9665-934f-48bd-a1bc-afedbf5fe395)

## How was this tested?

- [ ] Integration Tests
- [ ] Unit Tests

## Sample Request(s)

To test everything locally I recommend using [this
repo](https://github.com/tommasodotNET/dab-workbench) that allows to run
the local build of the dab cli and send metrics to the .NET Aspire OTEL
endoint.

---------

Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: RubenCerna2079 <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
Co-authored-by: Ruben Cerna <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
aaronburtle added a commit that referenced this pull request May 29, 2025
## Why make this change?

This change is made in order to add all of the commits for milestone 1.5
into its respective branch.

## What is this change?

This change cherry-picks all of the commits that were added after the
first release candidate.
Cherry-picked commits:
 - #2648 
#2657
#2617 
#2659 
#2655 
#2633 
#2667 
#2673 
#2650 
#2695 
#2702 
#2688

## How was this tested?

- [ ] Integration Tests
- [ ] Unit Tests

## Sample Request(s)

---------

Co-authored-by: Sezal Chug <[email protected]>
Co-authored-by: sezalchug <[email protected]>
Co-authored-by: Tommaso Stocchi <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
Co-authored-by: Jerry Nixon <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Michael Staib <[email protected]>
Co-authored-by: souvikghosh04 <[email protected]>
Co-authored-by: Souvik Ghosh <[email protected]>
RubenCerna2079 added a commit that referenced this pull request May 29, 2025
…#2617)

- Closes #2554
- Enhances OTEL instrumentation with custom traces and metrics for the
REST APIs

This PR enhances the OTEL instrumentation for the REST APIs by adding
custom traces and metrics.

I have removed ASP NET Core standard instrumentation since it does not
provide great value given the custom nature of the webservice. I have
written two main Helper classes: `TelemetryMetricsHelper` and
`TelemetryTracesHelper` to provide a single point of management for
custom traces and metrics.

Metrics can be filtered for `status_code`, `api_type`, `endpoint` and
`method`.

I have also fixed the loggings which are now sent to the configured OTEL
endpoint.

![image](https://github.com/user-attachments/assets/2b2b21ab-b16e-4678-8a3f-2c6bc3ab7168)

![Screenshot 2025-03-14
190730](https://github.com/user-attachments/assets/322f6111-8580-49c2-b6ff-5cddc191178c)

![image
(2)](https://github.com/user-attachments/assets/1e9f320a-7445-44d6-a1c6-b0d5eb21fa8f)
![image
(3)](https://github.com/user-attachments/assets/efc754c1-a646-4500-9ebf-4f5cfba34b85)
![image
(4)](https://github.com/user-attachments/assets/cadc9665-934f-48bd-a1bc-afedbf5fe395)

- [ ] Integration Tests
- [ ] Unit Tests

To test everything locally I recommend using [this
repo](https://github.com/tommasodotNET/dab-workbench) that allows to run
the local build of the dab cli and send metrics to the .NET Aspire OTEL
endoint.

---------

Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: RubenCerna2079 <[email protected]>
Co-authored-by: aaronburtle <[email protected]>
Co-authored-by: Ruben Cerna <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
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.

🥕⭐ [Enhancement]: Custom DAB OTEL Traces & Counters

7 participants