Skip to content

Commit 1c73a97

Browse files
authored
Respect INSTANA_SERVICE_NAME consistently. (#116)
* Respect INSTANA_SERVICE_NAME consistently. * Service name is in snapshot
1 parent b5ed104 commit 1c73a97

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

instana/meter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ def handle_agent_tasks(self, task):
201201
def collect_snapshot(self):
202202
""" Collects snapshot related information to this process and environment """
203203
try:
204-
if "FLASK_APP" in os.environ:
204+
if "INSTANA_SERVICE_NAME" in os.environ:
205+
appname = os.environ["INSTANA_SERVICE_NAME"]
206+
elif "FLASK_APP" in os.environ:
205207
appname = os.environ["FLASK_APP"]
206208
elif "DJANGO_SETTINGS_MODULE" in os.environ:
207209
appname = os.environ["DJANGO_SETTINGS_MODULE"].split('.')[0]

instana/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class Options(object):
6-
service = ''
6+
service = None
77
service_name = None
88
agent_host = ''
99
agent_port = 0

instana/recorder.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ def build_sdk_span(self, span):
191191
custom=custom_data)
192192

193193
sdk_data.Type = self.get_span_kind(span)
194-
data = Data(service=self.get_service_name(span), sdk=sdk_data)
194+
data = Data(service=instana.singletons.agent.sensor.options.service_name,
195+
sdk=sdk_data)
195196
entity_from = {'e': instana.singletons.agent.from_.pid,
196197
'h': instana.singletons.agent.from_.agentUuid}
197198

@@ -225,9 +226,6 @@ def get_http_host_name(self, span):
225226

226227
return "localhost"
227228

228-
def get_service_name(self, span):
229-
return instana.singletons.agent.sensor.options.service_name
230-
231229
def get_span_kind(self, span):
232230
kind = ""
233231
if "span.kind" in span.tags:

0 commit comments

Comments
 (0)