Closed tjohander-splunk closed 7 months ago
I tried but wasn't able to reproduce. Here is what I did:
python -m venv venv
source venv/bin/activate
pip install -r reqiurements.txt
export OTEL_SERVICE_NAME='django-example-server'
export OTEL_RESOURCE_ATTRIBUTES='deployment.environment=tj-devlab'
export DJANGO_SETTINGS_MODULE='instrumentation_example.settings'
splunk-py-trace python3 ./manage.py runserver --noreload
curl http://localhost:8000
Otel collector logged the following spans:
2022-09-22T13:44:00.982+0530 info TracesExporter {"kind": "exporter", "data_type": "traces", "name": "logging", "#spans": 2}
2022-09-22T13:44:00.982+0530 info ResourceSpans #0
Resource SchemaURL:
Resource attributes:
-> telemetry.sdk.language: STRING(python)
-> telemetry.sdk.name: STRING(opentelemetry)
-> telemetry.sdk.version: STRING(1.11.1)
-> deployment.environment: STRING(tj-devlab)
-> service.name: STRING(django-example-server)
-> telemetry.auto.version: STRING(0.30b1)
-> splunk.distro.version: STRING(1.6.0)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope opentelemetry.instrumentation.sqlite3 0.30b1
Span #0
Trace ID : bb2dbb48a3d169e8b51e2c762406feaa
Parent ID :
ID : 2a3ee74d537ea239
Name : SELECT
Kind : SPAN_KIND_CLIENT
Start time : 2022-09-22 08:13:56.367716 +0000 UTC
End time : 2022-09-22 08:13:56.367902 +0000 UTC
Status code : STATUS_CODE_UNSET
Status message :
Attributes:
-> db.system: STRING(sqlite)
-> db.name: STRING()
-> db.statement: STRING(
SELECT name, type FROM sqlite_master
WHERE type in ('table', 'view') AND NOT name='sqlite_sequence'
ORDER BY name)
ScopeSpans #1
ScopeSpans SchemaURL:
InstrumentationScope opentelemetry.instrumentation.django 0.30b1
Span #0
Trace ID : 9f27260e6a1fb1fd32fd70e84a663d0c
Parent ID :
ID : 7d5fb72775466b3d
Name :
Kind : SPAN_KIND_SERVER
Start time : 2022-09-22 08:14:00.115277 +0000 UTC
End time : 2022-09-22 08:14:00.11972 +0000 UTC
Status code : STATUS_CODE_UNSET
Status message :
Attributes:
-> http.method: STRING(GET)
-> http.server_name: STRING(1.0.0.127.in-addr.arpa)
-> http.scheme: STRING(http)
-> net.host.port: INT(8000)
-> http.host: STRING(localhost:8000)
-> http.url: STRING(http://localhost:8000/)
-> net.peer.ip: STRING(127.0.0.1)
-> http.user_agent: STRING(curl/7.79.1)
-> http.flavor: STRING(1.1)
-> http.status_code: INT(200)
{"kind": "exporter", "data_type": "traces", "name": "logging"}
My otel collector config:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:55681
exporters:
logging:
loglevel: debug
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging]
Closing as this is quite old. If it's is still an issue please let us know.
I'm trying to get Auto Instrumentation working for a sample Django application. My project repo is here. Details of my project configuration and bootstrapping process is detailed in the repo's
README.md
The output of
pip freeze > requirements.txt
is but for reference, here is what's been installed in thevenv
:And in my
manage.py
I've tried both adding the callDjangoInstrumentor().instrument()
, as well as bootstrapping the application withsplunk-py-trace python3 ./manage.py runserver
. I am not usingwsgi
for this local example.I've run the collector with both the
docker-compose
based container for the Collector as well as this command to get an instance of the collector running with the defaults: