Skip to content

Commit

Permalink
NR added on realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
azime committed Sep 7, 2023
1 parent 0546684 commit 1577449
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import pybreaker
import pytz
import requests as requests
from jormungandr import cache, app
from jormungandr import cache, app, new_relic
from jormungandr.schedule import RealTimePassage
from jormungandr.utils import PY3
from datetime import datetime
Expand Down Expand Up @@ -99,6 +99,7 @@ def __repr__(self):
except:
return self.rt_system_id

@new_relic.distributedEvent("call_cleverage", "cleverage")
@cache.memoize(app.config['CACHE_CONFIGURATION'].get('TIMEOUT_CLEVERAGE', 30))
def _call_cleverage(self, url):
"""
Expand Down
3 changes: 2 additions & 1 deletion source/jormungandr/jormungandr/realtime_schedule/siri.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import logging
import pybreaker
import requests as requests
from jormungandr import cache, app
from jormungandr import cache, app, new_relic
from jormungandr.realtime_schedule.realtime_proxy import RealtimeProxy, RealtimeProxyError, floor_datetime
from jormungandr.utils import PY3
from jormungandr.schedule import RealTimePassage
Expand Down Expand Up @@ -261,6 +261,7 @@ def _get_passages(self, tree, ns, route_point):

return next_passages

@new_relic.distributedEvent("call_siri", "siri")
@cache.memoize(app.config.get(str('CACHE_CONFIGURATION'), {}).get(str('TIMEOUT_SIRI'), 60))
def _call_siri(self, request):
encoded_request = request.encode('utf-8', 'backslashreplace')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import pybreaker
import pytz
import requests as requests
from jormungandr import cache, app
from jormungandr import cache, app, new_relic
from jormungandr.schedule import RealTimePassage
from datetime import datetime
import six
Expand Down Expand Up @@ -74,6 +74,7 @@ def __repr__(self):
except:
return self.rt_system_id

@new_relic.distributedEvent("call_sirilite", "sirilite")
@cache.memoize(app.config['CACHE_CONFIGURATION'].get('TIMEOUT_SIRILITE', 30))
def _call(self, url):
self.log.debug('sirilite RT service, call url: {}'.format(url))
Expand Down
3 changes: 2 additions & 1 deletion source/jormungandr/jormungandr/realtime_schedule/synthese.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import logging
import pybreaker
import requests as requests
from jormungandr import cache, app
from jormungandr import cache, app, new_relic
from datetime import datetime
from navitiacommon.ratelimit import RateLimiter, FakeRateLimiter
from navitiacommon import type_pb2
Expand Down Expand Up @@ -141,6 +141,7 @@ def __repr__(self):
except:
return self.rt_system_id

@new_relic.distributedEvent("call_synthese", "synthese")
@cache.memoize(app.config.get(str('CACHE_CONFIGURATION'), {}).get(str('TIMEOUT_SYNTHESE'), 30))
def _call_synthese(self, url):
"""
Expand Down
2 changes: 2 additions & 0 deletions source/jormungandr/jormungandr/realtime_schedule/sytral.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from jormungandr.schedule import RealTimePassage
import aniso8601
import six
from jormungandr import new_relic


class Sytral(RealtimeProxy):
Expand Down Expand Up @@ -111,6 +112,7 @@ def _make_params(self, route_point):
def _is_valid_direction(self, direction_uri, passage_direction_uri):
return direction_uri == passage_direction_uri

@new_relic.distributedEvent("call_sytral", "sytral")
@cache.memoize(app.config['CACHE_CONFIGURATION'].get('TIMEOUT_SYTRAL', 30))
def _call(self, params):
"""
Expand Down
2 changes: 2 additions & 0 deletions source/jormungandr/jormungandr/realtime_schedule/timeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from navitiacommon.ratelimit import RateLimiter, FakeRateLimiter
from jormungandr.utils import PY3
import six
from jormungandr import new_relic


def _to_duration(hour_str):
Expand Down Expand Up @@ -133,6 +134,7 @@ def __repr__(self):
def _is_valid_direction(self, direction_uri, passage_direction_uri):
return direction_uri == passage_direction_uri

@new_relic.distributedEvent("call_timeo", "timeo")
@cache.memoize(app.config.get(str('CACHE_CONFIGURATION'), {}).get(str('TIMEOUT_TIMEO'), 60))
def _call_timeo(self, url):
"""
Expand Down

0 comments on commit 1577449

Please sign in to comment.