diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-01-25 21:05:33 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-01-25 21:06:01 +0100 |
| commit | f9b7af64550be1320acc84d60184e8c8ce873b94 (patch) | |
| tree | d43e995319b4a3856aa929848b9ad807afb1cf86 /src/Enmarcha.Backend/Controllers/TileController.cs | |
| parent | c89353dede64bd2c21c0a1ebd6b6de6282998326 (diff) | |
feat: Add OpenTelemetry instrumentation and configuration for enhanced telemetry tracking
Diffstat (limited to 'src/Enmarcha.Backend/Controllers/TileController.cs')
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/TileController.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Enmarcha.Backend/Controllers/TileController.cs b/src/Enmarcha.Backend/Controllers/TileController.cs index 4065ecd..3fdedfb 100644 --- a/src/Enmarcha.Backend/Controllers/TileController.cs +++ b/src/Enmarcha.Backend/Controllers/TileController.cs @@ -43,12 +43,19 @@ public class TileController : ControllerBase [HttpGet("stops/{z:int}/{x:int}/{y:int}")] public async Task<IActionResult> Stops(int z, int x, int y) { + using var activity = Telemetry.Source.StartActivity("GenerateStopsTile"); + activity?.SetTag("tile.z", z); + activity?.SetTag("tile.x", x); + activity?.SetTag("tile.y", y); + if (z is < 9 or > 20) { return BadRequest("Zoom level out of range (9-20)"); } var cacheHit = _cache.TryGetValue($"stops-tile-{z}-{x}-{y}", out byte[]? cachedTile); + activity?.SetTag("cache.hit", cacheHit); + if (cacheHit && cachedTile != null) { Response.Headers.Append("X-Cache-Hit", "true"); @@ -78,6 +85,7 @@ public class TileController : ControllerBase if (responseBody is not { IsSuccess: true }) { + activity?.SetStatus(System.Diagnostics.ActivityStatusCode.Error, "Error fetching stop data from OTP"); _logger.LogError( "Error fetching stop data, received {StatusCode} {ResponseBody}", response.StatusCode, |
