Skip to content

feat(api): add monitoring feature with track_events use case#539

Merged
eoaksnes merged 1 commit into
mainfrom
stack/02-api
May 19, 2026
Merged

feat(api): add monitoring feature with track_events use case#539
eoaksnes merged 1 commit into
mainfrom
stack/02-api

Conversation

@eoaksnes
Copy link
Copy Markdown
Collaborator

@eoaksnes eoaksnes commented May 9, 2026

Stack 2/4 — base: `stack/01-infra` (#538)

Adds an API-side monitoring feature for application telemetry.

Stack

  1. chore(infra): IaC, compose, redis, oauth2-proxy baseline #538 stack/01-infra
  2. stack/02-api ← you are here
  3. stack/03-web (base: stack/02-api)
  4. stack/04-docs (base: stack/03-web)

This pull request introduces a new monitoring/telemetry endpoint, upgrades Azure and OpenTelemetry dependencies, and improves authentication and observability integration. It also includes minor improvements and maintenance updates.

Key changes:

Monitoring and Telemetry

  • Added a new /monitoring/v2/track POST endpoint to the OpenAPI spec for tracking telemetry events, including comprehensive request/response schemas and error handling.
  • Introduced telemetry-related schemas: Event, EventBase, EventData, ExceptionData, MetricsData, TelemetryErrorDetails, and TelemetryResult to support the new monitoring endpoint. [1] [2]
  • Registered the new monitoring router in the FastAPI application to enable the endpoint. [1] [2]

Observability and Dependency Upgrades

  • Upgraded Azure and OpenTelemetry dependencies for better compatibility and features, including switching to azure-identity and newer versions of azure-monitor-opentelemetry and related exporters. [1] [2]
  • Improved Azure Monitor integration: now uses a ClientSecretCredential when service principal credentials are available, allowing ingestion even when local authentication is disabled. Falls back to connection-string auth otherwise.

Authentication Improvements

  • Enhanced JWT authentication to extract and populate user details (user_id, full_name, email, roles) from the token payload, improving downstream user context. [1] [2]

API and Schema Consistency

  • Added user_id as a required field in multiple todo response schemas for consistency and traceability. [1] [2] [3] [4]

Developer Experience and Maintenance

  • Ensured the Equinor root CA bundle is installed in the Docker image for secure requests behind corporate proxies (e.g., Zscaler), improving developer experience and CI reliability. [1] [2]
  • Updated type imports for secrets handling in configuration.

These changes collectively improve the API's observability, security, and maintainability while adding support for advanced telemetry use cases.

@eoaksnes eoaksnes requested a review from a team as a code owner May 9, 2026 11:52
@eoaksnes eoaksnes marked this pull request as draft May 9, 2026 13:39
@eoaksnes eoaksnes force-pushed the stack/01-infra branch 14 times, most recently from 980b864 to 07aef72 Compare May 10, 2026 17:42
@eoaksnes eoaksnes marked this pull request as ready for review May 11, 2026 06:54
@eoaksnes eoaksnes force-pushed the stack/01-infra branch 2 times, most recently from 59eef3a to 4561886 Compare May 13, 2026 18:47
Base automatically changed from stack/01-infra to main May 13, 2026 19:18
@eoaksnes eoaksnes force-pushed the stack/02-api branch 3 times, most recently from 519be8c to ac3beba Compare May 13, 2026 19:34
Comment thread api/src/app/features/monitoring/use_cases/track_events/__init__.py Outdated
Comment thread api/src/app/features/monitoring/use_cases/track_events/__init__.py
Comment thread api/src/app/features/monitoring/use_cases/track_events/__init__.py Outdated
Comment thread api/src/app/features/monitoring/use_cases/track_events/__init__.py Outdated
Comment thread api/src/app/app.py Outdated
Comment thread api/src/app/config.py
Comment thread api/src/app/config.py Outdated
Comment thread api/pyproject.toml Outdated
@eoaksnes eoaksnes force-pushed the stack/02-api branch 3 times, most recently from 5d9ca42 to 1f00490 Compare May 19, 2026 19:11
@eoaksnes eoaksnes merged commit 9f7f46a into main May 19, 2026
10 checks passed
@eoaksnes eoaksnes deleted the stack/02-api branch May 19, 2026 19:26
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.

2 participants