Skip to content

Commit

Permalink
Introduced service time metrics to OpenSearch-Py client.
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi committed Mar 6, 2024
1 parent 0709099 commit b979922
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions opensearchpy/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
class TimeMetrics:
def __init__(self) -> None:
self.events = Events()
self.start_time = time.perf_counter()
self.end_time = time.perf_counter()
self.service_time = 0
current_time = time.perf_counter()
self.start_time = current_time
self.end_time = current_time
self.service_time = 0.0

# Subscribe to the server_request_start and server_request_end events
self.events.server_request_start += self.server_request_start
Expand Down

0 comments on commit b979922

Please sign in to comment.