# How to monitor cql queries on cassandra docker containers running on host ?

**URL:** <https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560>\
**Category:** Container platforms\
**Tags:** cassandra, docker\
**Created:** [June 22, 2022, 4:34am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560 "2022-06-22T04:34:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dartk](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dartk](https://community.dynatrace.com/u/dartk)\
**Post date:** [June 22, 2022, 4:34am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/1 "2022-06-22T04:34:17Z")

</div>

Hello,

I recently got to know about dynatrace , so I want to use to monitor my cassandra cql queries executed by python flask applications. All the Cassandra and services are in docker container so how can I do that ?

I tried by enabling cql and java cql driver but no queries shows up. I have installed dynatrace one agent in my local machine.

A bit more information, I want to use the database monitoring tool as explained in this blog:

> **[Dynatrace Blog](https://www.dynatrace.com/news/blog/)**
>
> Stay updated on the latest news on observability, automation, AI, and app security. Look here for actionable insights for optimizing your digital ecosystem.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [June 22, 2022, 6:15am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/2 "2022-06-22T06:15:08Z")

</div>

Dynatrace does not have built-in auto-instrumentation for Python without code changes and relies on either [OpenTelemetry](https://www.dynatrace.com/support/help/shortlink/opent-python), [OneAgent SDK manual](https://github.com/Dynatrace/OneAgent-SDK-for-Python) or [OneAgent SDK autoinstrumentation.](https://github.com/dynatrace-oss/OneAgent-SDK-Python-AutoInstrumentation)

All those methods require&nbsp;touching your container image and Python code. If you use any libraries supported by the OneAgent SDK autoinstrumentation, you might want to try that first. (Flask is supported, not sure about the Cassandra library you are using).&nbsp; If this does not work, go for the OpenTelemetry approach.

---

<div class="post-metadata">

**Author:** ![dartk](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dartk](https://community.dynatrace.com/u/dartk)\
**Post date:** [June 22, 2022, 7:25am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/3 "2022-06-22T07:25:26Z")

</div>

I am using cassandra offical python library.

> **[Client Challenge](https://pypi.org/project/cassandra-driver/)**

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [June 22, 2022, 7:59am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/4 "2022-06-22T07:59:56Z")

</div>

This does not seem to be supported by autodynatrace (OneAgent SDK autoinstrumentation), so you should look towards using OpenTelemetry.&nbsp; As you mention you are running it in a container, most likely you will need to send the data using Trace Ingest API. So on the page&nbsp;[Automatically instrument your Python application with OpenTelemetry — Dynatrace Docs](https://www.dynatrace.com/support/help/shortlink/opent-python)&nbsp;in the section “Send data to Dynatrace” use the “Without OneAgent” method.

FYI - the OneAgent method relies on the local endpoint ([http://localhost:14499](https://localhost:14499)) which will probably will not be available in your container.

---

<div class="post-metadata">

**Author:** ![dartk](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@dartk](https://community.dynatrace.com/u/dartk)\
**Post date:** [June 22, 2022, 8:07am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/5 "2022-06-22T08:07:37Z")

</div>

Yes I am running the Cassandra database in docker container and the flask app in a seperate container.then I connect that app to Cassandra database using Cassandra driver to the exposed container port. So is this approach valid for this case?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [June 22, 2022, 11:27am UTC](https://community.dynatrace.com/t/how-to-monitor-cql-queries-on-cassandra-docker-containers-running-on-host/35560/6 "2022-06-22T11:27:15Z")

</div>

Sure. You should need to add opentelemetry instrumentation only to your container running your Flask app. Actually, my point was about getting the trace data out of the app as the local ingest port probably won’t be available from the container unless you are using host network for the container.
