Skip to content

Commit f86f18f

Browse files
authored
Merge pull request #41 from instana/autoinstrumentation-hooks
Auto-instrumentation support
2 parents 6fa7774 + c436911 commit f86f18f

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

gdbinit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
call PyGILState_Ensure()
2+
call PyRun_SimpleString("import sys; sys.path.insert(0, '/tmp/instana/python');")
3+
call PyRun_SimpleString("exec(open(\"/tmp/instana/python/python-sensor/instana/probe.py\").read())")
4+
call PyGILState_Release($1)

instana/fsm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def lookup_agent_host(self, e):
8686
self.fsm.announce()
8787
return True
8888

89-
log.warn("Instana Host Agent can't be found. Scheduling retry.")
89+
log.info("Instana Host Agent couldn't be found. Scheduling retry.")
9090
self.schedule_retry(self.lookup_agent_host, e, "agent_lookup")
9191
return False
9292

@@ -144,11 +144,11 @@ def announce_sensor(self, e):
144144
if b:
145145
self.agent.set_from(b)
146146
self.fsm.ready()
147-
log.warn("Host agent available. We're in business. Announced pid: %i (true pid: %i)" %
147+
log.info("Host agent available. We're in business. Announced pid: %i (true pid: %i)" %
148148
(pid, self.agent.from_.pid))
149149
return True
150150
else:
151-
log.warn("Cannot announce sensor. Scheduling retry.")
151+
log.debug("Cannot announce sensor. Scheduling retry.")
152152
self.schedule_retry(self.announce_sensor, e, "announce")
153153
return False
154154

instana/probe.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import opentracing as ot
2+
from instana import tracer, options
3+
4+
# This file is the hook for autoinstrumenation.
5+
# Here, we should:
6+
# 1. Make sure instana sensor is not already active in the process
7+
# 2. Activate properly
8+
# a. Runtime metrics
9+
# b. Detect and instrument framework
10+
# c. Detect and instrument any libraries
11+
12+
opts = options.Options()
13+
ot.global_tracer = tracer.InstanaTracer(opts)

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@
2323
test_suite='nose.collector',
2424
keywords=['performance', 'opentracing', 'metrics', 'monitoring'],
2525
classifiers=[
26-
'Development Status :: 4 - Beta',
26+
'Development Status :: 5 - Production/Stable',
27+
'Framework :: Django',
28+
'Framework :: Flask',
2729
'Intended Audience :: Developers',
2830
'Intended Audience :: Information Technology',
31+
'Intended Audience :: Science/Research',
32+
'Intended Audience :: System Administrators',
2933
'License :: OSI Approved :: MIT License',
3034
'Operating System :: OS Independent',
3135
'Programming Language :: Python',
@@ -34,6 +38,7 @@
3438
'Programming Language :: Python :: 3.4',
3539
'Programming Language :: Python :: 3.5',
3640
'Programming Language :: Python :: 3.6',
41+
'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware',
3742
'Topic :: System :: Monitoring',
3843
'Topic :: System :: Networking :: Monitoring',
3944
'Topic :: Software Development :: Libraries :: Python Modules'])

0 commit comments

Comments
 (0)