Skip to content

Add instrumentation for various basic metrics#1837

Merged
shangyian merged 1 commit intoDataJunction:mainfrom
shangyian:metrics-instrumentation
Mar 7, 2026
Merged

Add instrumentation for various basic metrics#1837
shangyian merged 1 commit intoDataJunction:mainfrom
shangyian:metrics-instrumentation

Conversation

@shangyian
Copy link
Copy Markdown
Collaborator

@shangyian shangyian commented Mar 7, 2026

Summary

HTTP / Request Layer

In: datajunction_server/instrumentation/middleware.py

Metric Type Tags Description
dj.request timer (ms) route, method, status_code End-to-end latency for every HTTP request
dj.request.in_flight gauge Concurrent requests in progress (per instance)
dj.db.pool.size gauge Configured max pool size
dj.db.pool.checked_out gauge Active DB connections
dj.db.pool.available gauge Idle connections (size - checked_out)
dj.db.pool.overflow gauge Connections above pool size limit

Database Layer

Source: datajunction_server/utils.py

Metric Type Tags Description
dj.db.query_count timer (count) session_label Number of DB queries issued per session/request

Query Cache

In: datajunction_server/internal/caching/query_cache_manager.py

Metric Type Tags Description
dj.cache.hit counter query_type Cache hit on SQL build cache
dj.cache.miss counter query_type Cache miss — fresh SQL build triggered
dj.cache.refresh.pending gauge Background refresh jobs currently queued
dj.sql.build_latency_ms timer (ms) query_type Time to build SQL from scratch (cache miss path)
dj.cache.key_build_ms timer (ms) query_type Time to compute the versioned cache key
dj.cache.refresh_latency_ms timer (ms) query_type Time for a background refresh-ahead rebuild

DAG Traversal

In: datajunction_server/sql/dag.py

Metric Type Tags Description
dj.dag.traversal_ms timer (ms) operation Latency of DAG traversal functions

operation values: get_downstream_nodes, get_upstream_nodes, get_dimensions_dag

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 7, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit 7bf1bea
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/69ab6aa63281c000081c02dd

@shangyian shangyian marked this pull request as ready for review March 7, 2026 00:52
@shangyian shangyian merged commit f9a8d4f into DataJunction:main Mar 7, 2026
17 checks passed
@shangyian shangyian deleted the metrics-instrumentation branch March 7, 2026 00:52
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.

1 participant