Commit Graph
83 Commits
Author SHA1 Message Date
c3759a4231 fix: Migration for scheduled_jobs table to use alert id as module_key (#6365)
Co-authored-by: udev <uddhavdave1@gmail.com>
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-03-24 15:10:44 +05:30
Hengfei Yang 595490ea33 ci: update rust to nightly-2025-03-02 (#6145) 2025-03-02 17:27:10 +08:00
Subhra264 4a7784b409 feat: Scheduler redesign with mpsc channels (#6121)
Uses mpsc channels to process pulled scheduled jobs so that it does not
block the entire alert manager to pull other jobs when there is
capacity. Makes use of semaphores so that we pull the same number of
jobs as the number of available workers.

### The new design is -
- We spawn the same number of worker threads as the configured max concurreny env.
- After pulling jobs, it sends to each worker through the mpsc channel
- Each worker processes the received trigger
- After the scheduler interval, the puller job checks how many workers are still available i.e. how many workers are done with processing triggers.
- It only pulls the same number of jobs from db as the number of available workers at that particular time.
The cycle continues.

So, the scheduler pulls at max the "max concurrency" number of jobs at a time depending on the availability of worker threads.
2025-03-01 23:25:46 +05:30
Hengfei Yang f8c5f012bd feat: remove configure ZO_USAGE_ORG (#6142) 2025-03-01 21:41:39 +08:00
Subhra264andhengfei yang be2348747c feat: add source_node to triggers stream (#6097)
This PR adds a `source_node` field to the `triggers` stream to indicate
which alert manager processed the particular trigger. This is the name
of the node.

---------

Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
2025-02-26 12:22:20 +05:30
Subhra264 e315bcc73a feat: move last_satisfied_at and last_triggered_at to scheduled_job table (#5968)
Fixes https://github.com/openobserve/openobserve/issues/5975
2025-02-18 19:24:51 +05:30
Taiming Liu 632da3c0b4 feat: migrate template & destination (#5701) 2025-02-04 18:25:21 +08:00
Patrick Sullivan c89b715119 feat: Alerts API v2 - part 2 - rename methods (#5470)
#5253 

Part 2 in a series of PRs to add new Alerts endpoints that support
parent folders and KSUIDs

This PR just renames various methods

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

## Summary by CodeRabbit

- **New Features**
- Introduced new alert management structures and request/response bodies
for creating, updating, and listing alerts.
	- Added unique identifier support for alerts.
- **Bug Fixes**
	- Enhanced error handling for alert creation and updates.
- **Documentation**
- Updated OpenAPI documentation to include new alert-related request and
response types.
- **Refactor**
- Renamed functions for clarity in alert management, including retrieval
and deletion by name.
- **Tests**
- Updated integration tests to reflect changes in alert deletion
methods.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-27 08:28:26 -06:00
Patrick Sullivan 386906f6a7 feat: Migrate alerts data out of meta table into alerts table (#5390)
#5253 

The overall goal of this PR is to migrate alerts data out of `meta`
table into `alerts` table. To accomplish this three main changes are
made. Unfortunately, all three of these changes need to be synchronized
and submitted in the same PR.

1. A new migration script is added to
- Parse alerts JSON currently stored in the `meta` table into Rust
models for alerts. These Rust models are isolated to the migration
script since they represent the schema of alerts as they are stored in
the `meta` table before this migration executes.
    - Convert those Rust models into Sea ORM entities for alerts.
- Insert all the Sea ORM entities for alerts into the new `alerts`
table.
2. Create get/put/delete/list methods for accessing the data in the
`alerts` table
    - These functions use SeaORM to query and update the database.
- These functions must also convert between SeaORM alert entities and
the application's current data model for alerts (as defined in
`config::meta::alerts`.
- It's entirely expected that the models inside `config::meta::alerts`
will change over time. When this happens in the future, developers will
need to update the transformation functions between SeaORM alert
entities and the models in `config::meta::alerts`. Luckily, the compiler
should help to direct developers to where these transformation functions
need to be updated.
3. Update the old logic in `/src/service/db/alerts.rs` that previously
read and wrote alerts to the `meta` table so that it now reads and
writes alerts to the `alerts` table.
- The methods for accessing the `meta` table included logic for
triggering "cache update events" to the cluster coordinator and for
sending events to the super cluster queue. Since the new logic accesses
the `alerts` table rather than the `meta` table, this logic for emitting
events had to be reproduced.


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

- **New Features**
- Introduced a new `ListAlertsParams` struct for flexible querying of
alerts.
  - Enhanced `TriggerCondition` struct with new timing parameters.
- Added new error variants for improved error handling in alert
management.
- Created a comprehensive alert management system with CRUD operations.
- Added integration tests for various functionalities related to alerts
and dashboards.
- Introduced a new `Alerts` variant in the `FolderType` enum for better
folder management.

- **Bug Fixes**
  - Improved error handling for folder deletion when alerts are present.

- **Documentation**
- Updated documentation for several functions to clarify their scope and
functionality.

- **Chores**
  - Added new dependencies to support additional functionality.
  - Introduced migration scripts for database schema changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-20 20:17:58 -06:00
Hengfei Yang 8f6c5e8312 fix: add limit for full text search field must by text (#5422) 2024-12-20 19:47:20 +08:00
Taiming Liu 45419b5700 chore: defer sea_orm migration after legacy migration done (#5358)
This pr propose to defer recently added and soon-to-be-added migrations
to be executed after the version-based migration is done with the meta
table.
2024-12-15 19:13:54 -08:00
Hengfei Yang c3b04a0f07 perf: improve nats lock (#5268) 2024-12-06 16:22:03 +08:00
Patrick Sullivan 856e1adaf3 feat: "HTTP Layer" dashboard models (#5236)
## Summary

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

This PR follows #5220 and creates separate "HTTP Layer" models for each
our dashboard HTTP API endpoints.

By separating the "HTTP Layer" models from the "Service Layer" dashboard
models we will now (in future PRs) be able to...
- add folder name and folder ID fields to each item returned by the
`ListDashboards` endpoint - Step 3 of #5198
- remove dashboard details from the each item returned by the
`ListDashboards` endpoint - Step 1 of #5196

Unfortunately, this PR does not yet accomplish fully decoupling the
"HTTP Layer" dashboard model from the "DB Layer" dashboard model since
both layers still use the same same JSON de/serialization logic defined
on the structs inside `config/meta/dashboards`. So changes to that model
and the corresponding JSON de/serialization logic could still introduce
silent breaking changes into both the interface with the DB and the HTTP
API. This PR moves us closer to decoupling those models, though future
work will be necessary to fully decouple them.

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

- **New Features**
- Introduced new data structures for handling dashboard-related HTTP
requests and responses, enhancing clarity and type safety.
- Added support for creating, updating, and listing dashboards with
structured request and response bodies.

- **Documentation**
- Updated OpenAPI documentation to reflect new schemas for dashboard
operations, improving API clarity and specificity.

- **Refactor**
- Removed outdated dashboard structures and streamlined request handling
logic for improved maintainability.
- Updated integration tests to align with the new dashboard data
structures.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-04 18:01:44 -06:00
Hengfei Yang d6487eb9fe ci: update rust version (#5143) 2024-11-25 19:20:07 +08:00
Patrick SullivanandTaiming Liu a8647d3bbe feat: move dashboards module to config crate (part 1/2 of feature 5068) (#5113)
This is the first PR for #5068 .

We need to move `dashboards` into the `config` crate so that DB access
functions in the `infra` crate can return types defined in the
`dashboards` module.

When the `dashboards` module is in the `openobserve` crate we cannot use
them in the `infra` crate since that would introduce a circular
dependency.

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

## Release Notes

- **New Features**
- Introduced a new function to move dashboards, enhancing dashboard
management capabilities.
- Added a new `SendReport` trait for improved report handling and
modularity.
- Enhanced error handling across various dashboard and report management
functions.

- **Improvements**
- Updated import paths for better clarity and organization, particularly
for dashboard-related modules.
- Improved timestamp handling for alerts to ensure accurate tracking of
updates.
- Enhanced OpenAPI documentation to reflect updated schema references
for dashboards.
	- Expanded development dependencies to support improved functionality.
- Enhanced the logic for handling report triggers based on frequency
types.

- **Bug Fixes**
- Refined error handling in dashboard creation and deletion functions to
provide clearer responses.
- Standardized error handling across report management functions for
consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
2024-11-22 13:23:40 -06: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
Subhra264 b88f21aad3 test: add alert integration tests regarding scheduler (#4929)
New integration tests for cargo to test alert scheduling

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

- **Tests**
- Introduced new asynchronous integration tests for multi-range alert
handling.
- Enhanced existing alert tests with improved assertions for creation
and deletion processes.
- Updated alert trigger conditions to ensure comprehensive validation of
alert functionalities.
- Added tests for alert behavior during retries after destination
failures and evaluation errors.
- Updated tests for the `SearchHistoryQueryBuilder` to reflect new SQL
query structure tailored to search events.
- Modified tests for `RedirectResponse` to accommodate multiple query
parameter orders.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-30 10:27:23 +05:30
Huaijin 56dcacb513 feat: use seaorm to refactor short_urls (#4862) 2024-10-24 19:59:06 +08:00
Hengfei Yang b72ac5b8d7 feat: Alerts support SNS destination (#4824) 2024-10-18 20:27:43 +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
Hengfei Yang d1ed457369 feat: new search engine (#4182) 2024-09-20 15:10:54 +08:00
Huaijin a7990a4d1d feat: impl union plan for single node (#4352) 2024-08-28 23:31:00 +08:00
BhargavandSubhradeep Chakraborty a5af316129 fix: issue #4326 User defined schema settings (#4350)
issue #4326 
  
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced new structures for updating stream settings, allowing for
more granular management of stream configurations.
- Added an asynchronous function for updating stream settings via HTTP
PUT requests.
- Implemented a new service route for handling updates to stream
settings.
  - Enhanced the `AddStream` component to retrieve updated settings.

- **Improvements**
- Improved schema management by tracking previous settings during
updates.
- Enhanced utility functions for comparing and managing stream settings.

- **Documentation**
- Updated documentation to reflect changes in API functionality for
creating and updating stream settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Subhradeep Chakraborty <chakrabortysubhradeep556@gmail.com>
2024-08-27 20:52:26 +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 6d0fbdd91d refactor: separate proto to a new crate (#3146) 2024-04-02 23:15:14 +08:00
Hengfei Yang e33ae00ea1 feat: merge dev into main (#3016) 2024-03-17 22:38:07 +08:00
Hengfei Yang d887b6eed2 feat: impl hash partition (#2647) 2024-02-04 19:07:03 +08:00
Hengfei Yang 79682120f0 feat: search queue management (#2621) 2024-02-01 11:54:01 +08:00
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 a4bae1a584 feat: Implement memtable + wal (#2261) 2023-12-28 07:40:22 +08:00
Hengfei Yang 1b0b8c2bf5 chore: update format (#2144)
fixed #2102
2023-12-07 10:10:45 +05:30
Prabhat Sharma 5db4ca191a change license to AGPL 2023-11-26 18:34:59 -08:00
Hengfei Yang 681f6e3af9 feat: support mysql for metadata (#1968) 2023-11-20 07:42:12 +08:00
Hengfei Yang 76fb283191 ci: upgrade rust to nightly-2023-10-24 (#1804) 2023-10-30 02:04:43 -05:00
Nrishinghananda Roy 414b4e0d63 fix: Clippy errors in tests (#1566)
`tests` module had a few clippy errors/warnings. Applied the fixes.
2023-09-26 03:29:51 -05:00
Hengfei Yang 019c4ccc53 fix: swagger under sub directory (#1476) 2023-09-09 12:36:23 +08:00
Ashish Kolhe c0114e36f6 feat: dashboard versioning (#1464) 2023-09-06 15:45:44 +05:30
Hengfei Yang 5a3173c689 feat: implement sqlite for metadata (#1449) 2023-09-04 11:00:28 +08:00
Hengfei Yang af521fde54 fix: update license (#1404) 2023-08-21 15:37:50 +08:00
Ankur Srivastava e2dd047bf5 refactor: move infra and meta inside common (#1105)
This is the first step towards splitting the repo into smaller sub
projects.
2023-07-06 12:32:07 +05:30
Ashish Kolhe f58ad652d1 fix: functions disabled due to feature flag (#1047) 2023-06-27 18:43:40 +08:00
Hengfei Yang 8c74eaac84 feat: impl metrics http json API (#999)
## Design Spec:

- POST `/api/:org/ingest/metrics/_json`

```json
[
    {
        "__name__": "stream name",
        "__type__": "counter / gauge / histogram / summary",
        "label_name1": "label_value1",
        "label_name2": "label_value2",
        "_timestamp": 0, // unix timestamp in millisecond
        "value": 0.0 // float64 value
    }
]
```

## How to use this API:
- must use `__name__` set stream name.
- must use `__type__` set metrics type. and the type can't be updated
after first record
- `_timestamp` needs UNIX timestamp or empty will fill by current
timestamp
- `value` should be float64 or int64

## Example:

POST `/api/default/ingest/metrics/_json`
```json
[
    {
        "__name__": "cpu",
        "__type__": "gauge",
        "namespace": "ziox",
        "container": "zo1",
        "_timestamp": 1687326643584062,
        "value": 10.1
    },
    {
        "__name__": "cpu",
        "__type__": "gauge",
        "namespace": "ziox",
        "container": "zo2",
        "value": 0.1
    }
]
```
2023-06-21 23:02:41 +08:00
BhargavandPrabhat Sharma 10dd9bab13 fix: multitenancy changes (#864)
Co-authored-by: Prabhat Sharma <hi.prabhat@gmail.com>
2023-06-02 16:29:11 +05:30
Hengfei Yang 7518811da0 feat: return global data retention in config api (#859) 2023-05-31 20:58:34 +08:00
Hengfei Yang 53e1a23921 feat: rename zincobserve to openobserve (#848) 2023-05-31 11:29:10 +08:00
Hengfei Yang ca2f55a57e feat: support skip tls verify when create alert destination (#819) 2023-05-26 17:58:38 +08:00
Ashish Kolhe b94e7e94d8 feat: enrichment functions (#772) 2023-05-20 14:24:46 +05:30
Prabhat Sharma 3843631ade fix: fix for grafana querying prometheus endpoint (#713)
Make change to prometheus endpoints so grafana queries can succeed.
2023-05-11 06:52:00 +05:30
Ashish Kolhe f20c9805bb feat: syslog ingestion (#711) 2023-05-11 06:18:24 +05:30