File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050logging .info ('About to instrument app for OTEL' )
5151# set the service name for our trace provider
5252# this will tag every trace with the service name given
53+ otel_service_name = app .config .get ('OTEL_SERVICE_NAME' , 'COHD' )
5354tp = TracerProvider (
54- resource = Resource .create ({telemetery_service_name_key : 'COHD' })
55+ resource = Resource .create ({telemetery_service_name_key : otel_service_name })
5556 )
5657# create an exporter to jaeger
57- jaeger_host = 'jaeger'
58+ jaeger_host = app .config .get ('JAEGER_HOST' , 'jaeger-otel-agent.sri' )
59+ jaeger_port = app .config .get ('JAEGER_PORT' , 6831 )
5860deployment_env = app .config .get ('DEPLOYMENT_ENV' , 'dev' )
59- if deployment_env [:4 ] == 'ITRB' :
60- jaeger_host = 'jaeger-otel-agent.sri'
6161jaeger_exporter = JaegerExporter (
6262 agent_host_name = jaeger_host ,
63- agent_port = 6831 ,
63+ agent_port = jaeger_port ,
6464 )
6565# here we use the exporter to export each span in a trace
6666tp .add_span_processor (
Original file line number Diff line number Diff line change @@ -7,5 +7,10 @@ CACHE_THRESHOLD = 100000
77DEV_KEY = 'CHANGE_ME'
88DATABASES = ['cohd']
99
10+ # OpenTelemetry Settings
11+ OTEL_SERVICE_NAME = 'COHD'
12+ JAEGER_HOST = 'jaeger-otel-agent.sri'
13+ JAEGER_PORT = 6831
14+
1015# Google Analytics: uncomment and set tracking ID to use Google Analytics
1116# GA_TID = 'UA-XXXXX-Y'
You can’t perform that action at this time.
0 commit comments