Repository navigation
Proposal: OpenObserve as a database via the sqlalchemy-openobserve dialect #46231
lululuyuanyuanyuanGe
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'd like to propose adding OpenObserve as a database in Superset, and to ask for guidance before we open the PR.
OpenObserve is an open-source observability platform for logs, metrics and traces. Its query engine is built on Apache DataFusion, and it serves SQL over log streams through an HTTP search API. Teams that keep their logs there could then chart them in Superset next to their other data.
We're a small group of students at the University of Toronto working on this as part of an open-source course, and we plan to keep maintaining the driver afterwards.
Connection path
Superset →
sqlalchemy-openobserve(SQLAlchemy dialect + DB-API driver, Apache-2.0) → OpenObserve's HTTP_searchAPI.openobserve://{email}:{password}@{host}:{port}/{organization}. Add?ssl=falsefor a plain-HTTP local server.Status of the driver:
We'll publish it on PyPI before opening the Superset PR. There is also an engine spec skeleton on our Superset fork.
Design points worth a second opinion
No schemas. OpenObserve has organizations and streams, but no schemas. Like elasticsearch-dbapi, the dialect reports a single
defaultschema and leaves it out of the SQL it compiles. Log streams are the tables.The time column is an integer. Every stream has
_timestamp, stored as Int64 microseconds. We checked against OpenObserve v1.0.4:TIMESTAMPliteral is rejected.date_trunc('day', to_timestamp_micros(_timestamp))works for bucketing.So the plan is:
_timestampasTIMESTAMP, so Superset picks it as the time column.convert_dttmemits integer microseconds._time_grain_expressionswrap the column into_timestamp_micros().Time window. The search API needs a start and end time outside the SQL. The driver works them out from the
_timestampcomparisons in theWHEREclause. The integer form above lets it narrow the window; without a time filter, a query covers all time.Logs only for now. Metrics and traces streams need a different stream type on the search API. They can come later.
Planned Superset PR
Following the DataFusion engine spec (#42374):
superset/db_engine_specs/openobserve.py:convert_dttmcustom_errorsfor bad credentials, a missing stream, and SQL syntax errorstests/unit_tests/db_engine_specs/test_openobserve.pyopenobserveextra inpyproject.toml, like theclickhouseanddatafusiononessuperset_text.ymlQuestions
superset.db_engine_specsentry point?TIMESTAMP, withconvert_dttmreturning integers, look reasonable? Is there a pattern in an existing engine spec you'd prefer we follow?pyproject.tomlextra, such as a minimum release or a level of test coverage?Thanks! Feedback on any of the above is very welcome.
All reactions