Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #45 from signalfx/version-tags-on-local-root
Browse files Browse the repository at this point in the history
Record signalfx version and library tags on local root spans
  • Loading branch information
owais committed Sep 10, 2020
2 parents 9b00c5c + 0bbb6ad commit f55dba7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def build(session):
return

cwd = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(cwd, 'signalfx_tracing/__init__.py')) as init_file:
with open(os.path.join(cwd, 'signalfx_tracing/version.py')) as init_file:
match = re.search("__version__ = ['\"]([^'\"]*)['\"]", init_file.read())
if not match:
raise RuntimeError('Not able to determine current version')
Expand Down
2 changes: 1 addition & 1 deletion requirements-inst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ git+https://github.com/signalfx/python-pymongo.git@v0.0.3post1#egg=pymongo-opent
git+https://github.com/signalfx/python-redis.git@v1.0.0post1#egg=redis-opentracing
git+https://github.com/signalfx/python-requests.git@v0.2.0post1#egg=requests-opentracing
git+https://github.com/signalfx/python-tornado.git@1.0.1post1#egg=tornado_opentracing
sfx-jaeger-client>=3.13.1b0.dev2
sfx-jaeger-client>=3.13.1b0.dev3
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ redis
requests
six
tornado
sfx-jaeger-client>=3.13.1b0.dev2
sfx-jaeger-client>=3.13.1b0.dev3
2 changes: 1 addition & 1 deletion scripts/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def is_installed(library):
return library in sys.modules or pkgutil.find_loader(library) is not None


jaeger_client = 'sfx-jaeger-client>=3.13.1b0.dev2'
jaeger_client = 'sfx-jaeger-client>=3.13.1b0.dev3'


# target library to desired instrumentor path/versioned package name
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def map(self, use_pep508=False):
long_description = readme_file.read()

version = None
with open(os.path.join(cwd, 'signalfx_tracing/__init__.py')) as init_file:
with open(os.path.join(cwd, 'signalfx_tracing/version.py')) as init_file:
match = re.search("__version__ = ['\"]([^'\"]*)['\"]", init_file.read())
if not match:
raise RuntimeError('Not able to determine current version in signalfx_tracing/__init__.py')
raise RuntimeError('Not able to determine current version in signalfx_tracing/version.py')
version = match.group(1)


Expand Down
3 changes: 1 addition & 2 deletions signalfx_tracing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from . import patch_span # noqa
from .instrumentation import instrument, uninstrument, auto_instrument # noqa
from .utils import create_tracer, trace # noqa

__version__ = '1.1.0'
from .version import __version__ # noqa

# Django
default_app_config = 'signalfx_tracing.libraries.django_.apps.SignalFxConfig' # noqa
6 changes: 6 additions & 0 deletions signalfx_tracing/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
# A stack trace in platform-conventional format; may or may not pertain to
# an error.
ERROR_STACK = 'sfx.error.stack'

# SFX_TRACING_VERSION specifies the SignalFx tracing library that generated the span.
SFX_TRACING_VERSION = 'signalfx.tracing.version'

# SFX_TRACING_LIBRARY specifies the SignalFx tracing library version.
SFX_TRACING_LIBRARY = 'signalfx.tracing.library'
7 changes: 7 additions & 0 deletions signalfx_tracing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import opentracing

from .constants import instrumented_attr
from .tags import SFX_TRACING_LIBRARY, SFX_TRACING_VERSION
from .version import __version__


# Accepted case-insensitive disabling environment variable values
Expand Down Expand Up @@ -129,6 +131,11 @@ def create_tracer(access_token=None, set_global=True, config=None, *args, **kwar
propagation = _get_env_var('SIGNALFX_PROPAGATION', 'b3')
config['propagation'] = propagation

config['root_span_tags'] = {
SFX_TRACING_LIBRARY: 'python-tracing',
SFX_TRACING_VERSION: __version__
}

jaeger_config = Config(config, *args, **kwargs)

tracer = jaeger_config.new_tracer()
Expand Down
3 changes: 3 additions & 0 deletions signalfx_tracing/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (C) 2018-2020 SignalFx. All rights reserved.

__version__ = '1.2.0'

0 comments on commit f55dba7

Please sign in to comment.