Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions st2common/st2common/middleware/instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def __call__(self, environ, start_response):
# other endpoints because this would result in a lot of unique metrics which is an
# anti-pattern and causes unnecessary load on the metrics server.
submit_metrics = endpoint.get('x-submit-metrics', True)
operation_id = endpoint.get('operationId', None)
is_get_one_endpoint = bool(operation_id) and (operation_id.endswith('.get') or
operation_id.endswith('.get_one'))

if is_get_one_endpoint:
# NOTE: We don't submit metrics for any get one API endpoint since this would result
# in potentially too many unique metrics
submit_metrics = False

if not submit_metrics:
LOG.debug('Not submitting request metrics for path: %s' % (request.path))
return self.app(environ, start_response)
Expand Down
5 changes: 4 additions & 1 deletion st2common/st2common/util/sandboxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ def get_sandbox_python_path(inherit_from_parent=True, inherit_parent_virtualenv=
if inherit_parent_virtualenv and hasattr(sys, 'real_prefix'):
# We are running inside virtualenv
site_packages_dir = get_python_lib()
assert sys.prefix in site_packages_dir

sys_prefix = os.path.abspath(sys.prefix)
assert sys_prefix in site_packages_dir

sandbox_python_path.append(site_packages_dir)

sandbox_python_path = ':'.join(sandbox_python_path)
Expand Down