Comments (10)
Reported upstream at open-telemetry/opentelemetry-python#3897
from logfire.
I can't reproduce it.
I've also added the FlaskInstrumentor.instrument(app)
to actually test that the traces are being sent:
import gevent.monkey
gevent.monkey.patch_all()
import logfire
logfire.configure()
# todo doing this import shows the error
import magic
from flask import Flask
from opentelemetry.instrumentation.flask import FlaskInstrumentor
app = Flask(__name__)
FlaskInstrumentor().instrument_app(app)
@app.route('/')
def hello_world():
return '<p>Hello, World!</p>'
if __name__ == '__main__':
app.run()
This is the actual packages installed retrieved from pip freeze
(I've installed the packages mentioned in the description):
pip freeze
annotated-types==0.6.0blinker==1.8.1
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
Deprecated==1.2.14
Flask==3.0.3
gevent==24.2.1
googleapis-common-protos==1.63.0
greenlet==3.0.3
idna==3.7
importlib-metadata==7.0.0
itsdangerous==2.2.0
Jinja2==3.1.3
logfire==0.28.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-http==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-aiohttp-client==0.45b0
opentelemetry-instrumentation-dbapi==0.45b0
opentelemetry-instrumentation-flask==0.45b0
opentelemetry-instrumentation-jinja2==0.45b0
opentelemetry-instrumentation-psycopg2==0.45b0
opentelemetry-instrumentation-redis==0.45b0
opentelemetry-instrumentation-requests==0.45b0
opentelemetry-instrumentation-sqlalchemy==0.45b0
opentelemetry-instrumentation-sqlite3==0.45b0
opentelemetry-instrumentation-system-metrics==0.45b0
opentelemetry-instrumentation-urllib==0.45b0
opentelemetry-instrumentation-urllib3==0.45b0
opentelemetry-instrumentation-wsgi==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
packaging==24.0
protobuf==4.25.3
psutil==5.9.8
pydantic==2.7.1
pydantic_core==2.18.2
Pygments==2.17.2
python-magic==0.4.27
requests==2.31.0
rich==13.7.1
setuptools==69.5.1
typing_extensions==4.11.0
urllib3==2.2.1
Werkzeug==3.0.2
wrapt==1.16.0
zipp==3.18.1
zope.event==5.0
zope.interface==6.3
Am I doing something wrong?
from logfire.
I created a new project with fresh installs just to be sure.
What if you try this exact poetry project ?
poetry_project.zip
And then do python main.py
:
β― python main.py
Logfire project URL: https://logfire.pydantic.dev/------------
Traceback (most recent call last):
File "src/gevent/_abstract_linkable.py", line 287, in gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_links
File "src/gevent/_abstract_linkable.py", line 333, in gevent._gevent_c_abstract_linkable.AbstractLinkable._notify_links
AssertionError: (None, <callback at 0x7f622d828840 args=([],)>)
2024-05-01T09:49:40Z <callback at 0x7f622d828840 args=([],)> failed with AssertionError
* Serving Flask app 'main'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
from logfire.
I still can't reproduce it.
Are you sure you are running the virtual environment created by poetry? I had to create the logfire_test/
directory, and the __init__.py
file on your example, and I actually run the app with poetry run python main.py
.
from logfire.
Are you sure you are running the virtual environment created by poetry?
Yes, the IDE uses it for me.
I had to create the logfire_test/ directory,
Agree
and the init.py file on your example,
Not needed.
and I actually run the app with poetry run python main.py.
Yes. This is the full project without .idea & .logfire dirs
logfire_test.zip
@Kludex maybe you need the os to be the same? (ubuntu 22.04)
I replicated in a github codespace https://github.com/ddorian/jubilant-space-potato
from logfire.
I could reproduce in your codespace. It seems to be a combination of gevent
+ opentelemetry
+ magic
that's the root cause. I get the same error from the following minimal repro:
import gevent.monkey
gevent.monkey.patch_all()
from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter
processor = BatchSpanProcessor(SpanExporter(), schedule_delay_millis=500)
# todo doing this import shows the error
import magic
requirements.txt:
Deprecated==1.2.14
gevent==24.2.1
greenlet==3.0.3
importlib-metadata==7.0.0
opentelemetry-api==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-semantic-conventions==0.45b0
python-magic==0.4.27
typing_extensions==4.11.0
wrapt==1.16.0
zipp==3.18.1
zope.event==5.0
zope.interface==6.3
from logfire.
I can also reproduce locally with the same example (Ubuntu 24.04, Python 3.12.3)
from logfire.
I'm also facing the same issue with Fastapi. Any quick fix?
from logfire.
I'm also facing the same issue with Fastapi. Any quick fix?
It shouldn't affect FastAPI... π€
from logfire.
Since this issue is on OTel side, I'll be closing it here.
If interested, you can watch this: open-telemetry/opentelemetry-python#3897.
from logfire.
Related Issues (20)
- Add `logfire.instrument_pytest()` HOT 4
- `logfire inspect` suggests irrelevant packages HOT 1
- `test_logfire_api` doesn't look at `logfire_api.__all__` HOT 3
- pip install logfire (without version) installed the very old version of logfire HOT 2
- Temporal.io integration HOT 1
- How to send data to otel collector? HOT 2
- logfire 0.50 requires pytest HOT 6
- δΈζζζ‘£δΈηΊΏδΊ π π π εζ±εε³ηδΈζ HOT 4
- Live View - Filters Menu - Long Span names run the menu off screen
- How to use with FastAPI, SQLModel and Postgres, etc.? HOT 4
- Would be good for cancel filter button
- Psyopg2 Instrumentation doesn't work with `RealDictCursor`
- Instrumentation of pydantic validation - Slow on big response size HOT 9
- Enable webhook data "styling" HOT 3
- Show in context, to show selected log in unfliltered list of logs HOT 3
- How can get alert(email notification) when error appear HOT 2
- retaining old project url in local dev HOT 4
- pip-compile logfire with opentelemetry-instrumentation depending on setuptools HOT 4
- Logs slipping through alert timing HOT 5
- Live View - Save position of info pane split HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logfire.