Skip to content

Commit

Permalink
Merge pull request #733 from opensafely-core/status-code-telemetry
Browse files Browse the repository at this point in the history
Capture status_code_update_at timestamp.
  • Loading branch information
bloodearnest authored May 22, 2024
2 parents 9a18f01 + 133d6c0 commit a8107d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jobrunner/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ def trace_attributes(job, results=None):
# convert float seconds to ns integer
created_at=int(job.created_at * 1e9),
started_at=int(job.started_at * 1e9) if job.started_at else None,
# when did the state last change?
status_code_updated_at=job.status_code_updated_at,
requires_db=job.requires_db,
)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_trace_attributes(db):
message="message",
created_at=int(job.created_at * 1e9),
started_at=None,
status_code_updated_at=job.status_code_updated_at,
reusable_action="action_repo:commit",
requires_db=False,
outputs=2,
Expand Down Expand Up @@ -156,6 +157,7 @@ def test_trace_attributes_missing(db):
message="message",
created_at=int(job.created_at * 1e9),
started_at=None,
status_code_updated_at=job.status_code_updated_at,
requires_db=False,
)

Expand Down

0 comments on commit a8107d9

Please sign in to comment.