Skip to content

Commit

Permalink
Deprecate legacy EUM helpers (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
pglombardo authored Jun 30, 2020
1 parent a087af6 commit 5f661ff
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 177 deletions.
10 changes: 0 additions & 10 deletions instana/eum.js

This file was deleted.

12 changes: 0 additions & 12 deletions instana/eum_test.js

This file was deleted.

72 changes: 4 additions & 68 deletions instana/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

def eum_snippet(trace_id=None, eum_api_key=None, meta=None):
"""
Return an EUM snippet for use in views, templates and layouts that reports
client side metrics to Instana that will automagically be linked to the
current trace.
This method has been deprecated and will be removed in a future version.
@param trace_id [optional] the trace ID to insert into the EUM string
@param eum_api_key [optional] the EUM API key from your Instana dashboard
Expand All @@ -25,44 +23,12 @@ def eum_snippet(trace_id=None, eum_api_key=None, meta=None):
@return string
"""
try:
eum_file = open(os.path.dirname(__file__) + '/eum.js')
eum_src = Template(eum_file.read())

# Prepare the standard required IDs
ids = dict()
ids['meta_kvs'] = ''

parent_span = tracer.active_span

if trace_id or parent_span:
ids['trace_id'] = trace_id or parent_span.trace_id
else:
# No trace_id passed in and tracer doesn't show an active span so
# return nothing, nada & zip.
return ''

if eum_api_key:
ids['eum_api_key'] = eum_api_key
else:
ids['eum_api_key'] = global_eum_api_key

# Process passed in EUM 'meta' key/values
if meta is not None:
for key, value in meta.items():
ids['meta_kvs'] += ("'ineum('meta', '%s', '%s');'" % (key, value))

return eum_src.substitute(ids)
except Exception:
logger.debug("eum_snippet: ", exc_info=True)
return ''
return ''


def eum_test_snippet(trace_id=None, eum_api_key=None, meta=None):
"""
Return an EUM snippet for use in views, templates and layouts that reports
client side metrics to Instana that will automagically be linked to the
current trace.
This method has been deprecated and will be removed in a future version.
@param trace_id [optional] the trace ID to insert into the EUM string
@param eum_api_key [optional] the EUM API key from your Instana dashboard
Expand All @@ -71,34 +37,4 @@ def eum_test_snippet(trace_id=None, eum_api_key=None, meta=None):
@return string
"""

try:
eum_file = open(os.path.dirname(__file__) + '/eum_test.js')
eum_src = Template(eum_file.read())

# Prepare the standard required IDs
ids = {}
ids['meta_kvs'] = ''

parent_span = tracer.active_span
if trace_id or parent_span:
ids['trace_id'] = trace_id or parent_span.trace_id
else:
# No trace_id passed in and tracer doesn't show an active span so
# return nothing, nada & zip.
return ''

if eum_api_key:
ids['eum_api_key'] = eum_api_key
else:
ids['eum_api_key'] = global_eum_api_key

# Process passed in EUM 'meta' key/values
if meta is not None:
for key, value in meta.items():
ids['meta_kvs'] += ("'ineum('meta', '%s', '%s');'" % (key, value))

return eum_src.substitute(ids)
except Exception:
logger.debug("eum_snippet: ", exc_info=True)
return ''
return ''
87 changes: 0 additions & 87 deletions tests/test_helpers.py

This file was deleted.

0 comments on commit 5f661ff

Please sign in to comment.