Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracing): Add commented out tracing relation into templates #2100

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

alithethird
Copy link
Contributor

Related to Paas Charm PR.

Adds the possibility to integrate with Tempo Operator to trace the 12 Factor app workload for current frameworks(go, django, flask, fastapi).

reviewers:
@jdkandersson
@javierdelapuente

Copy link
Contributor

@erinecon erinecon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to the docs!

I had some nitpick comments that I repeated across all the reference docs.

Also, it's possible that this work will conflict with #2083, so you may want to wait on that PR to merge.

docs/reference/extensions/django-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/django-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/fastapi-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/fastapi-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/flask-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/flask-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/go-framework-extension.md Outdated Show resolved Hide resolved
docs/reference/extensions/go-framework-extension.md Outdated Show resolved Hide resolved
@@ -200,6 +209,11 @@ The RabbitMQ integration creates the connection string in the environment variab
- `RABBITMQ_PORT`
- `RABBITMQ_VHOST`

The Tracing integration creates the following environment variables that you may use to configure your application:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps "can" instead of "may"


12-Factor charms are designed to be easily observable using the [Canonical Observability Stack](https://charmhub.io/topics/canonical-observability-stack).

You can easily integrate your charm with [Loki](https://charmhub.io/loki-k8s) and [Prometheus](https://charmhub.io/prometheus-k8s) using Juju.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps include grafana

juju integrate django-k8s grafana
juju integrate django-k8s loki
juju integrate django-k8s prometheus
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include an empty line

juju integrate django-k8s prometheus
```
After integration, you will be able to observe your workload using Grafana dashboards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reduce to 1 empty line

Comment on lines +252 to +253
To learn how to enable tracing in your Django app you can checkout the example in [Paas Charm repository](https://github.com/canonical/paas-charm).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's refer to the how to for tracing

To learn how to enable tracing in your Django app you can checkout the example in [Paas Charm repository](https://github.com/canonical/paas-charm).

OpenTelemetry will automatically read the environment variables and configure the OpenTelemetry SDK to use them.
For other frameworks and further configuration options please refer to [OpenTelemetry documentation](https://opentelemetry-python.readthedocs.io/en/latest/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the [OpenTelemetry documentation](https://opentelemetry-python.readthedocs.io/en/latest/) for further information about tracing.

Comment on lines +238 to +256
To enable tracing in your Flask app you can simply add the following lines to your workload code:

```python
from opentelemetry import trace
from opentelemetry.instrumentation.flask import FlaskInstrumentor

app = Flask(__name__)
FlaskInstrumentor().instrument_app(app)
tracer = trace.get_tracer(__name__)
```

You also need to add the following lines into your `requirements.txt` file:

```
opentelemetry-api
opentelemetry-exporter-otlp-proto-http
opentelemetry-instrumentation-flask
opentelemetry-sdk
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this in the how to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, instead of a how to, please prepare a blog post I can attach to the regular updates about tracing in Flask. We can include links to the frameworks here for people to read more

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do a spread test for flask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants