#support

Instrumenting Flask App with Opentelemetry and SigNoz Issues

TLDR John faced issues with instrumenting Flask app, but with Srikanth's help resolved the errors. vishal-signoz offered further support through a call.

Powered by Struct AI

3

3

2

thank-you

1

Feb 20, 2023 (10 months ago)
John
Photo of md5-fd5563efec1640a775aec899ff1ef39c
John
09:56 PM
Hi team, I have followed this tutorial with and have tried instrumenting a flask app with the following Dockerfile and docker-compose.yaml:

FROM python:3.7
ADD requirements.txt /app/requirements.txt
WORKDIR /app/
ENV PYTHONPATH "${PYTHONPATH}:/q_pack"

RUN pip install -r requirements.txt

ENV OTEL_RESOURCE_ATTRIBUTES "service.name=dashApp"
ENV OTEL_EXPORTER_OTLP_ENDPOINT ""
RUN ["opentelemetry-bootstrap", "--action=install"]
CMD ["opentelemetry-instrument", "python", "./index.py","--host=0.0.0.0"]

and

    dash:
        container_name: "dash"
        build:
            context: ./dockerfiles/dockerfile_dash
        # restart: on-failure
        ports:
            - 8050:8050
            - "5001:5001" # app(debug) port
            - "3000:3000" # remote debugger attach port
        depends_on:
            - postgres
        volumes:
            - ./Storage/dash:/app
            - ./Storage/q_pack:/q_pack
        environment: 
            - FLASK_APP=app.py
            - FLASK_ENV=development

however, I get the following error:
An instrument with name http.server.active_requests, type UpDownCounter, unit requests and description measures the number of concurrent HTTP requests that are currently in-flight has been created already.

An instrument with name http.server.duration, type Histogram, unit ms and description measures the duration of the inbound HTTP request has been created already.

Transient error StatusCode.UNAVAILABLE encountered while exporting metrics, retrying in 1s.

Transient error StatusCode.UNAVAILABLE encountered while exporting metrics, retrying in 2s.

Additionally, flask is ran with: app.run(host='0.0.0.0', port=8050, debug=True, use_reloader=False) from the blog. Am I missing something in the otel-collector-*.yml files? Thank you!
Srikanth
Photo of md5-ce04a9988e2fd758a659dc55be6f2543
Srikanth
11:51 PM
>
ENV OTEL_EXPORTER_OTLP_ENDPOINT ""

When running the app inside the container, you need to ensure the endpoint where SigNoz is receiving the data is set correctly. This expects the receiver within the container and fails, as the output shows. It is either http://otel-collector:4317 if this dashApp runs as a part of the same n/w or http://<host_ip:4317> otherwise.
thank-you

1

Feb 21, 2023 (10 months ago)
John
Photo of md5-fd5563efec1640a775aec899ff1ef39c
John
01:01 AM
Ah, I see! Thank you! So the Transient error StatusCode.UNAVAILABLE encountered while exporting metrics, retrying in 1s. error is now gone. However, the "...has been created already" logs is still appearing in the dash container. Additionally, no services is appearing in the Signoz UI even after sending requests in the dash app.
01:22
John
01:22 AM
Interesting! If there's an 500 error exception in the instrumented app, services won't load into Signoz. Instead it will show in the Exceptions tab in the Signoz UI. Upon fixing this exception, then everything will show up and be tracked properly.
Ankit
Photo of md5-dbe7088320fe1d922707613e02f3420d
Ankit
12:08 PM
John services should be listed even if they throw 5xx exceptions. vishal-signoz should be able to dig deeper if you are available for a call sometime

1

Feb 22, 2023 (10 months ago)
John
Photo of md5-fd5563efec1640a775aec899ff1ef39c
John
04:51 AM
Sounds good to me! I'll reach out to Vishal to see if we can put something on our calendars. Thank you for your support.

2

Feb 23, 2023 (10 months ago)
John
Photo of md5-fd5563efec1640a775aec899ff1ef39c
John
04:17 AM
Just got off a call with vishal-signoz. He was a pleasure to interact with and supported me very well. Thank you again 🙂

3

2