Slackbot
12/15/2022, 9:32 PMNavya Dalavayi
01/19/2023, 5:18 AMShihgian Lee
01/19/2023, 2:35 PMNavya Dalavayi
01/19/2023, 2:37 PMNavya Dalavayi
01/19/2023, 2:37 PMShihgian Lee
01/19/2023, 2:45 PMNavya Dalavayi
01/19/2023, 2:48 PMNavya Dalavayi
01/19/2023, 2:49 PMShihgian Lee
01/19/2023, 2:54 PMpip install ddtrace. Then I created a utility method:
def initialize_tracer():
env = os.getenv('ENV')
dd_env = os.getenv('DD_ENV')
version = os.getenv('DD_VERSION')
pod_name = os.getenv('POD_NAME')
if dd_env:
from ddtrace import tracer, patch_all
tracer.set_tags({'env': env,
'team_owner': 'datascience',
'version': version,
'pod_name': pod_name})
patch_all()
Before all the BentoML imports in a service module, I initialize_tracer.Shihgian Lee
01/19/2023, 2:55 PMBentoML 1.10.0.Navya Dalavayi
01/19/2023, 2:56 PMNavya Dalavayi
01/19/2023, 2:56 PMShihgian Lee
01/19/2023, 2:57 PMNavya Dalavayi
01/19/2023, 3:02 PMNavya Dalavayi
01/19/2023, 3:02 PMNavya Dalavayi
01/24/2023, 5:48 AMservice: "serving.py:svc"
docker:
env:
BENTOML_CONFIG: "src/configuration.yaml"
dockerfile_template: "Dockerfile.template"
Dockerfile.template
{% extends bento_base_template %}
{% block SETUP_BENTO_ENTRYPOINT %}
{{ super() }}
ENTRYPOINT [ "{{ bento__entrypoint }}", "ddtrace-run", "bentoml", "serve", "{{ bento__path }}", "--production" ]
{% endblock %}Navya Dalavayi
01/24/2023, 5:51 AMShihgian Lee
01/25/2023, 2:36 PMShihgian Lee
01/25/2023, 5:08 PM{% extends bento_base_template %}
{% block SETUP_BENTO_ENTRYPOINT %}
{{ super() }}
...
ENTRYPOINT [ "{{ bento__entrypoint }}", "python", "-m", "awslambdaric" ]
{% endblock %}
Can I define the entry point as follows instead?:
{% extends bento_base_template %}
{% block SETUP_BENTO_ENTRYPOINT %}
{{ super() }}
...
ENTRYPOINT [ "{{ bento__entrypoint }}" ]
CMD ["ddtrace-run", "bentoml", "serve", "{{ bento__path }}", "--production" ]
{% endblock %}
Cc @Navya DalavayiShihgian Lee
01/26/2023, 5:39 PMddtrace-run with bentoml.
My Dockerfile.template template is a bit different but should not impact the end result :
{% extends bento_base_template %}
{% block SETUP_BENTO_ENTRYPOINT %}
{{ super() }}
CMD ["ddtrace-run", "bentoml", "serve", "{{ bento__path }}", "--production" ]
{% endblock %}
The generated Dockerfile has the following content:
...
USER bentoml
ENTRYPOINT [ "/home/bentoml/bento/env/docker/entrypoint.sh" ]
CMD ["ddtrace-run", "bentoml", "serve", "/home/bentoml/bento", "--production" ]
I prefer the ddtrace-run approach over patch_all() because I don't have to worry about initialize patch-all() as early as possible in the code.
However, the ddtrace-run didn't solve my problem. In my runner, I use Feast to fetch features from Google Datastore. In Bentoml 0.13.x, I could see grpc trace. After I upgraded to Bentoml 1.0.10, the grpc trace showed up a couple times and then disappeared forever. Datadog has grpc integration. I suspect the data retrieval for Google Datastore maybe too fast for Datadog to capture the trace. I am curious if you access any datastore in your runner? If you do, do you see any traces for your datastore?Navya Dalavayi
01/28/2023, 5:42 AMShihgian Lee
01/30/2023, 2:28 PMNavya Dalavayi
02/07/2023, 6:13 PMChaoyu
02/07/2023, 6:53 PMJiang
02/08/2023, 4:29 AMI believe the traces are lost due to the new runner architecture; specifically micro-batching at the runner level.Hi @Shihgian Lee . Tracing over the new arch\ is already included in the design. In our tests with the latest version, they were working
Jiang
02/08/2023, 4:30 AMSean
02/10/2023, 12:30 PMpatch_all was not able to instrument. While we are trying to understand more about ddtrace, have you looked into OTLP ingestion using the Datadog Agent? BentoML comes with OTLP tracing support, users will just have to configure the agent endpoint.Shihgian Lee
02/13/2023, 4:03 PMI think runners are not getting instrumented because they spawn in separate processes which@Sean That is correct - runner is in a separate process and tracing might be lost. I have moved away fromwas not able to instrument.patch_all
patch_all and replace it with ddtrace-run. This is a better solution since we don't have to worry about where we should add patch_all in our code. The ddtrace-run didn't solve our problem, which is expected because we didn't do anything differently to address separate process for the runner.Shihgian Lee
02/13/2023, 4:04 PMShihgian Lee
03/11/2023, 3:46 AMChaoyu
03/11/2023, 4:10 AM