Skip to content

Commit

Permalink
Merge branch 'main' into support/3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Feb 7, 2025
2 parents f907773 + 4060ade commit 91a92b4
Showing 1 changed file with 31 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def _store_stats(suffix:'str') -> 'None':
except Exception:
pass

stats_enabled = is_boolean(os.environ.get('Zato_Stats_Enabled', False))

stats_ignore = {
'demo.my-service',
'pub.zato.ping',
Expand Down Expand Up @@ -690,35 +692,36 @@ def handle(self):
transport = self.request.input.get('transport')
expiration = self.request.input.get('expiration') or BROKER.DEFAULT_EXPIRATION

# For statistics
suffix = name.replace('zato.', '', 1)

# Extract the details, if required.
if name not in stats_ignore:
if 'zato' in name:
if name == 'zato.generic.connection.get-list':
conn_type = 'init'
try:
conn_type = payload.get('type_', 'notype') # type: ignore
except Exception:
conn_type = 'noget'
finally:
suffix += f'/{conn_type}'

elif name == 'zato.http-soap.get-list':
connection = 'init'
transport = 'init'
try:
connection = payload.get('connection', 'noconn') # type: ignore
transport = payload.get('transport', 'notransport') # type: ignore
except Exception:
connection = 'noget'
transport = 'noget'
finally:
suffix += f'/{connection}/{transport}'

# Store statistics
_ = spawn(_store_stats, suffix)
if stats_enabled:

suffix = name.replace('zato.', '', 1)

if name not in stats_ignore:
if 'zato' in name:
if name == 'zato.generic.connection.get-list':
conn_type = 'init'
try:
conn_type = payload.get('type_', 'notype') # type: ignore
except Exception:
conn_type = 'noget'
finally:
suffix += f'/{conn_type}'

elif name == 'zato.http-soap.get-list':
connection = 'init'
transport = 'init'
try:
connection = payload.get('connection', 'noconn') # type: ignore
transport = payload.get('transport', 'notransport') # type: ignore
except Exception:
connection = 'noget'
transport = 'noget'
finally:
suffix += f'/{connection}/{transport}'

# Store statistics
_ = spawn(_store_stats, suffix)

if name and id:
raise ZatoException('Cannot accept both id:`{}` and name:`{}`'.format(id, name))
Expand Down

0 comments on commit 91a92b4

Please sign in to comment.