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
27 changes: 27 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build
on:
push:
branches:
- master # or the name of your main branch
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# We do not recommend to use this in a pull request. Prefer using pull request
# decoration instead.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion instana/instrumentation/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def process_response(self, request, response):
if request.iscope is not None:
request.iscope.close()
request.iscope = None
return response
return response

def process_exception(self, request, exception):
from django.http.response import Http404
Expand Down
4 changes: 2 additions & 2 deletions instana/instrumentation/flask/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ def handle_user_exception_with_instana(wrapped, instance, argv, kwargs):
flask.g.scope = None
except:
logger.debug("handle_user_exception_with_instana:", exc_info=True)
finally:
return response

return response
6 changes: 3 additions & 3 deletions instana/instrumentation/flask/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def before_request_with_instana(*argv, **kwargs):
span.set_tag("http.path_tpl", path_tpl)
except:
logger.debug("Flask before_request", exc_info=True)
finally:
return None

return None


def after_request_with_instana(response):
Expand All @@ -78,7 +78,7 @@ def after_request_with_instana(response):
if scope is not None:
scope.close()
flask.g.scope = None
return response
return response


def teardown_request_with_instana(*argv, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions instana/instrumentation/grpcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def collect_tags(span, instance, argv, kwargs):
span.set_tag('rpc.port', parts[1])
except:
logger.debug("grpc.collect_tags non-fatal error", exc_info=True)
finally:
return span
return span


@wrapt.patch_function_wrapper('grpc._channel', '_UnaryUnaryMultiCallable.with_call')
Expand Down
4 changes: 2 additions & 2 deletions instana/instrumentation/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def log_with_instana(wrapped, instance, argv, kwargs):
scope.span.mark_as_errored()
except Exception:
logger.debug('log_with_instana:', exc_info=True)
finally:
return wrapped(*argv, **kwargs)

return wrapped(*argv, **kwargs)


logger.debug('Instrumenting logging')
Expand Down
3 changes: 1 addition & 2 deletions instana/instrumentation/pep0249.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def _collect_kvs(self, span, sql):
span.set_tag('port', self._connect_params[1]['port'])
except Exception as e:
logger.debug(e)
finally:
return span
return span

def execute(self, sql, params=None):
active_tracer = get_active_tracer()
Expand Down
4 changes: 2 additions & 2 deletions instana/instrumentation/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def collect_tags(span, instance, args, kwargs):

except:
logger.debug("redis.collect_tags non-fatal error", exc_info=True)
finally:
return span

return span


def execute_command_with_instana(wrapped, instance, args, kwargs):
Expand Down
3 changes: 1 addition & 2 deletions instana/instrumentation/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def receive_before_cursor_execute(**kw):
scope.span.set_tag('sqlalchemy.url', url_regexp.sub('//', url))
except Exception as e:
logger.debug(e)
finally:
return
return


@event.listens_for(Engine, 'after_cursor_execute', named=True)
Expand Down
3 changes: 2 additions & 1 deletion instana/util/traceutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ def get_active_tracer():
else:
return None
except Exception:
logger.debug("error while getting active tracer: ", exc_info=True)
# Do not try to log this with instana, as there is no active tracer and there will be an infinite loop at least
# for PY2
return None
7 changes: 7 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonar.projectKey=Python-Tracer
sonar.projectName=Python Tracer
sonar.sourceEncoding=utf-8
sonar.sources=.
sonar.exclusions=tests/**/*, example/**/*
sonar.tests=.
sonar.test.inclusions=tests/**/*