Programmatically include the tracing for datadog
This commit is contained in:
parent
c7f718a7f1
commit
a426a799bd
4 changed files with 13 additions and 1 deletions
|
@ -50,4 +50,4 @@ COPY --from=builder /usr/local/lib/python3.7/ /usr/local/lib/python3.7/
|
|||
# Add the application
|
||||
COPY . .
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [ "ddtrace-run", "python", "email_server.py" ]
|
||||
ENTRYPOINT [ "python", "email_server.py" ]
|
||||
|
|
|
@ -25,6 +25,9 @@ logger = getJSONLogger('emailservice-client')
|
|||
from opencensus.trace.tracer import Tracer
|
||||
from opencensus.trace.exporters import stackdriver_exporter
|
||||
from opencensus.trace.ext.grpc import client_interceptor
|
||||
from ddtrace import patch_all
|
||||
patch_all()
|
||||
from ddtrace import tracer
|
||||
|
||||
try:
|
||||
exporter = stackdriver_exporter.StackdriverExporter()
|
||||
|
@ -33,6 +36,7 @@ try:
|
|||
except:
|
||||
tracer_interceptor = client_interceptor.OpenCensusClientInterceptor()
|
||||
|
||||
@tracer.wrap('send_confirmation_email', service='emailservice')
|
||||
def send_confirmation_email(email, order):
|
||||
channel = grpc.insecure_channel('0.0.0.0:8080')
|
||||
channel = grpc.intercept_channel(channel, tracer_interceptor)
|
||||
|
|
|
@ -38,6 +38,10 @@ from opencensus.trace.samplers import always_on
|
|||
# import googleclouddebugger
|
||||
import googlecloudprofiler
|
||||
|
||||
from ddtrace import patch_all
|
||||
patch_all()
|
||||
from ddtrace import tracer
|
||||
|
||||
from logger import getJSONLogger
|
||||
logger = getJSONLogger('emailservice-server')
|
||||
|
||||
|
@ -118,6 +122,7 @@ class HealthCheck():
|
|||
return health_pb2.HealthCheckResponse(
|
||||
status=health_pb2.HealthCheckResponse.SERVING)
|
||||
|
||||
@tracer.wrap('start', service='emailservice')
|
||||
def start(dummy_mode):
|
||||
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10),
|
||||
interceptors=(tracer_interceptor,))
|
||||
|
|
|
@ -38,6 +38,9 @@ from grpc_health.v1 import health_pb2_grpc
|
|||
from logger import getJSONLogger
|
||||
logger = getJSONLogger('recommendationservice-server')
|
||||
|
||||
from ddtrace import patch_all
|
||||
patch_all()
|
||||
|
||||
def initStackdriverProfiling():
|
||||
project_id = None
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue