Skip to content

Commit

Permalink
keep attempt end time instead of duration
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Nov 21, 2023
1 parent 6bc7ff4 commit a7e4874
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions google/cloud/bigtable/data/_metrics/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CompletedAttemptMetric:
"""

start_time: float
duration: float
end_time: float
end_status: StatusCode
first_response_latency: float | None = None
gfe_latency: float | None = None
Expand Down Expand Up @@ -209,7 +209,7 @@ def end_attempt_with_status(self, status: StatusCode | Exception) -> None:
new_attempt = CompletedAttemptMetric(
start_time=self.active_attempt.start_time,
first_response_latency=self.active_attempt.first_response_latency,
duration=time.monotonic() - self.active_attempt.start_time,
end_time=time.monotonic(),
end_status=self._exc_to_status(status)
if isinstance(status, Exception)
else status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def on_operation_complete(self, op: CompletedOperationMetric) -> None:
# - connectivity_error_count
labels["status"] = attempt.end_status.value

self.attempt_latency.record(attempt.duration, labels)
self.attempt_latency.record(attempt.end_time-attempt.start_time, labels)
if (
op.op_type == OperationType.READ_ROWS
and attempt.first_response_latency is not None
Expand Down

0 comments on commit a7e4874

Please sign in to comment.