Skip to content

Commit

Permalink
Merge pull request #2625 from DataDog/remh/mongo
Browse files Browse the repository at this point in the history
[mongo] Fix case where optimeDate is not available
  • Loading branch information
Remi Hakim authored Jul 20, 2016
2 parents c76ab39 + ea4ad98 commit 01b6704
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions checks.d/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,9 @@ def total_seconds(td):

# Compute a lag time
if current is not None and primary is not None:
lag = primary['optimeDate'] - current['optimeDate']
data['replicationLag'] = total_seconds(lag)
if 'optimeDate' in primary and 'optimeDate' in current:
lag = primary['optimeDate'] - current['optimeDate']
data['replicationLag'] = total_seconds(lag)

if current is not None:
data['health'] = current['health']
Expand Down

0 comments on commit 01b6704

Please sign in to comment.