Wed Oct 22 2025

Versioned API using OpenTelemetry

.Net
OpenTelemetry
Docker
Prometheus
Grafana
Swagger
Personal

This project is to explore a modern solution to the problem of how to know when you can retire old versions of an API. It uses a simple versioned API built with .Net, paired with OpenTelemetry to track usage of different API versions. Prometheus is used to scrape the metrics from the API, and Grafana is used to visualize the data. The entire solution is containerized using Docker for easy deployment. OpenTelemetry in .Net by default does not track which version of an API endpoint is being used, only which route is hit, so I have added custom metrics for this information. This allows us to see how many requests are being made to each version of the API over time, which can help inform decisions about when to retire old versions.

Objectives

  • 00
    Create a versioned API using URL-versioning strategy
  • 01
    Configure Swagger to show all versions of the API
  • 02
    Implement OpenTelemetry tracing and metrics for the API
  • 03
    Add custom metrics to track which version of API endpoints are being used
  • 04
    Set up Prometheus to scrape metrics from the API
  • 05
    Create Grafana dashboards to visualize the metrics collected by Prometheus
  • 06
    Containerize the API, Prometheus, and Grafana using Docker

Images

Swagger UI showing multiple API versions
Swagger UI showing multiple API versions
Grafana dashboard showing API metrics
Grafana dashboard showing API metrics
Architecture diagram showing components
Architecture diagram showing components