open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
724 stars 593 forks source link

unable to get any auto instrumentation to work for a GRPC server written in python #798

Open kant777 opened 2 years ago

kant777 commented 2 years ago

Hi All,

I am unable to get the auto instrumentation to work for the following server written in python https://github.com/lightstep/hipster-shop/blob/master/src/emailservice/email_server.py

I ran the server using the following command

opentelemetry-instrument --traces_exporter console python3 email_server.py

I was successfully able to invoke the server using https://github.com/lightstep/hipster-shop/blob/master/src/emailservice/email_client.py and I can see the requests hitting the server successfully as well however no spans had been generated not sure what else I need to do to see some spans?

owais commented 2 years ago

Reproduced. Only jinja spans were generated and there were no grpc spans. I tested with latest 1.6.2 and 0.25b2

kant777 commented 2 years ago

can you share the sample of jinja spans? Also do you know why grpc spans are not generated?

owais commented 2 years ago

I don't know why. It looked like the instrumented tracing interceptor was not being called by grpc. Needs more investigation.

owais commented 2 years ago
{
    "name": "jinja2.compile",
    "context": {
        "trace_id": "0x1e1e44852d510d1c3638e63f1a0dcee1",
        "span_id": "0x5866f45dbb86b99f",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x326ff2341b9d0208",
    "start_time": "2021-11-09T12:31:00.777981Z",
    "end_time": "2021-11-09T12:31:00.784793Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "jinja2.template_name": "confirmation.html"
    },
    "events": [],
    "links": [],
    "resource": {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "opentelemetry",
        "telemetry.sdk.version": "1.6.2",
        "service.name": "email-server"
    }
}
{
    "name": "jinja2.load",
    "context": {
        "trace_id": "0x1e1e44852d510d1c3638e63f1a0dcee1",
        "span_id": "0x326ff2341b9d0208",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2021-11-09T12:31:00.777774Z",
    "end_time": "2021-11-09T12:31:00.784848Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "jinja2.template_name": "confirmation.html",
        "jinja2.template_path": "templates/confirmation.html"
    },
    "events": [],
    "links": [],
    "resource": {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "opentelemetry",
        "telemetry.sdk.version": "1.6.2",
        "service.name": "email-server"
    }
}
kant777 commented 2 years ago

can you please provide steps you took to produce this jinja span?

owais commented 2 years ago

I just ran the example you shared with otel packages version mentioned in this comment