Commit Graph
56 Commits
Author SHA1 Message Date
Hengfei Yang 871f954fe2 feat: add new ENV to set token for root user (#6438) 2025-04-01 12:27:11 +08:00
Hengfei Yang 33d436b000 feat: add new feature to disable compression for parquet on ingester (#6393) 2025-03-28 19:10:35 +08:00
Hengfei Yang 19d654eb7d feat: add node version (#6224)
Add node version to node list via heartbeat.
2025-03-10 16:46:38 +08:00
Hengfei Yang 1684427e52 feat: use local node for load enrichmentable (#6215)
- [x] feat: use local node for load enrichmentable
- [x] feat: improve search around with multiple streams
- [x] perf: skip the querier with have no file to query
2025-03-10 00:23:50 +08:00
Hengfei Yang 19f078bcf2 feat: improve search around (#6200) 2025-03-07 19:33:04 +08:00
Hengfei Yang d13d0f1ec0 fix: optimize wal replay logic (#6196) 2025-03-06 19:32:12 +08:00
Hengfei Yang 595490ea33 ci: update rust to nightly-2025-03-02 (#6145) 2025-03-02 17:27:10 +08:00
Hengfei YangandTaiming Liu e5b6e507ab fix: ingester replay panic (#6117)
Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
2025-02-26 10:01:57 -08:00
Hengfei Yang 34723a79b9 feat: add some cli command (#6098) 2025-02-26 00:24:48 +08:00
Hengfei Yang 5aeefbd52c feat: add query ingester timeout for UI (#6060) 2025-02-23 10:18:37 +08:00
Hengfei Yang 06ef55c9c6 feat: remove ENV ZO_COLUMN_TIMESTAMP (#6054) 2025-02-21 16:41:18 +08:00
udevandYashodhan Joshi defa86c40c feat: Action scripts [phase 2] (#5925)
- [x] Add support for alerts
- [x] Add support for search
- [x] Add Test API
- [x] Improve Update API

---------

Co-authored-by: Yashodhan Joshi <yashodhan@openobserve.ai>
2025-02-19 16:57:39 +05:30
Hengfei Yang 41b6a00907 fix: remove order_by from search request (#5994) 2025-02-17 21:48:34 +08:00
Hengfei Yang 34782d81c5 fix: stream stats negative issue (#5877) 2025-02-08 11:36:10 +08:00
Huaijin ad54320f09 feat: add search job partition result and cache (#5585) 2025-01-06 12:32:51 +08:00
Patrick Sullivan f071520b28 fix: broken MySQL migration for dropping index (#5436)
The migration to drop an index on the `folders` table fails for MySQL.
The `DROP INDEX` statement in MySQL requires specifying the table name
but including the table name is not allowed for PostgreSQL and Sqlite.

⚠️ **Migration change:** This PR modifies an existing migration, so we
should be very careful not to alter the behavior of a migration that has
already been applied to users' databases. In this case, this PR only
changes the behavior of the `aler_folder_table_idx` migration when the
database backend is MySQL. Prior to this PR that migration would panic
when ran on a MySQL database, so no user with a MySQL database will have
been able to successfully run this migration yet. Therefore there should
be not risk of creating diverging migration behavior in this PR.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Updated migration logic for the `folders` table to enhance indexing
clarity.
- Improved index drop operations for the dashboards, alerts, and search
queue tables by specifying the associated tables.
- Introduced a new CLI command `seaorm-rollback` for rolling back
migration steps, with options to rollback all or the last N migrations.
- Added an asynchronous function to facilitate migration rollbacks with
optional step specification.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-23 11:18:26 -06:00
Hengfei Yang 3d430092e1 feat: streaming agg query (#5412) 2024-12-19 21:58:58 +08:00
Patrick Sullivan 3ea91b8d42 chore: mark old migrations as deprecated for v0.14.0 release (#5308)
#5307 

### Summary

From the issue description:

> We would like to deprecate various old migrations. If these migrations
are marked as deprecated in v0.14.0, then they will be officially
removed from the app initialization logic in v0.17.0.
>
> The ramification of this is that users will not be able to upgrade
directly from versions < 0.14.0 to versions >= v0.17.0. Instead, for
example, a user on v0.13.0 would first need to upgrade to v0.14.0, and
then from v0.14.0 they could upgrade to v0.17.0.
>
> Removing these migrations will reduce the risk that the behavior of
some of these migrations, particularly those that reference data
structures or logic in other parts of the application code base,
accidentally changes in the future resulting in inconsistent migration
behavior.

### Technical details

This PR just marks certain sections of the code as deprecated. This
deprecated logic will be removed some time after v0.17.0.

### 📣 Note to reviewers 

Please comment on any additional migrations that we would like to
deprecate for v0.14.0 and I can include it in this PR. Or feel free to
commit to this branch to mark additional migrations as deprecated. If
you commit to this branch please use the `#[deprecated]` attribute if
possible or include the word `deprecated` in a comment on the code; I
plan on searching the source code for the word `"deprecated"` after
v0.17.0 to remove the deprecated code, so this would help with that.

### Todo in v0.14.0 release

We will want to include information in our official v0.14.0 release
notes about...
- The deprecation of migration/upgrade logic
- The incompatibility of direct upgrades from < v0.14.0 to >= v0.17.0
- Instructions for upgrading from < v0.14.0 to >= v0.17.0
- Users will first need to upgrade to some version >= v0.14.0 and <
v0.17.0. And then they will be able to upgrade to v0.17.0

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced error handling for the `delete-parquet` command, providing
clearer feedback on deletion success or failure.
- Added deprecation warnings for several commands and functions,
indicating future removals.
  
- **Bug Fixes**
	- Improved feedback for unsupported components in the `view` command.

- **Documentation**
- Added comments clarifying the deprecation status of certain migration
logic and functions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-10 21:02:24 -06:00
Patrick Sullivan 7c841ed39a feat: divide dashboards "HTTP Layer" and "Service Layer" logic (#5220)
## Summary

This PR only refactors code and should not result in any behavioral
changes.

This PR follows #5206 and attempts to refactor dashboards in a similar
way to how that PR refactors folders. This PR aims to divide our
dashboard code into distinct "HTTP Layer" and "Service Layer"s - where
the "HTTP Layer" contains only logic and models related to
serializing/deserializing for the REST HTTP API, and the "Service Layer"
contains only domain models/logic and is agnostic to the REST HTTP API.

This PR only partially achieves the above goals. Specifically, it makes
following changes...
1. Move all HTTP responses out of the `service` module and and into the
`http/request` module.
2. Introduce a new `DashboardError` in the `service` module to model all
types of "domain logic" errors that occur when interacting with folders.
3. Remove the `service/db/folders` module since, after the migration of
folders from the `meta` table to the `folders` table, this module mostly
just acted as a wrapper around the `infra/table/folders` module.

This PR is still missing the following changes. These changes will be
saved for a subsequent PR in order to keep the scope of this PR limited:
- Introduce new `...Response` and `...Request` types in the
`http/request/models` module whose role is specifically to define
serialization/deserialization definitions for the REST HTTP API.

⚠️ Notably, at this point the "HTTP Layer", "Service Layer", and "DB
Layer" models for dashboards are still tightly coupled together since
all still use the shared JSON serialization/deserialization logic
defined on the shared `Dashboard` struct in `config::meta`. Decoupling
the models and de/serialization logic at each layer will take more
effort than folders since the `Dashboard` struct is large and
complicated. I plan to start on this decoupling in the follow-up PR,
though that PR likely won't complete the process.

## Overall design goals

The design goals here are the same as in #5206 . Please see that PR's
description for a detailed explanation.

## Immediate motivation and next steps

Motivations and next steps are generally the same as in #5206 . Please
see that PR's description for a detailed explanation.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

- **New Features**
- Enhanced dashboard creation and update processes with improved error
handling and response management.
  - Added support for parsing dashboard data across multiple versions.

- **Bug Fixes**
- Streamlined error handling for dashboard operations, ensuring more
consistent and informative responses.

- **Chores**
- Refactored dashboard management logic to remove unnecessary
complexity, improving maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-03 19:55:03 -06:00
udev ec23784edc feat: Integrate tantivy as an inverted index substitute (#4733) 2024-11-12 13:47:33 +08:00
Hengfei Yang df0a4a79ae feat: refactor merge file on compactor (#4971) 2024-11-07 17:30:10 +08:00
499f2bfbc7 feat: SearchEventContext for search usage reports (#4934)
impl #4914 

new parameters acceptable for search queries to add additional context
in usage report:
**Dashboard**
`dashboard_id` 
`dashboard_name` 
`dashboard_folder`
`dashboard_folder_id`
`dashboard_folder_name`

**Report**
`report_key`

**Alert**
`alert_key`

Co-authored-by: Sai Nikhil <nikhil@openobserve.ai>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2024-10-31 05:16:00 -07:00
0ebaf21f33 feat: Pipeline integration v2 (#4732)
This PR implements the new design of **Pipeline** introduced by #4432 

---

**2 types of pipelines differentiates by the source** 

Type I: **Realtime**
- source is a stream (Logs, Metrics, & Traces)
- takes effect when the source stream is being ingested

Type II: **Scheduled** (aka DerivedSteram)
- source is a SQL query
- takes effect based on the given schedule

The new pipeline is represented as a graph consists of different types
of Nodes that are connected by edges.
**Pipeline Data Model**
```rs
pub struct Pipeline {
    pub id: String,
    pub version: i32,
    pub enabled: bool,
    pub org: String,
    pub name: String,
    pub description: String,
    pub source: PipelineSource,
    pub nodes: Vec<Node>,
    pub edges: Vec<Edge>,
}
```
**4 types of node**
I. StreamNode: either used for source node of realtime pipeline or for
destination nodes
II. QueryNode: used for source node of scheduled pipeline
III. FunctionNode: used for executing vrl functions
IV. ConditionNode: used for checking routing conditions

Rules applied to validating a pipeline when it's created:
1. non-empty nodes list
2. non-empty edges list
3. 1st node in nodes list is either StreamNode or QueryNode
4. non-empty `conditions` in all ConditionNode nodes in nodes list
5. all leaf nodes are of type StreamNode
6. In the same branch, unchecked `after_flattened` FunctionNode can't
follow checked
   `after_flattened` checked FunctionNode

Pipeline execution is implemented with the struct `ExecutablePipeline`,
a ready-execute pipeline object cached in memory based on the Pipeline
objects modified on the UI side.
`ExecutablePipeline` object
- builds the relationships among all the nodes based on the edges
- topologically sorts the nodes based on the level to determine which
node to process first
- registers all the vrl function node once

`ExecutablePipeline` object processes ingested records in batch.
Starting from the source node, each connecting edge has a channel
connecting the parent and child node, used for passing the records. This
approach enables batch processing in parallel.

---

**Deprecated Features**
1. previous implementation of pipeline
2. Function x Stream associations
 - Functions can still be added/edited/removed as before
- Needs to create a pipeline in order to apply chosen functions to the
desired stream

The new release when this pr is merged will automatically migrate **old
pipelines** and **Function x Stream associations** to new pipeline
format and can be found in `Stream Pipelines` tab with `Migrated-`
prefix names.
**_Note: Auto generated pipelines are paused by default. Please verify
the pipelines before enabling them_**


Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
2024-10-30 21:53:28 -07:00
Hengfei Yang 58e2be6d2e feat: bring per_thread_lock back (#4840) 2024-10-18 22:38:47 +08:00
Prabhat Sharma f39a3de5a1 fix: rename zinc labs to OpenObserve (#4822)
Rename Zinc Labs to OpenObserve
2024-10-18 13:11:52 +08:00
John Vandenberg d0079bb9bf docs: Fix typos (#4492) 2024-09-22 17:57:47 +08:00
Taiming Liu 7f75a4d6db feat: use FST for inverted indexing (#4270) 2024-09-02 22:39:44 +08:00
8031e001b9 feat: derived stream (#4160)
`DerivedStream`, as part of `Pipeline`, enables the use case of querying
an existing stream, `source`, with optional conditions and aggregations.
The resulted data will then be ingested into a new stream,
`destination`.

This PR provides the feature's initial offering. Please follow below
issue to track & suggest future improvements
#4170 

Co-authored-by: omkark06 <omkar@zinclabs.io>
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
2024-08-09 13:29:00 -07:00
Hengfei Yang 8a0dbe2cf4 feat: remove sql_mode, query_context and aggs from search API (#4089) 2024-07-31 11:23:11 +08:00
Taiming Liu 6157ef5331 feat: schema check per req for all logs ingestion APIs (#3829) 2024-07-04 11:21:47 +08:00
Hengfei Yang 611f2e1c29 perf: improve ingestion (#3678) 2024-06-12 22:01:03 +08:00
Ashish Kolheandktx-abhay 79fe002f60 feat: include search type in search calls (#3648)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced `searchType` attribute across various components to enhance
search functionality.
- Added support for different search event types like `UI`,
`Dashboards`, `Reports`, `Alerts`, `Values`, and `RUM`.

- **Bug Fixes**
- Improved search parameter handling in multiple components and API
calls.

- **Enhancements**
- Updated search-related functions to include `searchType` for more
precise search results.
- Enhanced dashboard and RUM views with new `searchType` attributes for
better data filtering.

- **Refactor**
- Standardized search functionality across different modules and
components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ktx-abhay <abhay.padamani@kiara.tech>
2024-06-03 14:14:54 +05:30
Ankur SrivastavaandHengfei Yang 8f3df9e7a1 feat: support reloading config vars using an API (#3623)
The new endpoint `/config/reload` will refresh the
environment variables.

There are a bunch of env-vars which will not be reloaded
for e.g. HTTP_PORT etc. these will need a restart.

---------

Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2024-05-30 08:23:27 +08:00
Hengfei Yang 517de8f05d fix: add region filter to _value and _around API (#3449) 2024-05-09 20:00:32 +08:00
Hengfei Yang 32b7ce4c26 feat: improve super cluster (#3428)
- [x] add timeout and partical success for super cluster
- [x] add region filter for super cluster
2024-05-08 16:32:54 +08:00
Hengfei Yang 8d1ead5105 fix: add more debug logs for search (#3280) 2024-04-19 20:01:39 +08:00
Hengfei Yang 7e457c3538 ci: add tokio-console build (#3264) 2024-04-17 15:20:38 +08:00
Hengfei Yang a48326861f feat: complete super cluster (#3226) 2024-04-12 13:45:02 +08:00
Huaijin 951c55bd92 feat: make user can cancel query task by session_id (#3130) 2024-04-08 23:43:05 +08:00
Hengfei Yang 611b955b10 refactor: separate search structure to config crate (#3186)
- [x] Separate search structure into config crate
- [x] fixed #3084
2024-04-07 12:01:47 +08:00
Subhra264 08d12f8571 feat: introduce reports in backend and replace TRIGGERS with infra::scheduler (#3086)
## Reports
Both `ZO_CHROME_ENABLED` and `ZO_SMTP_ENABLED` ENV variables need to be
`true` for reports to work.

**Report APIs -**
```
POST /api/{org_id}/reports
PUT /api/{org_id}/reports/{report_name}
GET /api/{org_id}/reports
GET /api/{org_id}/reports/{report_name}
DELETE /api/{org_id}/reports/{report_name}
PUT /api/{org_id}/reports/{report_name}/enable?value=<true|false>
```

**Report body**
```
{
  "createdAt": "2024-03-23T09:46:32.913574782Z",
  "dashboards": [
    {
      "dashboard": "7177215109754781699",
      "folder": "default",
      "tabs": [
        "default"
      ],
      "timerange": {
        "from": 0,
        "period": "1h",
        "to": 0,
        "type": "relative"
      },
      "variables": []
    }
  ],
  "description": "Report description",
  "destinations": [
    {
      "email": "mail@gmail.com"
    }
  ],
  "enabled": false,
  "frequency": {
    "cron": "",
    "interval": 1,
    "type": "weeks"
  },
  "lastEditedBy": "root@example.com",
  "mediaType": "pdf",
  "message": "Email message",
  "name": "report_name",
  "orgId": "default",
  "owner": "root@example.com",
  "password": "ComplexPass#123",
  "start": 1711187192913571,
  "timezone": "Asia/Calcutta",
  "timezoneOffset": 330,
  "title": "Email subject",
  "user": "root@example.com"
}
```

**ENVs**
| ENV |  Description | 
|------|---------------|
| `ZO_CHROME_ENABLED` | Must be `true` for reports, Default - `false` |
| `ZO_CHROME_PATH` | If chrome is enabled, custom `chrome` executable
path can be specified. If not specified, it looks for chrome executable
in default locations. If still not found, it automatically downloads a
good known version of `chromium`. |
| `ZO_CHROME_CHECK_DEFAULT_PATH` | If `false`, it does not look for
chromium in default locations, Default is `true`. |
| `ZO_CHROME_DOWNLOAD_PATH` | If chromium can not be found in default
locations and also `ZO_CHROME_PATH` is not specified, it downloads the
system specific chromium in the given path. Default is `./download`
(gitignored). `chromium` is downloaded for the first time only,
afterwords, `chromium` is fetched from the given path. If there is any
error regarding download of `chromium`, delete the download folder as it
might be in a bad state. |
| `ZO_CHROME_NO_SANDBOX` | If `true`, it launches chromium in
`no-sandbox` environment. Default is `false` |
| `ZO_CHROME_SLEEP_SECS` | Specify the number of seconds the
`service::dashboards::reports::generate_report()` will wait to load all
the data in the headless chromium dashboard. Default is `20` seconds. |
| `ZO_CHROME_WINDOW_WIDTH` | Specifies the width of the headless
chromium browser. Default is `1370` |
| `ZO_CHROME_WINDOW_HEIGHT` | Specifies the height of the headless
chromium browser. Default is `730` |

## Scheduler

Currently `Scheduler` is implemented for only `Sqlite`, `Postgres` and
`MySql`.
**API**
```rust
pub trait Scheduler: Sync + Send + 'static {
    async fn create_table(&self) -> Result<()>;
    async fn create_table_index(&self) -> Result<()>;
    async fn push(&self, trigger: Trigger) -> Result<()>;
    async fn delete(&self, org: &str, module: TriggerModule, key: &str) -> Result<()>;
    async fn update_status(
        &self,
        org: &str,
        module: TriggerModule,
        key: &str,
        status: TriggerStatus,
        retries: i32,
    ) -> Result<()>;
    async fn update_trigger(&self, trigger: Trigger) -> Result<()>;
    async fn pull(
        &self,
        concurrency: i64,
        alert_timeout: i64,
        report_timeout: i64,
    ) -> Result<Vec<Trigger>>;
    async fn clean_complete(&self, interval: u64);
    async fn watch_timeout(&self, interval: u64);
    async fn len_module(&self, module: TriggerModule) -> usize;
    async fn len(&self) -> usize;
    async fn is_empty(&self) -> bool;
    async fn clear(&self) -> Result<()>;
}
```

**ENVs**
| ENV |  Description | 
|------|---------------|
| `ZO_ALERT_SCHEDULE_CONCURRENCY` | The number of `scheduled_jobs` the
`alert_manager` can process at a time. Default is `5` |
| `ZO_ALERT_SCHEDULE_TIMEOUT` | Visibility timeout for alerts. Default
is `90` seconds |
| `ZO_REPORT_SCHEDULE_TIMEOUT` | Visibility timeout for reports. Default
is `300` seconds |
| `ZO_SCHEDULER_MAX_RETRIES` | Maximum number of retries that will be
made for a `scheduled_job`. Default is `3` |
| `ZO_SCHEDULER_CLEAN_INTERVAL` | Time interval after which the
`Scheduler` will clean up the queue. Default is `30` seconds |
| `ZO_SCHEDULER_WATCH_INTERVAL` | Time interval after which the
`Scheduler` will watch for timeout for `scheduled_jobs`. Default is `30`
seconds. |

**Workflow**

![openobserve_scheduler_workflow](https://github.com/openobserve/openobserve/assets/59690052/68beb43b-d04f-49dc-9006-a30942acd99b)
2024-03-25 18:24:14 +05:30
7c52e0ea7a fix: schema versions as separate key (#3021)
To enable row per schema version use:
ZO_ENTRY_PER_SCHEMA_VERSION_ENABLED = true.

One can migrate schemas from single row to row per schema version using
: migrate-schemas command

Before migration :

- DROP INDEX meta_module_key2_idx ON meta
- ALTER TABLE meta ADD COLUMN start_dt BIGINT NOT NULL DEFAULT 0;
- CREATE UNIQUE INDEX meta_module_start_dt_idx ON meta (start_dt, key2,
key1, module);

---------

Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
Co-authored-by: Ankur Srivastava <ansrivas@users.noreply.github.com>
Co-authored-by: Huaijin <haohuaijin@gmail.com>
Co-authored-by: ktx-abhay <141122205+ktx-abhay@users.noreply.github.com>
Co-authored-by: Subhra264 <chakrabortysubhradeep556@gmail.com>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
Co-authored-by: ktx-vaidehi <vaidehi.akhani@kiara.tech>
Co-authored-by: Omkar Kesarkhane <127078473+omkarK06@users.noreply.github.com>
Co-authored-by: Kirtan Thakkar <kirtan@kiara.tech>
2024-03-24 21:25:06 +05:30
Hengfei Yang fd49360f49 feat: add quick mode fields (#3068) 2024-03-22 15:54:39 +08:00
Hengfei Yang f1a7ad0961 feat: update datafusion to 36 (#3035) 2024-03-18 22:50:26 +08:00
Hengfei Yangandoasisk e1097f86e2 feat: add fast mode for query (#2876)
Use **Fast Mode** when dealing with thousands of fields. It retrieves
the first N fields for a quicker response.

Enable it through this configuration: 

```
ZO_FAST_MODE_NUM_FIELDS=50
ZO_FAST_MODE_STRATEGY=first/last/both
```

And use the search API:

```json
{
	"query": {
		"sql": "select * from default ",
		"start_time": 1709711116396000,
		"end_time": 1709712016396000,
		"from": 0,
		"size": 250,
		"sql_mode": "full",
		"fast_mode": true
	}
}
```

When the backend identifies a request:
- Using `fast_mode` 
- With an `SQL` prefix of `select *` 
- Where schema fields exceed `ZO_FAST_MODE_NUM_FIELDS` 

It will then rewrite the `SQL` to `select f1,f2,f3`, where 'fn'
represents the first 'n' fields from schema. The value of 'n' is
determined by `ZO_FAST_MODE_NUM_FIELDS`.

In the end you can set `ZO_FAST_MODE_STRATEGY=first/last/both` to
control the order for pickup fields from schema.

---------

Co-authored-by: oasisk <ashish.j.kolhe@gmail.com>
2024-03-06 19:50:30 +05:30
Hengfei Yang 79682120f0 feat: search queue management (#2621) 2024-02-01 11:54:01 +08:00
Ashish Kolhe 98c9af0356 fix: report user email as part of usage reporting (#2610) 2024-01-31 15:31:08 +05:30
Hengfei Yang 325aa4b3f2 fix: unit tests (#2542)
- [x] change sqlite backend to a Mutex
- [x] fix unit tests
2024-01-24 22:42:20 +08:00
Hengfei Yang ab28f13afb feat: migrate from any to any (#2472) 2024-01-14 22:54:38 +08:00
Hengfei Yang 150d251983 perf: keeping optimize search (#2362) 2024-01-09 19:49:17 +08:00