From 595490ea33def4762a9e8415026bc14babc5498e Mon Sep 17 00:00:00 2001 From: Hengfei Yang Date: Sun, 2 Mar 2025 17:27:10 +0800 Subject: [PATCH] ci: update rust to nightly-2025-03-02 (#6145) --- .github/workflows/api-testing.yml | 2 +- .github/workflows/build-fork-pr-image.yml | 2 +- .github/workflows/build-pr-image.yml | 4 +- .github/workflows/playwright.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- Cargo.lock | 2 +- Cargo.toml | 6 +- build.rs | 2 +- deploy/build/Dockerfile | 5 +- deploy/build/Dockerfile.aarch64 | 1 - deploy/build/Dockerfile.amd64 | 1 - deploy/build/Dockerfile.profiling.amd64 | 1 - deploy/build/Dockerfile.sccache.aarch64 | 4 +- deploy/build/Dockerfile.sccache.amd64 | 4 +- deploy/build/Dockerfile.tag-debug.aarch64 | 5 +- deploy/build/Dockerfile.tag-debug.amd64 | 5 +- deploy/build/Dockerfile.tag-simd.amd64 | 5 +- deploy/build/Dockerfile.tag.aarch64 | 5 +- deploy/build/Dockerfile.tag.amd64 | 3 +- deploy/build/Dockerfile.tokio-console.amd64 | 1 - deploy/build/buildspec-test.yml | 4 +- rust-toolchain.toml | 2 +- rustfmt.toml | 2 +- src/cipher/mod.rs | 2 +- src/cipher/registry.rs | 2 +- src/cli/basic/cli.rs | 5 +- src/cli/data/export.rs | 4 +- src/cli/data/import.rs | 2 +- src/cli/mod.rs | 2 +- src/common/infra/cluster/mod.rs | 8 +- src/common/infra/cluster/nats.rs | 2 +- src/common/infra/config.rs | 4 +- src/common/infra/mod.rs | 2 +- src/common/infra/ofga.rs | 2 +- src/common/infra/wal.rs | 7 +- src/common/meta/authz.rs | 2 +- src/common/meta/http.rs | 4 +- src/common/meta/maxmind/client.rs | 2 +- src/common/meta/maxmind/mod.rs | 2 +- src/common/meta/middleware_data.rs | 7 +- src/common/meta/mod.rs | 2 +- src/common/meta/organization.rs | 2 +- src/common/meta/saved_view.rs | 2 +- src/common/meta/search.rs | 2 +- src/common/meta/service.rs | 2 +- src/common/meta/service_account.rs | 2 +- src/common/meta/stream.rs | 2 +- src/common/meta/syslog.rs | 2 +- src/common/meta/telemetry.rs | 4 +- src/common/meta/traces.rs | 2 +- src/common/meta/user.rs | 2 +- src/common/migration/dashboards.rs | 2 +- src/common/migration/file_list.rs | 4 +- src/common/migration/meta.rs | 2 +- src/common/migration/mod.rs | 2 +- src/common/migration/pipeline_func.rs | 4 +- src/common/migration/schema.rs | 8 +- src/common/mod.rs | 2 +- src/common/utils/auth.rs | 6 +- src/common/utils/auth_tests.rs | 17 ++- src/common/utils/functions.rs | 4 +- src/common/utils/http.rs | 12 +- src/common/utils/jwt.rs | 18 ++- src/common/utils/mod.rs | 2 +- src/common/utils/redirect_response.rs | 4 +- src/common/utils/stream.rs | 16 ++- src/common/utils/websocket.rs | 6 +- src/common/utils/zo_logger.rs | 4 +- src/config/src/config.rs | 12 +- src/config/src/meta/alerts/alert.rs | 2 +- src/config/src/meta/alerts/mod.rs | 2 +- src/config/src/meta/bitvec.rs | 2 +- src/config/src/meta/dashboards/mod.rs | 2 +- src/config/src/meta/dashboards/reports.rs | 2 +- src/config/src/meta/dashboards/v1/mod.rs | 2 +- src/config/src/meta/dashboards/v2/mod.rs | 2 +- src/config/src/meta/dashboards/v3/mod.rs | 4 +- src/config/src/meta/dashboards/v4/mod.rs | 4 +- src/config/src/meta/dashboards/v5/mod.rs | 4 +- src/config/src/meta/destinations.rs | 2 +- src/config/src/meta/folder.rs | 2 +- src/config/src/meta/function.rs | 2 +- src/config/src/meta/inverted_index.rs | 2 +- src/config/src/meta/logger.rs | 4 +- src/config/src/meta/mod.rs | 2 +- src/config/src/meta/otlp.rs | 2 +- src/config/src/meta/pipeline/components.rs | 2 +- src/config/src/meta/pipeline/mod.rs | 4 +- src/config/src/meta/promql.rs | 2 +- src/config/src/meta/self_reporting/error.rs | 2 +- src/config/src/meta/self_reporting/mod.rs | 2 +- src/config/src/meta/self_reporting/usage.rs | 5 +- src/config/src/meta/short_url.rs | 2 +- src/config/src/meta/sql.rs | 25 ++-- src/config/src/meta/stream.rs | 4 +- src/config/src/meta/timed_annotations.rs | 2 +- src/config/src/meta/websocket.rs | 2 +- src/config/src/utils/async_file.rs | 4 +- src/config/src/utils/base64.rs | 2 +- src/config/src/utils/download_utils.rs | 2 +- src/config/src/utils/file.rs | 10 +- src/config/src/utils/flatten.rs | 2 +- src/config/src/utils/hash/cityhash.rs | 2 +- src/config/src/utils/hash/fnv.rs | 2 +- src/config/src/utils/hash/gxhash.rs | 2 +- src/config/src/utils/hash/mod.rs | 2 +- src/config/src/utils/hash/murmur3.rs | 2 +- src/config/src/utils/inverted_index.rs | 4 +- src/config/src/utils/json.rs | 4 +- src/config/src/utils/md5.rs | 2 +- src/config/src/utils/parquet.rs | 4 +- src/config/src/utils/prom_json_encoder.rs | 4 +- src/config/src/utils/record_batch_ext.rs | 6 +- src/config/src/utils/schema.rs | 2 +- src/config/src/utils/sort.rs | 2 +- src/config/src/utils/sql.rs | 6 +- src/config/src/utils/sysinfo/os.rs | 2 +- src/config/src/utils/tantivy/mod.rs | 2 +- .../utils/tantivy/tokenizer/o2_tokenizer.rs | 2 +- src/config/src/utils/time.rs | 2 +- src/config/src/utils/util.rs | 8 +- src/handler/grpc/auth/mod.rs | 2 +- src/handler/grpc/flight/mod.rs | 6 +- src/handler/grpc/mod.rs | 2 +- src/handler/grpc/request/event.rs | 2 +- src/handler/grpc/request/ingest.rs | 4 +- src/handler/grpc/request/logs.rs | 4 +- src/handler/grpc/request/metrics/ingester.rs | 6 +- src/handler/grpc/request/metrics/mod.rs | 2 +- src/handler/grpc/request/metrics/querier.rs | 4 +- src/handler/grpc/request/mod.rs | 2 +- src/handler/grpc/request/query_cache.rs | 7 +- src/handler/grpc/request/search/mod.rs | 8 +- src/handler/grpc/request/stream.rs | 2 +- src/handler/grpc/request/traces.rs | 4 +- src/handler/http/auth/jwt.rs | 2 +- src/handler/http/auth/mod.rs | 2 +- src/handler/http/auth/script_server.rs | 4 +- src/handler/http/auth/token.rs | 6 +- src/handler/http/auth/validator.rs | 11 +- src/handler/http/mod.rs | 2 +- src/handler/http/models/alerts/mod.rs | 2 +- src/handler/http/models/alerts/requests.rs | 2 +- src/handler/http/models/alerts/responses.rs | 2 +- src/handler/http/models/dashboards.rs | 17 ++- src/handler/http/models/destinations.rs | 2 +- src/handler/http/models/folders.rs | 2 +- src/handler/http/models/mod.rs | 2 +- src/handler/http/request/actions/action.rs | 26 ++-- .../http/request/actions/operations.rs | 6 +- src/handler/http/request/alerts/deprecated.rs | 12 +- .../http/request/alerts/destinations.rs | 4 +- src/handler/http/request/alerts/mod.rs | 6 +- src/handler/http/request/alerts/templates.rs | 4 +- src/handler/http/request/authz/fga.rs | 4 +- src/handler/http/request/authz/mod.rs | 2 +- src/handler/http/request/clusters/mod.rs | 4 +- src/handler/http/request/dashboards/mod.rs | 38 ++++-- .../http/request/dashboards/reports.rs | 9 +- .../request/dashboards/timed_annotations.rs | 4 +- .../http/request/enrichment_table/mod.rs | 4 +- src/handler/http/request/folders.rs | 4 +- src/handler/http/request/functions/mod.rs | 4 +- src/handler/http/request/keys/mod.rs | 10 +- src/handler/http/request/kv/mod.rs | 4 +- src/handler/http/request/logs/ingest.rs | 2 +- src/handler/http/request/logs/mod.rs | 2 +- src/handler/http/request/metrics/ingest.rs | 4 +- src/handler/http/request/metrics/mod.rs | 2 +- src/handler/http/request/mod.rs | 2 +- src/handler/http/request/organization/es.rs | 4 +- src/handler/http/request/organization/mod.rs | 2 +- src/handler/http/request/organization/org.rs | 10 +- .../http/request/organization/settings.rs | 4 +- src/handler/http/request/pipeline.rs | 4 +- src/handler/http/request/promql/mod.rs | 10 +- src/handler/http/request/rum/ingest.rs | 8 +- src/handler/http/request/rum/mod.rs | 2 +- src/handler/http/request/script_server/mod.rs | 4 +- src/handler/http/request/search/mod.rs | 15 +-- .../http/request/search/multi_streams.rs | 7 +- .../http/request/search/query_manager.rs | 2 +- src/handler/http/request/search/saved_view.rs | 6 +- src/handler/http/request/search/search_job.rs | 4 +- src/handler/http/request/search/utils.rs | 4 +- .../http/request/service_accounts/mod.rs | 6 +- src/handler/http/request/short_url/mod.rs | 4 +- src/handler/http/request/status/mod.rs | 8 +- src/handler/http/request/stream/mod.rs | 2 +- src/handler/http/request/syslog/mod.rs | 4 +- src/handler/http/request/traces/mod.rs | 6 +- src/handler/http/request/users/mod.rs | 13 +- .../http/request/users/service_accounts.rs | 17 ++- src/handler/http/request/websocket/mod.rs | 4 +- src/handler/http/request/websocket/search.rs | 20 ++-- src/handler/http/request/websocket/session.rs | 4 +- src/handler/http/request/websocket/utils.rs | 6 +- .../router/middlewares/check_keep_alive.rs | 2 +- src/handler/http/router/middlewares/mod.rs | 2 +- .../http/router/middlewares/slow_log.rs | 4 +- src/handler/http/router/mod.rs | 11 +- src/handler/http/router/openapi.rs | 4 +- src/handler/http/router/ui.rs | 4 +- src/handler/mod.rs | 2 +- src/handler/tcp_udp/mod.rs | 2 +- src/infra/src/cache/file_data/disk.rs | 5 +- src/infra/src/cache/file_data/memory.rs | 7 +- src/infra/src/cache/file_data/mod.rs | 2 +- src/infra/src/cache/meta.rs | 2 +- src/infra/src/cache/mod.rs | 2 +- src/infra/src/cache/stats.rs | 4 +- src/infra/src/cache/storage.rs | 8 +- src/infra/src/cache/tmpfs.rs | 2 +- .../src/cluster_coordinator/destinations.rs | 2 +- src/infra/src/cluster_coordinator/mod.rs | 2 +- .../src/cluster_coordinator/pipelines.rs | 2 +- src/infra/src/db/etcd.rs | 6 +- src/infra/src/db/mod.rs | 4 +- src/infra/src/db/mysql.rs | 4 +- src/infra/src/db/nats.rs | 12 +- src/infra/src/db/postgres.rs | 4 +- src/infra/src/db/sqlite.rs | 6 +- src/infra/src/errors/grpc.rs | 2 +- src/infra/src/errors/mod.rs | 2 +- src/infra/src/file_list/mysql.rs | 4 +- src/infra/src/file_list/postgres.rs | 4 +- src/infra/src/file_list/sqlite.rs | 4 +- src/infra/src/local_lock.rs | 2 +- src/infra/src/pipeline/mod.rs | 4 +- src/infra/src/pipeline/mysql.rs | 4 +- src/infra/src/pipeline/postgres.rs | 4 +- src/infra/src/pipeline/sqlite.rs | 4 +- src/infra/src/queue/mod.rs | 2 +- src/infra/src/scheduler/mod.rs | 2 +- src/infra/src/scheduler/mysql.rs | 9 +- src/infra/src/scheduler/postgres.rs | 9 +- src/infra/src/scheduler/sqlite.rs | 9 +- src/infra/src/schema/history/mod.rs | 2 +- src/infra/src/schema/history/mysql.rs | 4 +- src/infra/src/schema/history/postgres.rs | 4 +- src/infra/src/schema/history/sqlite.rs | 4 +- src/infra/src/schema/mod.rs | 5 +- src/infra/src/storage/local.rs | 10 +- src/infra/src/storage/mod.rs | 2 +- src/infra/src/storage/remote.rs | 8 +- src/infra/src/table/action_scripts.rs | 4 +- src/infra/src/table/alerts/intermediate.rs | 2 +- src/infra/src/table/alerts/mod.rs | 6 +- src/infra/src/table/cipher.rs | 8 +- src/infra/src/table/dashboards.rs | 16 +-- src/infra/src/table/destinations.rs | 4 +- src/infra/src/table/distinct_values.rs | 8 +- src/infra/src/table/folders.rs | 4 +- .../m20241114_000001_create_folders_table.rs | 2 +- ...m20241115_150000_populate_folders_table.rs | 2 +- .../m20241116_000001_delete_metas.rs | 2 +- ...6_000002_drop_folders_created_at_column.rs | 2 +- ...20241119_000001_create_dashboards_table.rs | 2 +- ...241119_000002_populate_dashboards_table.rs | 2 +- .../m20241119_000003_delete_metas.rs | 2 +- .../m20241209_120000_create_alerts_table.rs | 2 +- .../m20241215_190333_delete_metas.rs | 2 +- ...20241217_154900_alter_folders_table_idx.rs | 2 +- .../m20241217_155000_populate_alerts_table.rs | 2 +- ...0109_092400_recreate_tables_with_ksuids.rs | 4 +- ...13_144600_create_unique_folder_name_idx.rs | 2 +- .../m20250121_120000_create_cipher_table.rs | 2 +- ...250125_102300_create_destinations_table.rs | 2 +- ...m20250125_115400_create_templates_table.rs | 2 +- ...0250125_132500_populate_templates_table.rs | 2 +- ...0125_133700_populate_destinations_table.rs | 2 +- ...250125_153005_delete_metas_destinations.rs | 2 +- ...m20250125_172300_delete_metas_templates.rs | 2 +- ...0250213_000001_add_dashboard_updated_at.rs | 2 +- src/infra/src/table/migration/mod.rs | 2 +- src/infra/src/table/mod.rs | 4 +- src/infra/src/table/search_job/common.rs | 2 +- src/infra/src/table/search_job/mod.rs | 2 +- .../table/search_job/search_job_partitions.rs | 6 +- .../table/search_job/search_job_results.rs | 4 +- src/infra/src/table/search_job/search_jobs.rs | 8 +- src/infra/src/table/search_queue.rs | 4 +- src/infra/src/table/short_urls.rs | 8 +- src/infra/src/table/templates.rs | 4 +- .../src/table/timed_annotation_panels.rs | 4 +- src/infra/src/table/timed_annotations.rs | 12 +- src/ingester/bin/wal-reader.rs | 4 +- src/ingester/src/entry.rs | 2 +- src/ingester/src/immutable.rs | 4 +- src/ingester/src/lib.rs | 4 +- src/ingester/src/memtable.rs | 6 +- src/ingester/src/partition.rs | 2 +- src/ingester/src/rwmap.rs | 2 +- src/ingester/src/stream.rs | 4 +- src/ingester/src/wal.rs | 8 +- src/ingester/src/writer.rs | 13 +- src/job/compactor.rs | 4 +- src/job/files/broadcast.rs | 2 +- src/job/files/idx.rs | 11 +- src/job/files/mod.rs | 6 +- src/job/files/parquet.rs | 15 ++- src/job/flatten_compactor.rs | 4 +- src/job/metrics.rs | 9 +- src/job/mmdb_downloader.rs | 2 +- src/job/promql_self_consume.rs | 6 +- src/job/syslog_server.rs | 4 +- src/main.rs | 16 +-- src/proto/build.rs | 2 +- src/proto/src/generated/mod.rs | 2 +- src/proto/src/lib.rs | 2 +- src/report_server/src/report.rs | 10 +- src/report_server/src/router.rs | 4 +- src/report_server/src/server.rs | 4 +- src/router/grpc/ingest/logs.rs | 8 +- src/router/grpc/ingest/metrics.rs | 6 +- src/router/grpc/ingest/mod.rs | 2 +- src/router/grpc/ingest/traces.rs | 6 +- src/router/grpc/mod.rs | 2 +- src/router/http/mod.rs | 11 +- src/router/http/ws.rs | 4 +- src/router/mod.rs | 2 +- src/service/alerts/alert.rs | 15 +-- src/service/alerts/derived_streams.rs | 4 +- src/service/alerts/destinations.rs | 2 +- src/service/alerts/mod.rs | 10 +- src/service/alerts/scheduler/handlers.rs | 19 ++- src/service/alerts/scheduler/worker.rs | 4 +- src/service/alerts/templates.rs | 2 +- src/service/circuit_breaker.rs | 2 +- src/service/compact/deleted.rs | 2 +- src/service/compact/flatten.rs | 8 +- src/service/compact/merge.rs | 14 ++- src/service/compact/mod.rs | 4 +- src/service/compact/retention.rs | 4 +- src/service/dashboards/mod.rs | 4 +- src/service/dashboards/reports.rs | 11 +- src/service/dashboards/timed_annotations.rs | 2 +- src/service/db/alerts/alert.rs | 2 +- src/service/db/alerts/destinations.rs | 10 +- src/service/db/alerts/mod.rs | 2 +- src/service/db/alerts/realtime_triggers.rs | 2 +- src/service/db/alerts/templates.rs | 6 +- src/service/db/compact/downsampling.rs | 4 +- src/service/db/compact/file_list.rs | 2 +- src/service/db/compact/files.rs | 4 +- src/service/db/compact/mod.rs | 2 +- src/service/db/compact/organization.rs | 2 +- src/service/db/compact/retention.rs | 4 +- src/service/db/dashboards/mod.rs | 2 +- src/service/db/distinct_values.rs | 2 +- src/service/db/enrichment_table.rs | 2 +- src/service/db/file_list/broadcast.rs | 6 +- src/service/db/file_list/mod.rs | 4 +- src/service/db/instance.rs | 2 +- src/service/db/keys.rs | 28 ++++- src/service/db/mod.rs | 4 +- src/service/db/pipeline.rs | 12 +- src/service/db/saved_view.rs | 2 +- src/service/db/scheduler.rs | 2 +- src/service/db/schema.rs | 4 +- src/service/db/search_job/mod.rs | 2 +- .../db/search_job/search_job_partitions.rs | 2 +- .../db/search_job/search_job_results.rs | 2 +- src/service/db/search_job/search_jobs.rs | 2 +- src/service/db/short_url.rs | 4 +- src/service/db/version.rs | 2 +- src/service/enrichment/mod.rs | 2 +- src/service/enrichment_table/geoip.rs | 6 +- src/service/enrichment_table/mod.rs | 8 +- src/service/exporter/mod.rs | 2 +- src/service/exporter/otlp_metrics_exporter.rs | 4 +- src/service/folders.rs | 4 +- src/service/functions.rs | 17 ++- src/service/grpc.rs | 12 +- src/service/ingestion/grpc.rs | 4 +- src/service/ingestion/ingestion_service.rs | 4 +- src/service/ingestion/mod.rs | 8 +- src/service/logs/bulk.rs | 3 +- src/service/logs/ingest.rs | 4 +- src/service/logs/mod.rs | 14 +-- src/service/logs/otlp_grpc.rs | 7 +- src/service/logs/otlp_http.rs | 5 +- src/service/logs/syslog.rs | 5 +- src/service/metadata/distinct_values.rs | 7 +- src/service/metadata/mod.rs | 2 +- src/service/metadata/trace_list_index.rs | 7 +- src/service/metrics/json.rs | 10 +- src/service/metrics/mod.rs | 4 +- src/service/metrics/otlp.rs | 10 +- src/service/metrics/prom.rs | 6 +- src/service/pipeline/batch_execution.rs | 18 +-- src/service/pipeline/mod.rs | 10 +- src/service/promql/aggregations/bottomk.rs | 2 +- .../promql/aggregations/count_values.rs | 2 +- src/service/promql/aggregations/max.rs | 6 +- src/service/promql/aggregations/min.rs | 6 +- src/service/promql/aggregations/mod.rs | 4 +- src/service/promql/aggregations/quantile.rs | 2 +- src/service/promql/aggregations/topk.rs | 2 +- .../promql/binaries/vector_operations.rs | 4 +- src/service/promql/engine.rs | 23 ++-- src/service/promql/exec.rs | 4 +- src/service/promql/functions/delta.rs | 2 +- src/service/promql/functions/histogram.rs | 2 +- src/service/promql/functions/increase.rs | 2 +- src/service/promql/functions/rate.rs | 2 +- src/service/promql/search/cache/mod.rs | 6 +- src/service/promql/search/grpc/mod.rs | 4 +- src/service/promql/search/grpc/storage.rs | 15 ++- src/service/promql/search/grpc/wal.rs | 5 +- src/service/promql/search/mod.rs | 11 +- src/service/promql/utils.rs | 4 +- src/service/promql/value.rs | 4 +- src/service/schema.rs | 6 +- src/service/search/cache/cacher.rs | 13 +- src/service/search/cache/mod.rs | 9 +- src/service/search/cache/multi.rs | 4 +- src/service/search/cache/result_utils.rs | 2 +- src/service/search/cluster/cache_multi.rs | 6 +- src/service/search/cluster/cacher.rs | 6 +- src/service/search/cluster/flight.rs | 17 +-- src/service/search/cluster/mod.rs | 2 +- .../datafusion/distributed_plan/codec.rs | 4 +- .../datafusion/distributed_plan/empty_exec.rs | 6 +- .../search/datafusion/distributed_plan/mod.rs | 2 +- .../distributed_plan/remote_scan.rs | 10 +- .../datafusion/distributed_plan/rewrite.rs | 4 +- .../distributed_plan/streaming_aggs_exec.rs | 4 +- src/service/search/datafusion/exec.rs | 5 +- src/service/search/datafusion/mod.rs | 2 +- .../optimizer/add_sort_and_limit.rs | 4 +- .../datafusion/optimizer/add_timestamp.rs | 48 ++++---- .../search/datafusion/optimizer/cipher.rs | 34 +++--- .../datafusion/optimizer/join_reorder.rs | 12 +- .../optimizer/limit_join_right_side.rs | 112 +++++++++--------- .../search/datafusion/optimizer/mod.rs | 4 +- .../datafusion/optimizer/rewrite_histogram.rs | 11 +- .../datafusion/optimizer/rewrite_match.rs | 49 ++++---- .../search/datafusion/optimizer/utils.rs | 4 +- .../search/datafusion/plan/deduplication.rs | 2 +- .../datafusion/plan/deduplication_exec.rs | 6 +- src/service/search/datafusion/plan/mod.rs | 2 +- .../datafusion/plan/tantivy_count_exec.rs | 8 +- .../datafusion/planner/extension_planner.rs | 6 +- src/service/search/datafusion/planner/mod.rs | 2 +- .../search/datafusion/storage/file_list.rs | 2 +- .../storage/file_statistics_cache.rs | 6 +- .../search/datafusion/storage/memory.rs | 8 +- src/service/search/datafusion/storage/mod.rs | 2 +- .../search/datafusion/storage/tmpfs.rs | 8 +- src/service/search/datafusion/storage/wal.rs | 8 +- .../datafusion/table_provider/catalog.rs | 2 +- .../datafusion/table_provider/empty_table.rs | 4 +- .../datafusion/table_provider/helpers.rs | 11 +- .../datafusion/table_provider/memtable.rs | 2 +- .../search/datafusion/table_provider/mod.rs | 22 ++-- .../datafusion/table_provider/uniontable.rs | 4 +- src/service/search/datafusion/udaf/mod.rs | 2 +- .../search/datafusion/udaf/percentile_cont.rs | 10 +- .../datafusion/udf/arr_descending_udf.rs | 2 +- .../search/datafusion/udf/arrcount_udf.rs | 2 +- .../search/datafusion/udf/arrindex_udf.rs | 2 +- .../search/datafusion/udf/arrjoin_udf.rs | 2 +- .../search/datafusion/udf/arrsort_udf.rs | 2 +- .../search/datafusion/udf/arrzip_udf.rs | 2 +- .../search/datafusion/udf/cast_to_arr_udf.rs | 2 +- .../search/datafusion/udf/cipher_udf.rs | 14 ++- .../search/datafusion/udf/date_format_udf.rs | 2 +- .../search/datafusion/udf/fuzzy_match_udf.rs | 2 +- .../search/datafusion/udf/histogram_udf.rs | 2 +- .../search/datafusion/udf/match_all_udf.rs | 2 +- .../datafusion/udf/regexp_matches_udf.rs | 4 +- .../search/datafusion/udf/regexp_udf.rs | 8 +- .../search/datafusion/udf/spath_udf.rs | 2 +- .../search/datafusion/udf/str_match_udf.rs | 4 +- .../datafusion/udf/string_to_array_v2_udf.rs | 2 +- .../search/datafusion/udf/time_range_udf.rs | 2 +- .../datafusion/udf/to_arr_string_udf.rs | 2 +- .../search/datafusion/udf/transform_udf.rs | 4 +- src/service/search/grpc/flight.rs | 2 +- src/service/search/grpc/storage.rs | 18 +-- src/service/search/grpc/wal.rs | 2 +- src/service/search/grpc_search.rs | 4 +- src/service/search/index.rs | 6 +- src/service/search/mod.rs | 3 +- src/service/search/sql.rs | 15 ++- src/service/search/super_cluster/follower.rs | 4 +- src/service/search/super_cluster/leader.rs | 8 +- src/service/search/super_cluster/mod.rs | 2 +- src/service/search/tantivy/mod.rs | 2 +- src/service/search/tantivy/puffin/mod.rs | 2 +- src/service/search/tantivy/puffin/reader.rs | 4 +- src/service/search/tantivy/puffin/writer.rs | 6 +- .../puffin_directory/caching_directory.rs | 6 +- .../tantivy/puffin_directory/footer_cache.rs | 6 +- .../search/tantivy/puffin_directory/mod.rs | 2 +- .../search/tantivy/puffin_directory/reader.rs | 8 +- .../tantivy/puffin_directory/reader_cache.rs | 2 +- .../search/tantivy/puffin_directory/writer.rs | 8 +- src/service/search/utils.rs | 2 +- src/service/self_reporting/ingestion.rs | 6 +- src/service/self_reporting/mod.rs | 5 +- src/service/self_reporting/queues.rs | 13 +- src/service/stream.rs | 12 +- src/service/syslogs_route.rs | 2 +- src/service/tls/mod.rs | 2 +- src/service/traces/mod.rs | 20 ++-- src/service/users.rs | 2 +- src/super_cluster_queue/alerts.rs | 2 +- src/super_cluster_queue/mod.rs | 2 +- src/wal/benches/write.rs | 4 +- src/wal/src/lib.rs | 2 +- src/wal/src/reader.rs | 6 +- src/wal/src/writer.rs | 6 +- src/wal/tests/wal.rs | 4 +- tests/integration_test.rs | 16 +-- .../ingestion/metrics/CloudWatchMetrics.vue | 2 +- 518 files changed, 1428 insertions(+), 1337 deletions(-) diff --git a/.github/workflows/api-testing.yml b/.github/workflows/api-testing.yml index b5b0f973a4..7db6745662 100644 --- a/.github/workflows/api-testing.yml +++ b/.github/workflows/api-testing.yml @@ -35,7 +35,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 - name: Setup Rust Cache uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/build-fork-pr-image.yml b/.github/workflows/build-fork-pr-image.yml index 7e2fe7192c..ff0195b8fd 100644 --- a/.github/workflows/build-fork-pr-image.yml +++ b/.github/workflows/build-fork-pr-image.yml @@ -53,7 +53,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/build-pr-image.yml b/.github/workflows/build-pr-image.yml index fa47557ff7..c52d1cfad1 100644 --- a/.github/workflows/build-pr-image.yml +++ b/.github/workflows/build-pr-image.yml @@ -36,7 +36,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 - uses: Swatinem/rust-cache@v2 with: @@ -123,7 +123,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index e14e5ea67f..d6396d8e42 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -54,7 +54,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 targets: x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30d21cbdbb..35c1812206 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: - "v*.*.*" name: Release env: - RUST_TOOLCHAIN: nightly-2024-10-24 + RUST_TOOLCHAIN: nightly-2025-03-02 jobs: build: name: Build binary diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1978b45abc..9960be7e7c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Rust Toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-10-24 + toolchain: nightly-2025-03-02 targets: x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@v2 with: diff --git a/Cargo.lock b/Cargo.lock index 9fd252bcdd..2281213ccd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6163,7 +6163,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openobserve" -version = "0.14.3" +version = "0.14.5" dependencies = [ "actix", "actix-cors", diff --git a/Cargo.toml b/Cargo.toml index f1a08e9456..aa5078b1b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] description = "OpenObserve is an observability platform that allows you to capture, search, and analyze your logs, metrics, and traces." -edition = "2021" +edition = "2024" homepage = "https://openobserve.ai/" keywords = [ "search", @@ -17,7 +17,7 @@ keywords = [ license = "AGPL-3.0-only" name = "openobserve" repository = "https://github.com/openobserve/openobserve/" -version = "0.14.3" +version = "0.14.5" publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -204,7 +204,7 @@ resolver = "2" [workspace.package] version = "0.1.0" -edition = "2021" +edition = "2024" license = "AGPL-3.0" [workspace.dependencies] diff --git a/build.rs b/build.rs index 0c53b87d83..a0e8461098 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/deploy/build/Dockerfile b/deploy/build/Dockerfile index 8415e25558..ce65af9a08 100644 --- a/deploy/build/Dockerfile +++ b/deploy/build/Dockerfile @@ -6,11 +6,10 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder -# RUN rustup toolchain install nightly-2024-10-24 -# RUN rustup default nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 +# RUN rustup default nightly-2025-03-02 # RUN rustup target add x86_64-unknown-linux-gnu # RUN diff -u <(rustc --print cfg) <(rustc -C target-cpu=native --print cfg) RUN rustc --version && sccache --version diff --git a/deploy/build/Dockerfile.aarch64 b/deploy/build/Dockerfile.aarch64 index f542649599..86cc97c1f8 100644 --- a/deploy/build/Dockerfile.aarch64 +++ b/deploy/build/Dockerfile.aarch64 @@ -6,7 +6,6 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder ARG AWS_DEFAULT_REGION ARG AWS_CONTAINER_CREDENTIALS_RELATIVE_URI diff --git a/deploy/build/Dockerfile.amd64 b/deploy/build/Dockerfile.amd64 index e4ca6f30c8..5e04af61bb 100644 --- a/deploy/build/Dockerfile.amd64 +++ b/deploy/build/Dockerfile.amd64 @@ -6,7 +6,6 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder ARG AWS_DEFAULT_REGION ARG AWS_CONTAINER_CREDENTIALS_RELATIVE_URI diff --git a/deploy/build/Dockerfile.profiling.amd64 b/deploy/build/Dockerfile.profiling.amd64 index cddbfeea04..a0c505d888 100644 --- a/deploy/build/Dockerfile.profiling.amd64 +++ b/deploy/build/Dockerfile.profiling.amd64 @@ -6,7 +6,6 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder ARG AWS_DEFAULT_REGION ARG AWS_CONTAINER_CREDENTIALS_RELATIVE_URI diff --git a/deploy/build/Dockerfile.sccache.aarch64 b/deploy/build/Dockerfile.sccache.aarch64 index 87c7471bb0..a638601b88 100644 --- a/deploy/build/Dockerfile.sccache.aarch64 +++ b/deploy/build/Dockerfile.sccache.aarch64 @@ -1,7 +1,7 @@ FROM public.ecr.aws/docker/library/rust:bookworm -RUN rustup toolchain install nightly-2024-10-24 -RUN rustup default nightly-2024-10-24 +RUN rustup toolchain install nightly-2025-03-02 +RUN rustup default nightly-2025-03-02 RUN rustup target add aarch64-unknown-linux-gnu RUN rustup component add rustfmt clippy llvm-tools RUN cargo install --locked sccache diff --git a/deploy/build/Dockerfile.sccache.amd64 b/deploy/build/Dockerfile.sccache.amd64 index f7f40dde52..f51ea5bde4 100644 --- a/deploy/build/Dockerfile.sccache.amd64 +++ b/deploy/build/Dockerfile.sccache.amd64 @@ -1,7 +1,7 @@ FROM public.ecr.aws/docker/library/rust:bookworm -RUN rustup toolchain install nightly-2024-10-24 -RUN rustup default nightly-2024-10-24 +RUN rustup toolchain install nightly-2025-03-02 +RUN rustup default nightly-2025-03-02 RUN rustup target add x86_64-unknown-linux-gnu RUN rustup component add rustfmt clippy llvm-tools RUN cargo install --locked sccache diff --git a/deploy/build/Dockerfile.tag-debug.aarch64 b/deploy/build/Dockerfile.tag-debug.aarch64 index 97be988606..fe2dc16c62 100644 --- a/deploy/build/Dockerfile.tag-debug.aarch64 +++ b/deploy/build/Dockerfile.tag-debug.aarch64 @@ -6,14 +6,13 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder # RUN apt-get update # RUN apt-get install -y protobuf-compiler # RUN apt-get install -y cmake curl -# RUN rustup toolchain install nightly-2024-10-24 -# RUN rustup default nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 +# RUN rustup default nightly-2025-03-02 # RUN rustup target add aarch64-unknown-linux-gnu WORKDIR /openobserve diff --git a/deploy/build/Dockerfile.tag-debug.amd64 b/deploy/build/Dockerfile.tag-debug.amd64 index 20b65198ca..95e7821e13 100644 --- a/deploy/build/Dockerfile.tag-debug.amd64 +++ b/deploy/build/Dockerfile.tag-debug.amd64 @@ -6,14 +6,13 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder # RUN apt-get update # RUN apt-get install -y protobuf-compiler # RUN apt-get install -y cmake curl -# RUN rustup toolchain install nightly-2024-10-24 -# RUN rustup default nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 +# RUN rustup default nightly-2025-03-02 # RUN rustup target add x86_64-unknown-linux-gnu WORKDIR /openobserve diff --git a/deploy/build/Dockerfile.tag-simd.amd64 b/deploy/build/Dockerfile.tag-simd.amd64 index 292fdddd76..23dd64c389 100644 --- a/deploy/build/Dockerfile.tag-simd.amd64 +++ b/deploy/build/Dockerfile.tag-simd.amd64 @@ -6,14 +6,13 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder # RUN apt-get update # RUN apt-get install -y protobuf-compiler # RUN apt-get install -y cmake curl -# RUN rustup toolchain install nightly-2024-10-24 -# RUN rustup default nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 +# RUN rustup default nightly-2025-03-02 # RUN rustup target add x86_64-unknown-linux-gnu WORKDIR /openobserve diff --git a/deploy/build/Dockerfile.tag.aarch64 b/deploy/build/Dockerfile.tag.aarch64 index b52361d07e..9dd708ea87 100644 --- a/deploy/build/Dockerfile.tag.aarch64 +++ b/deploy/build/Dockerfile.tag.aarch64 @@ -6,14 +6,13 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder # RUN apt-get update # RUN apt-get install -y protobuf-compiler # RUN apt-get install -y cmake curl -# RUN rustup toolchain install nightly-2024-10-24 -# RUN rustup default nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 +# RUN rustup default nightly-2025-03-02 # RUN rustup target add aarch64-unknown-linux-gnu WORKDIR /openobserve diff --git a/deploy/build/Dockerfile.tag.amd64 b/deploy/build/Dockerfile.tag.amd64 index d546793abe..c9404fd04e 100644 --- a/deploy/build/Dockerfile.tag.amd64 +++ b/deploy/build/Dockerfile.tag.amd64 @@ -6,13 +6,12 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder # RUN apt-get update # RUN apt-get install -y protobuf-compiler # RUN apt-get install -y cmake curl -# RUN rustup toolchain install nightly-2024-10-24 +# RUN rustup toolchain install nightly-2025-03-02 # RUN rustup default nightly-2024-07-07 # RUN rustup target add x86_64-unknown-linux-gnu diff --git a/deploy/build/Dockerfile.tokio-console.amd64 b/deploy/build/Dockerfile.tokio-console.amd64 index 940425c534..c460cf900f 100644 --- a/deploy/build/Dockerfile.tokio-console.amd64 +++ b/deploy/build/Dockerfile.tokio-console.amd64 @@ -6,7 +6,6 @@ COPY ./web /web/ RUN npm install RUN NODE_OPTIONS="--max-old-space-size=8192" npm run build -# FROM public.ecr.aws/docker/library/rust:bookworm as builder FROM public.ecr.aws/zinclabs/rust:bookworm-sccache AS builder ARG AWS_DEFAULT_REGION ARG AWS_CONTAINER_CREDENTIALS_RELATIVE_URI diff --git a/deploy/build/buildspec-test.yml b/deploy/build/buildspec-test.yml index dbdaeb53bc..218f21e95f 100644 --- a/deploy/build/buildspec-test.yml +++ b/deploy/build/buildspec-test.yml @@ -10,9 +10,9 @@ phases: - unzip protoc-21.12-linux-x86_64.zip -d protoc && cp protoc/bin/protoc /usr/local/bin/ && cp -r protoc/include/google /usr/local/include/ - curl https://sh.rustup.rs -sSf | sh -s -- -y - . "$HOME/.cargo/env" - - rustup toolchain install nightly-2024-10-24 + - rustup toolchain install nightly-2025-03-02 - rustup toolchain list - - rustup default nightly-2024-10-24 + - rustup default nightly-2025-03-02 - rustup component add clippy llvm-tools - export RUSTFLAGS='-C target-cpu=native' - rm -rf ~/.cargo/registry diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 556b25a934..40f4a82abc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-10-24" +channel = "nightly-2025-03-02" components = ["rustfmt", "clippy", "llvm-tools"] diff --git a/rustfmt.toml b/rustfmt.toml index 184e940b5b..c959231acb 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1,4 @@ -style_edition = "2021" +style_edition = "2024" unstable_features = true comment_width = 120 diff --git a/src/cipher/mod.rs b/src/cipher/mod.rs index cfa5027b2e..b987d346d0 100644 --- a/src/cipher/mod.rs +++ b/src/cipher/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/cipher/registry.rs b/src/cipher/registry.rs index faa6a15fc2..09b561dd1e 100644 --- a/src/cipher/registry.rs +++ b/src/cipher/registry.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/cli/basic/cli.rs b/src/cli/basic/cli.rs index 5af2cce28f..ca2c13fc2b 100644 --- a/src/cli/basic/cli.rs +++ b/src/cli/basic/cli.rs @@ -18,8 +18,9 @@ use infra::{file_list as infra_file_list, table}; use crate::{ cli::data::{ - cli::{args as dataArgs, Cli as dataCli}, - export, import, Context, + Context, + cli::{Cli as dataCli, args as dataArgs}, + export, import, }, common::{infra::config::USERS, meta, migration}, service::{compact, db, file_list, users}, diff --git a/src/cli/data/export.rs b/src/cli/data/export.rs index 381f63c878..7793958cbb 100644 --- a/src/cli/data/export.rs +++ b/src/cli/data/export.rs @@ -17,10 +17,10 @@ use std::{collections::HashMap, fs, path::Path}; use actix_web::web::Query; use async_trait::async_trait; -use config::{meta::search, TIMESTAMP_COL_NAME}; +use config::{TIMESTAMP_COL_NAME, meta::search}; use crate::{ - cli::data::{cli::Cli, Context}, + cli::data::{Context, cli::Cli}, common::utils::http::{ get_search_event_context_from_request, get_search_type_from_request, get_stream_type_from_request, diff --git a/src/cli/data/import.rs b/src/cli/data/import.rs index 53005a4054..32617f9d24 100644 --- a/src/cli/data/import.rs +++ b/src/cli/data/import.rs @@ -20,7 +20,7 @@ use async_trait::async_trait; use bytes::Bytes; use crate::{ - cli::data::{cli::Cli, Context}, + cli::data::{Context, cli::Cli}, common::meta::ingestion::IngestionRequest, service::logs, }; diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 7a82b3c39d..94d9444a89 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/infra/cluster/mod.rs b/src/common/infra/cluster/mod.rs index 014dcd87b1..32a2677962 100644 --- a/src/common/infra/cluster/mod.rs +++ b/src/common/infra/cluster/mod.rs @@ -17,11 +17,12 @@ use std::{ cmp::min, collections::HashMap, ops::Bound, - sync::{atomic::Ordering, Arc}, + sync::{Arc, atomic::Ordering}, time::Duration, }; use config::{ + RwAHashMap, RwBTreeMap, cluster::*, get_config, meta::{ @@ -31,12 +32,11 @@ use config::{ utils::{ hash::Sum64, json, - sysinfo::{get_node_metrics, NodeMetrics}, + sysinfo::{NodeMetrics, get_node_metrics}, }, - RwAHashMap, RwBTreeMap, }; use infra::{ - db::{get_coordinator, Event}, + db::{Event, get_coordinator}, errors::Result, }; use once_cell::sync::Lazy; diff --git a/src/common/infra/cluster/nats.rs b/src/common/infra/cluster/nats.rs index 51ceab3df3..4c6ccf3be2 100644 --- a/src/common/infra/cluster/nats.rs +++ b/src/common/infra/cluster/nats.rs @@ -23,7 +23,7 @@ use config::{ utils::json, }; use infra::{ - db::{get_coordinator, NEED_WATCH}, + db::{NEED_WATCH, get_coordinator}, dist_lock, errors::{Error, Result}, }; diff --git a/src/common/infra/config.rs b/src/common/infra/config.rs index 67e54471f9..5b011924c5 100644 --- a/src/common/infra/config.rs +++ b/src/common/infra/config.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,6 +16,7 @@ use std::sync::Arc; use config::{ + RwAHashMap, RwHashMap, meta::{ alerts::alert::Alert, dashboards::reports, @@ -24,7 +25,6 @@ use config::{ promql::ClusterLeader, stream::StreamParams, }, - RwAHashMap, RwHashMap, }; use dashmap::DashMap; use hashbrown::HashMap; diff --git a/src/common/infra/mod.rs b/src/common/infra/mod.rs index 2792906df7..84d52644b6 100644 --- a/src/common/infra/mod.rs +++ b/src/common/infra/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/infra/ofga.rs b/src/common/infra/ofga.rs index 763f1bd64b..a1aec9b688 100644 --- a/src/common/infra/ofga.rs +++ b/src/common/infra/ofga.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/infra/wal.rs b/src/common/infra/wal.rs index 89a6bf24ec..720bf56968 100644 --- a/src/common/infra/wal.rs +++ b/src/common/infra/wal.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,16 +17,15 @@ use std::{path::Path, sync::Arc}; use chrono::{DateTime, Datelike, TimeZone, Utc}; use config::{ - get_config, ider, + FILE_EXT_JSON, get_config, ider, meta::stream::{PartitionTimeLevel, StreamParams, StreamType}, metrics, utils::async_file::get_file_contents, - FILE_EXT_JSON, }; use hashbrown::HashMap; use once_cell::sync::Lazy; use tokio::{ - fs::{create_dir_all, File, OpenOptions}, + fs::{File, OpenOptions, create_dir_all}, io::AsyncWriteExt, sync::RwLock, }; diff --git a/src/common/meta/authz.rs b/src/common/meta/authz.rs index a22cbe6eb5..3c7c5db567 100644 --- a/src/common/meta/authz.rs +++ b/src/common/meta/authz.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/http.rs b/src/common/meta/http.rs index 4de3b3611c..dc3777e7ee 100644 --- a/src/common/meta/http.rs +++ b/src/common/meta/http.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use actix_web::{http::StatusCode, HttpResponse as ActixHttpResponse}; +use actix_web::{HttpResponse as ActixHttpResponse, http::StatusCode}; use infra::errors; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; diff --git a/src/common/meta/maxmind/client.rs b/src/common/meta/maxmind/client.rs index acb5531cf6..32974585a4 100644 --- a/src/common/meta/maxmind/client.rs +++ b/src/common/meta/maxmind/client.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/maxmind/mod.rs b/src/common/meta/maxmind/mod.rs index 67afb72238..d71709b12b 100644 --- a/src/common/meta/maxmind/mod.rs +++ b/src/common/meta/maxmind/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/middleware_data.rs b/src/common/meta/middleware_data.rs index 675f7cb191..6c6c513d78 100644 --- a/src/common/meta/middleware_data.rs +++ b/src/common/meta/middleware_data.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,9 +16,10 @@ use std::{collections::HashMap, net::IpAddr, sync::Arc}; use actix_web::{ + Error as ActixErr, HttpMessage, body::MessageBody, dev::{ServiceRequest, ServiceResponse}, - web, Error as ActixErr, HttpMessage, + web, }; use actix_web_lab::middleware::Next; use maxminddb::geoip2::city::Location; @@ -27,8 +28,8 @@ use serde::{Deserialize, Serialize}; use uaparser::{Parser, UserAgentParser}; use crate::{ - common::{infra::config::MAXMIND_DB_CLIENT, utils::http::parse_ip_addr}, USER_AGENT_REGEX_FILE, + common::{infra::config::MAXMIND_DB_CLIENT, utils::http::parse_ip_addr}, }; #[derive(Serialize, Deserialize, Clone, Debug, Default)] diff --git a/src/common/meta/mod.rs b/src/common/meta/mod.rs index ac7e4cecf4..0e4d2f056c 100644 --- a/src/common/meta/mod.rs +++ b/src/common/meta/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/organization.rs b/src/common/meta/organization.rs index b29ec4a217..b0e67b9448 100644 --- a/src/common/meta/organization.rs +++ b/src/common/meta/organization.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/saved_view.rs b/src/common/meta/saved_view.rs index 304a51235a..cd83948477 100644 --- a/src/common/meta/saved_view.rs +++ b/src/common/meta/saved_view.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/search.rs b/src/common/meta/search.rs index fc0ca2723f..e296fd14a8 100644 --- a/src/common/meta/search.rs +++ b/src/common/meta/search.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/service.rs b/src/common/meta/service.rs index 4cfad1d930..8ceed60482 100644 --- a/src/common/meta/service.rs +++ b/src/common/meta/service.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/service_account.rs b/src/common/meta/service_account.rs index 2ac7378eaa..ef1f0364d2 100644 --- a/src/common/meta/service_account.rs +++ b/src/common/meta/service_account.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/stream.rs b/src/common/meta/stream.rs index 097ae058d1..7b6425eef3 100644 --- a/src/common/meta/stream.rs +++ b/src/common/meta/stream.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/syslog.rs b/src/common/meta/syslog.rs index 027f02a34b..0b3b8f9536 100644 --- a/src/common/meta/syslog.rs +++ b/src/common/meta/syslog.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/telemetry.rs b/src/common/meta/telemetry.rs index 943da1d830..a03711f745 100644 --- a/src/common/meta/telemetry.rs +++ b/src/common/meta/telemetry.rs @@ -16,14 +16,14 @@ use std::collections::HashMap; use config::{ + SIZE_IN_MB, TELEMETRY_CLIENT, cluster::LOCAL_NODE, get_config, get_instance_id, utils::{json, sysinfo}, - SIZE_IN_MB, TELEMETRY_CLIENT, }; use hashbrown::HashSet; use infra::{cache::stats, db as infra_db, schema::STREAM_SCHEMAS_LATEST}; -use segment::{message::Track, Client, Message}; +use segment::{Client, Message, message::Track}; use crate::common::infra::{cluster::get_cached_online_nodes, config::*}; diff --git a/src/common/meta/traces.rs b/src/common/meta/traces.rs index 20675e22b6..ed99307cae 100644 --- a/src/common/meta/traces.rs +++ b/src/common/meta/traces.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/meta/user.rs b/src/common/meta/user.rs index bf3aaf7e76..95773b4712 100644 --- a/src/common/meta/user.rs +++ b/src/common/meta/user.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/migration/dashboards.rs b/src/common/migration/dashboards.rs index 85f781a8c6..5cad02299b 100644 --- a/src/common/migration/dashboards.rs +++ b/src/common/migration/dashboards.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/migration/file_list.rs b/src/common/migration/file_list.rs index 4e28cd8396..c099054777 100644 --- a/src/common/migration/file_list.rs +++ b/src/common/migration/file_list.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use config::{ get_config, - meta::stream::{FileKey, PartitionTimeLevel, ALL_STREAM_TYPES}, + meta::stream::{ALL_STREAM_TYPES, FileKey, PartitionTimeLevel}, utils::time::BASE_TIME, }; use infra::file_list as infra_file_list; diff --git a/src/common/migration/meta.rs b/src/common/migration/meta.rs index 59f762c3b0..e088dc17e4 100644 --- a/src/common/migration/meta.rs +++ b/src/common/migration/meta.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/migration/mod.rs b/src/common/migration/mod.rs index 0c35c9458a..0873b33567 100644 --- a/src/common/migration/mod.rs +++ b/src/common/migration/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/migration/pipeline_func.rs b/src/common/migration/pipeline_func.rs index 63e6b1e695..8bfa7a4dcd 100644 --- a/src/common/migration/pipeline_func.rs +++ b/src/common/migration/pipeline_func.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,11 +20,11 @@ use config::{ meta::{ function, pipeline::{ + Pipeline, components::{ ConditionParams, DerivedStream, Edge, FunctionParams, Node, NodeData, PipelineSource, }, - Pipeline, }, stream::{StreamParams, StreamType}, }, diff --git a/src/common/migration/schema.rs b/src/common/migration/schema.rs index f8d4757d05..d5599d3b16 100644 --- a/src/common/migration/schema.rs +++ b/src/common/migration/schema.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -238,11 +238,7 @@ async fn upgrade_schema_row_per_version() -> Result { std::result::Result::Ok(val) => { let val_str = std::str::from_utf8(&val).unwrap(); let val = val_str.parse::().unwrap_or(0); - if val > 0 { - Ok(false) - } else { - Ok(true) - } + if val > 0 { Ok(false) } else { Ok(true) } } Err(_) => Ok(true), } diff --git a/src/common/mod.rs b/src/common/mod.rs index 25e970fa3e..2bb02c46a3 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/utils/auth.rs b/src/common/utils/auth.rs index 8f187fc2eb..c93e395e48 100644 --- a/src/common/utils/auth.rs +++ b/src/common/utils/auth.rs @@ -15,11 +15,11 @@ use std::fmt::Debug; -use actix_web::{dev::Payload, Error, FromRequest, HttpRequest}; -use argon2::{password_hash::SaltString, Algorithm, Argon2, Params, PasswordHasher, Version}; +use actix_web::{Error, FromRequest, HttpRequest, dev::Payload}; +use argon2::{Algorithm, Argon2, Params, PasswordHasher, Version, password_hash::SaltString}; use base64::Engine; use config::utils::json; -use futures::future::{ready, Ready}; +use futures::future::{Ready, ready}; #[cfg(feature = "enterprise")] use o2_openfga::config::get_config as get_openfga_config; #[cfg(feature = "enterprise")] diff --git a/src/common/utils/auth_tests.rs b/src/common/utils/auth_tests.rs index b1bd423d28..0a879e7858 100644 --- a/src/common/utils/auth_tests.rs +++ b/src/common/utils/auth_tests.rs @@ -1,8 +1,23 @@ +// Copyright 2025 OpenObserve Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + #[cfg(feature = "enterprise")] #[cfg(test)] mod tests { use actix_http::Method; - use actix_web::{test, FromRequest}; + use actix_web::{FromRequest, test}; use o2_openfga::meta::mapping::OFGA_MODELS; use super::super::auth::AuthExtractor; diff --git a/src/common/utils/functions.rs b/src/common/utils/functions.rs index 3aa6918200..b6588fefcc 100644 --- a/src/common/utils/functions.rs +++ b/src/common/utils/functions.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::collections::HashMap; use config::{ - meta::function::VRLCompilerConfig, GEO_IP_ASN_ENRICHMENT_TABLE, GEO_IP_CITY_ENRICHMENT_TABLE, + GEO_IP_ASN_ENRICHMENT_TABLE, GEO_IP_CITY_ENRICHMENT_TABLE, meta::function::VRLCompilerConfig, }; use vector_enrichment::{Table, TableRegistry}; diff --git a/src/common/utils/http.rs b/src/common/utils/http.rs index 81e6947acc..48f3c119a2 100644 --- a/src/common/utils/http.rs +++ b/src/common/utils/http.rs @@ -232,10 +232,12 @@ mod tests { .map(|ip_addr| parse_ip_addr(ip_addr).unwrap().0) .collect(); - assert!(parsed_addresses - .iter() - .zip(valid_addresses) - .map(|(parsed, original)| original.contains(parsed.to_string().as_str())) - .fold(true, |acc, x| { acc | x })); + assert!( + parsed_addresses + .iter() + .zip(valid_addresses) + .map(|(parsed, original)| original.contains(parsed.to_string().as_str())) + .fold(true, |acc, x| { acc | x }) + ); } } diff --git a/src/common/utils/jwt.rs b/src/common/utils/jwt.rs index bd30c0d004..b896a21e4e 100644 --- a/src/common/utils/jwt.rs +++ b/src/common/utils/jwt.rs @@ -1,9 +1,23 @@ +// Copyright 2025 OpenObserve Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + #[cfg(feature = "enterprise")] use { jsonwebtoken::{ - decode, decode_header, + Algorithm, DecodingKey, TokenData, Validation, decode, decode_header, jwk::{self, AlgorithmParameters}, - Algorithm, DecodingKey, TokenData, Validation, }, serde_json::Value, std::{collections::HashMap, str::FromStr}, diff --git a/src/common/utils/mod.rs b/src/common/utils/mod.rs index 17b03f0628..de306b473e 100644 --- a/src/common/utils/mod.rs +++ b/src/common/utils/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/common/utils/redirect_response.rs b/src/common/utils/redirect_response.rs index b153b723a8..854e70c658 100644 --- a/src/common/utils/redirect_response.rs +++ b/src/common/utils/redirect_response.rs @@ -16,8 +16,8 @@ use std::{collections::HashMap, fmt}; use actix_web::{ - http::header::{ContentType, LOCATION}, HttpResponse, ResponseError, + http::header::{ContentType, LOCATION}, }; const DEFAULT_REDIRECT_RELATIVE_URI: &str = "/web/"; @@ -134,7 +134,7 @@ impl Default for RedirectResponseBuilder { #[cfg(test)] mod tests { - use actix_web::{http::header::LOCATION, HttpResponse}; + use actix_web::{HttpResponse, http::header::LOCATION}; use super::*; diff --git a/src/common/utils/stream.rs b/src/common/utils/stream.rs index 5509b0a96f..4eb71940af 100644 --- a/src/common/utils/stream.rs +++ b/src/common/utils/stream.rs @@ -18,9 +18,8 @@ use std::io::{Error, ErrorKind}; use actix_web::HttpResponse; use arrow::array::{Int64Array, RecordBatch}; use config::{ - get_config, + FILE_EXT_JSON, TIMESTAMP_COL_NAME, get_config, meta::stream::{FileMeta, StreamType}, - FILE_EXT_JSON, TIMESTAMP_COL_NAME, }; use crate::{ @@ -131,7 +130,10 @@ pub async fn get_settings_max_query_range( } pub fn get_max_query_range_if_sa(stream_max_query_range: i64, user: &User) -> i64 { - log::debug!("get_max_query_range_if_sa stream_max_query_range: {stream_max_query_range}, user_role: {:?}", user.role); + log::debug!( + "get_max_query_range_if_sa stream_max_query_range: {stream_max_query_range}, user_role: {:?}", + user.role + ); if user.role == UserRole::ServiceAccount { let max_query_range_sa = get_config().limit.max_query_range_for_sa; return if max_query_range_sa > 0 { @@ -199,9 +201,11 @@ mod tests { #[test] fn test_get_file_name_v1() { let file_key = get_file_name_v1("nexus", "Olympics", 2); - assert!(file_key - .as_str() - .ends_with("/wal/nexus/logs/Olympics/Olympics_2.json")); + assert!( + file_key + .as_str() + .ends_with("/wal/nexus/logs/Olympics/Olympics_2.json") + ); } #[test] diff --git a/src/common/utils/websocket.rs b/src/common/utils/websocket.rs index c54e8fbfee..e761c49325 100644 --- a/src/common/utils/websocket.rs +++ b/src/common/utils/websocket.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -21,7 +21,7 @@ use config::meta::{ }; use infra::errors::Error; use sqlparser::{ - ast::{visit_statements_mut, Expr, FunctionArguments, Statement}, + ast::{Expr, FunctionArguments, Statement, visit_statements_mut}, dialect::PostgreSqlDialect, parser::Parser, }; @@ -77,7 +77,7 @@ pub(crate) fn update_histogram_interval_in_query( .unwrap(); visit_statements_mut(&mut statement, |stmt| { - if let Statement::Query(ref mut query) = stmt { + if let Statement::Query(query) = stmt { if let sqlparser::ast::SetExpr::Select(select) = query.body.as_mut() { for projection in &mut select.projection { match projection { diff --git a/src/common/utils/zo_logger.rs b/src/common/utils/zo_logger.rs index 492d4c67da..85bdf80d8e 100644 --- a/src/common/utils/zo_logger.rs +++ b/src/common/utils/zo_logger.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ use config::{get_config, ider, utils::json}; use log::{Metadata, Record}; use once_cell::sync::Lazy; use reqwest::Client; -use tokio::sync::{broadcast, RwLock}; +use tokio::sync::{RwLock, broadcast}; pub static EVENT_SENDER: Lazy> = Lazy::new(|| { let (tx, _) = broadcast::channel(1024); diff --git a/src/config/src/config.rs b/src/config/src/config.rs index f9d2558051..e51ee1be80 100644 --- a/src/config/src/config.rs +++ b/src/config/src/config.rs @@ -15,20 +15,20 @@ use std::{cmp::max, collections::BTreeMap, path::Path, sync::Arc, time::Duration}; -use aes_siv::{siv::Aes256Siv, KeyInit}; +use aes_siv::{KeyInit, siv::Aes256Siv}; use arc_swap::ArcSwap; -use base64::{prelude::BASE64_STANDARD, Engine}; +use base64::{Engine, prelude::BASE64_STANDARD}; use chromiumoxide::{browser::BrowserConfig, handler::viewport::Viewport}; use dotenv_config::EnvConfig; use dotenvy::dotenv_override; use hashbrown::{HashMap, HashSet}; use itertools::chain; use lettre::{ + AsyncSmtpTransport, Tokio1Executor, transport::smtp::{ authentication::Credentials, client::{Tls, TlsParameters}, }, - AsyncSmtpTransport, Tokio1Executor, }; use once_cell::sync::Lazy; @@ -2045,7 +2045,9 @@ fn check_grpc_config(cfg: &mut Config) -> Result<(), anyhow::Error> { || cfg.grpc.tls_cert_path.is_empty() || cfg.grpc.tls_key_path.is_empty()) { - return Err(anyhow::anyhow!("ZO_GRPC_TLS_CERT_DOMAIN, ZO_GRPC_TLS_CERT_PATH and ZO_GRPC_TLS_KEY_PATH must be set when ZO_GRPC_TLS_ENABLED is true")); + return Err(anyhow::anyhow!( + "ZO_GRPC_TLS_CERT_DOMAIN, ZO_GRPC_TLS_CERT_PATH and ZO_GRPC_TLS_KEY_PATH must be set when ZO_GRPC_TLS_ENABLED is true" + )); } Ok(()) } @@ -2449,7 +2451,7 @@ fn check_s3_config(cfg: &mut Config) -> Result<(), anyhow::Error> { } cfg.s3.provider = cfg.s3.provider.to_lowercase(); if cfg.s3.provider.eq("swift") { - std::env::set_var("AWS_EC2_METADATA_DISABLED", "true"); + unsafe { std::env::set_var("AWS_EC2_METADATA_DISABLED", "true") }; } if cfg.s3.keepalive_timeout == 0 { diff --git a/src/config/src/meta/alerts/alert.rs b/src/config/src/meta/alerts/alert.rs index e48479e743..3e126d84e1 100644 --- a/src/config/src/meta/alerts/alert.rs +++ b/src/config/src/meta/alerts/alert.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/alerts/mod.rs b/src/config/src/meta/alerts/mod.rs index 324bac5f70..546329e320 100644 --- a/src/config/src/meta/alerts/mod.rs +++ b/src/config/src/meta/alerts/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/bitvec.rs b/src/config/src/meta/bitvec.rs index 9f389950d2..b616a8cc8e 100644 --- a/src/config/src/meta/bitvec.rs +++ b/src/config/src/meta/bitvec.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/dashboards/mod.rs b/src/config/src/meta/dashboards/mod.rs index d0d4610b39..59b0164047 100644 --- a/src/config/src/meta/dashboards/mod.rs +++ b/src/config/src/meta/dashboards/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/dashboards/reports.rs b/src/config/src/meta/dashboards/reports.rs index cf262accbe..c4b953fd7c 100644 --- a/src/config/src/meta/dashboards/reports.rs +++ b/src/config/src/meta/dashboards/reports.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/dashboards/v1/mod.rs b/src/config/src/meta/dashboards/v1/mod.rs index 28fa865968..bba83b44c0 100644 --- a/src/config/src/meta/dashboards/v1/mod.rs +++ b/src/config/src/meta/dashboards/v1/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/dashboards/v2/mod.rs b/src/config/src/meta/dashboards/v2/mod.rs index d75cfb0d46..a0707b9233 100644 --- a/src/config/src/meta/dashboards/v2/mod.rs +++ b/src/config/src/meta/dashboards/v2/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/dashboards/v3/mod.rs b/src/config/src/meta/dashboards/v3/mod.rs index 69c78e47d1..c65b86405f 100644 --- a/src/config/src/meta/dashboards/v3/mod.rs +++ b/src/config/src/meta/dashboards/v3/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; -use super::{datetime_now, OrdF64}; +use super::{OrdF64, datetime_now}; use crate::meta::stream::StreamType; #[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize, ToSchema)] diff --git a/src/config/src/meta/dashboards/v4/mod.rs b/src/config/src/meta/dashboards/v4/mod.rs index 97d2691019..71c0c9da82 100644 --- a/src/config/src/meta/dashboards/v4/mod.rs +++ b/src/config/src/meta/dashboards/v4/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; -use super::{datetime_now, OrdF64}; +use super::{OrdF64, datetime_now}; use crate::meta::stream::StreamType; #[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize, ToSchema)] diff --git a/src/config/src/meta/dashboards/v5/mod.rs b/src/config/src/meta/dashboards/v5/mod.rs index 2e72bef99b..567e391842 100644 --- a/src/config/src/meta/dashboards/v5/mod.rs +++ b/src/config/src/meta/dashboards/v5/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; -use super::{datetime_now, OrdF64}; +use super::{OrdF64, datetime_now}; use crate::meta::stream::StreamType; #[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize, ToSchema)] diff --git a/src/config/src/meta/destinations.rs b/src/config/src/meta/destinations.rs index 2a474da33a..e45b16ea5d 100644 --- a/src/config/src/meta/destinations.rs +++ b/src/config/src/meta/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/folder.rs b/src/config/src/meta/folder.rs index 975e5f8742..2b46374790 100644 --- a/src/config/src/meta/folder.rs +++ b/src/config/src/meta/folder.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/function.rs b/src/config/src/meta/function.rs index 5020b66dc8..345ef9b828 100644 --- a/src/config/src/meta/function.rs +++ b/src/config/src/meta/function.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/inverted_index.rs b/src/config/src/meta/inverted_index.rs index 35df26948a..84d07ffb65 100644 --- a/src/config/src/meta/inverted_index.rs +++ b/src/config/src/meta/inverted_index.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/logger.rs b/src/config/src/meta/logger.rs index e1f5f2cde3..b0e13e0ef2 100644 --- a/src/config/src/meta/logger.rs +++ b/src/config/src/meta/logger.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,9 +20,9 @@ use tracing::{Event, Subscriber}; use tracing_log::NormalizeEvent; use tracing_subscriber::{ fmt::{ + FmtContext, FormatEvent, FormatFields, format::{self, Writer}, time::FormatTime, - FmtContext, FormatEvent, FormatFields, }, registry::LookupSpan, }; diff --git a/src/config/src/meta/mod.rs b/src/config/src/meta/mod.rs index 2b9cc9728e..a179a1708f 100644 --- a/src/config/src/meta/mod.rs +++ b/src/config/src/meta/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/otlp.rs b/src/config/src/meta/otlp.rs index 57d5bf81a5..5a27c4e0ad 100644 --- a/src/config/src/meta/otlp.rs +++ b/src/config/src/meta/otlp.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/pipeline/components.rs b/src/config/src/meta/pipeline/components.rs index 3c6fc33dc2..8081b5f4b9 100644 --- a/src/config/src/meta/pipeline/components.rs +++ b/src/config/src/meta/pipeline/components.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/pipeline/mod.rs b/src/config/src/meta/pipeline/mod.rs index 657d835c8b..d8056cb99d 100644 --- a/src/config/src/meta/pipeline/mod.rs +++ b/src/config/src/meta/pipeline/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::collections::{HashMap, HashSet}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use components::{DerivedStream, Edge, Node, NodeData, PipelineSource}; use serde::{Deserialize, Serialize}; use sqlx::{Decode, Error, FromRow, Row, Type}; diff --git a/src/config/src/meta/promql.rs b/src/config/src/meta/promql.rs index fa34c28539..80183ad5b5 100644 --- a/src/config/src/meta/promql.rs +++ b/src/config/src/meta/promql.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/self_reporting/error.rs b/src/config/src/meta/self_reporting/error.rs index afa17e6873..94da7f2513 100644 --- a/src/config/src/meta/self_reporting/error.rs +++ b/src/config/src/meta/self_reporting/error.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/self_reporting/mod.rs b/src/config/src/meta/self_reporting/mod.rs index f7267bac94..e0528b701b 100644 --- a/src/config/src/meta/self_reporting/mod.rs +++ b/src/config/src/meta/self_reporting/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/self_reporting/usage.rs b/src/config/src/meta/self_reporting/usage.rs index 4be28b81f8..446f88f803 100644 --- a/src/config/src/meta/self_reporting/usage.rs +++ b/src/config/src/meta/self_reporting/usage.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,12 +16,11 @@ use serde::{Deserialize, Serialize}; use crate::{ - get_config, + SIZE_IN_MB, get_config, meta::{ search::{SearchEventContext, SearchEventType}, stream::{FileMeta, StreamType}, }, - SIZE_IN_MB, }; pub const USAGE_STREAM: &str = "usage"; diff --git a/src/config/src/meta/short_url.rs b/src/config/src/meta/short_url.rs index a33273cc8b..98d3a6b7f3 100644 --- a/src/config/src/meta/short_url.rs +++ b/src/config/src/meta/short_url.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/sql.rs b/src/config/src/meta/sql.rs index 38abb69120..1824e2276e 100644 --- a/src/config/src/meta/sql.rs +++ b/src/config/src/meta/sql.rs @@ -16,7 +16,7 @@ use chrono::DateTime; use datafusion::{ catalog_common::resolve_table_references, - sql::{parser::DFParser, TableReference}, + sql::{TableReference, parser::DFParser}, }; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -32,7 +32,7 @@ use sqlparser::{ use utoipa::ToSchema; use super::stream::StreamType; -use crate::{get_config, TIMESTAMP_COL_NAME}; +use crate::{TIMESTAMP_COL_NAME, get_config}; pub const MAX_LIMIT: i64 = 100000; pub const MAX_OFFSET: i64 = 100000; @@ -1156,9 +1156,10 @@ mod tests { ("select a, avg(b) FROM tbl where c=1", vec!["a", "b", "c"]), ("select a, a + b FROM tbl where c=1", vec!["a", "b", "c"]), ("select a, b + 1 FROM tbl where c=1", vec!["a", "b", "c"]), - ("select a, (a + b) as d FROM tbl where c=1", vec![ - "a", "b", "c", - ]), + ( + "select a, (a + b) as d FROM tbl where c=1", + vec!["a", "b", "c"], + ), ("select a, COALESCE(b, c) FROM tbl", vec!["a", "b", "c"]), ("select a, COALESCE(b, 'c') FROM tbl", vec!["a", "b"]), ("select a, COALESCE(b, \"c\") FROM tbl", vec!["a", "b", "c"]), @@ -1180,13 +1181,15 @@ mod tests { ("SELECT a FROM tbl WHERE b IS UNKNOWN", vec!["a", "b"]), ("SELECT a FROM tbl WHERE b IS NOT UNKNOWN", vec!["a", "b"]), ("SELECT a FROM tbl WHERE b IN (1, 2, 3)", vec!["a", "b"]), - ("SELECT a FROM tbl WHERE b BETWEEN 10 AND 20", vec![ - "a", "b", - ]), + ( + "SELECT a FROM tbl WHERE b BETWEEN 10 AND 20", + vec!["a", "b"], + ), ("SELECT a FROM tbl WHERE b LIKE '%pattern%'", vec!["a", "b"]), - ("SELECT a FROM tbl WHERE b ILIKE '%pattern%'", vec![ - "a", "b", - ]), + ( + "SELECT a FROM tbl WHERE b ILIKE '%pattern%'", + vec!["a", "b"], + ), ("SELECT CAST(a AS INTEGER) FROM tbl", vec!["a"]), ("SELECT TRY_CAST(a AS INTEGER) FROM tbl", vec!["a"]), ("SELECT a AT TIME ZONE 'UTC' FROM tbl", vec!["a"]), diff --git a/src/config/src/meta/stream.rs b/src/config/src/meta/stream.rs index 2c1550be84..5e5dee2293 100644 --- a/src/config/src/meta/stream.rs +++ b/src/config/src/meta/stream.rs @@ -18,7 +18,7 @@ use std::{cmp::max, fmt::Display}; use chrono::{DateTime, Duration, TimeZone, Utc}; use hashbrown::HashMap; use proto::cluster_rpc; -use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; +use serde::{Deserialize, Serialize, Serializer, ser::SerializeStruct}; use utoipa::ToSchema; use super::bitvec::BitVec; @@ -26,7 +26,7 @@ use crate::{ get_config, meta::self_reporting::usage::Stats, utils::{ - hash::{gxhash, Sum64}, + hash::{Sum64, gxhash}, json::{self, Map, Value}, }, }; diff --git a/src/config/src/meta/timed_annotations.rs b/src/config/src/meta/timed_annotations.rs index 2764010352..9ae463f8fb 100644 --- a/src/config/src/meta/timed_annotations.rs +++ b/src/config/src/meta/timed_annotations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/meta/websocket.rs b/src/config/src/meta/websocket.rs index 354da6660f..e86afedd88 100644 --- a/src/config/src/meta/websocket.rs +++ b/src/config/src/meta/websocket.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/async_file.rs b/src/config/src/utils/async_file.rs index 7946f5fd77..5dc8777f22 100644 --- a/src/config/src/utils/async_file.rs +++ b/src/config/src/utils/async_file.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ use std::{fs::Metadata, ops::Range, path::Path, time::SystemTime}; use async_walkdir::WalkDir; use futures::StreamExt; use tokio::{ - fs::{read_dir, remove_dir, File}, + fs::{File, read_dir, remove_dir}, io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt}, }; diff --git a/src/config/src/utils/base64.rs b/src/config/src/utils/base64.rs index 389402ae09..e5c18d926c 100644 --- a/src/config/src/utils/base64.rs +++ b/src/config/src/utils/base64.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/download_utils.rs b/src/config/src/utils/download_utils.rs index b976db0a24..82ba1b5073 100644 --- a/src/config/src/utils/download_utils.rs +++ b/src/config/src/utils/download_utils.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/file.rs b/src/config/src/utils/file.rs index 77d8f9f0ff..c324883453 100644 --- a/src/config/src/utils/file.rs +++ b/src/config/src/utils/file.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -183,9 +183,11 @@ mod tests { put_file_contents(&file_name, content).unwrap(); assert_eq!(get_file_contents(&file_name, None).unwrap(), content); assert!(get_file_meta(&file_name).unwrap().is_file()); - assert!(!scan_files("./scan_dir/", "parquet", None) - .unwrap() - .is_empty()); + assert!( + !scan_files("./scan_dir/", "parquet", None) + .unwrap() + .is_empty() + ); std::fs::remove_file(&file_name).unwrap(); std::fs::remove_dir(&dir_name).unwrap(); diff --git a/src/config/src/utils/flatten.rs b/src/config/src/utils/flatten.rs index 968c68f39a..3cc940969e 100644 --- a/src/config/src/utils/flatten.rs +++ b/src/config/src/utils/flatten.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/hash/cityhash.rs b/src/config/src/utils/hash/cityhash.rs index 8e5d88f11c..4a491a0781 100644 --- a/src/config/src/utils/hash/cityhash.rs +++ b/src/config/src/utils/hash/cityhash.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/hash/fnv.rs b/src/config/src/utils/hash/fnv.rs index 7a113b8489..b478c2822a 100644 --- a/src/config/src/utils/hash/fnv.rs +++ b/src/config/src/utils/hash/fnv.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/hash/gxhash.rs b/src/config/src/utils/hash/gxhash.rs index 6c56c94666..f51a7d07a0 100644 --- a/src/config/src/utils/hash/gxhash.rs +++ b/src/config/src/utils/hash/gxhash.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/hash/mod.rs b/src/config/src/utils/hash/mod.rs index 5f08519a7c..dbb9c7aaf8 100644 --- a/src/config/src/utils/hash/mod.rs +++ b/src/config/src/utils/hash/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/hash/murmur3.rs b/src/config/src/utils/hash/murmur3.rs index b6f4ba8b07..c5f3d277f7 100644 --- a/src/config/src/utils/hash/murmur3.rs +++ b/src/config/src/utils/hash/murmur3.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/inverted_index.rs b/src/config/src/utils/inverted_index.rs index a114eca3f7..4a98e749b9 100644 --- a/src/config/src/utils/inverted_index.rs +++ b/src/config/src/utils/inverted_index.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ use std::borrow::Cow; use itertools::Itertools; -use crate::{meta::stream::StreamType, FILE_EXT_PARQUET, FILE_EXT_TANTIVY, INDEX_MIN_CHAR_LEN}; +use crate::{FILE_EXT_PARQUET, FILE_EXT_TANTIVY, INDEX_MIN_CHAR_LEN, meta::stream::StreamType}; /// Split a string into tokens based on a delimiter. if delimiter is empty, split by whitespace and /// punctuation. also filter out tokens that are less than INDEX_MIN_CHAR_LEN characters long. diff --git a/src/config/src/utils/json.rs b/src/config/src/utils/json.rs index 23cfdfacf6..c4f0af5ee1 100644 --- a/src/config/src/utils/json.rs +++ b/src/config/src/utils/json.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,7 +14,7 @@ // along with this program. If not, see . pub use serde_json::{ - from_slice, from_str, from_value, json, to_string, to_value, to_vec, Error, Map, Number, Value, + Error, Map, Number, Value, from_slice, from_str, from_value, json, to_string, to_value, to_vec, }; pub fn get_float_value(val: &Value) -> f64 { diff --git a/src/config/src/utils/md5.rs b/src/config/src/utils/md5.rs index 2dc1a6eb7b..8934ddca28 100644 --- a/src/config/src/utils/md5.rs +++ b/src/config/src/utils/md5.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/parquet.rs b/src/config/src/utils/parquet.rs index ac10c9c97e..0c47ccaa97 100644 --- a/src/config/src/utils/parquet.rs +++ b/src/config/src/utils/parquet.rs @@ -25,8 +25,8 @@ use arrow_schema::Schema; use futures::TryStreamExt; use parquet::{ arrow::{ - arrow_reader::ArrowReaderMetadata, async_reader::ParquetRecordBatchStream, - AsyncArrowWriter, ParquetRecordBatchStreamBuilder, + AsyncArrowWriter, ParquetRecordBatchStreamBuilder, arrow_reader::ArrowReaderMetadata, + async_reader::ParquetRecordBatchStream, }, basic::{Compression, Encoding}, file::{metadata::KeyValue, properties::WriterProperties}, diff --git a/src/config/src/utils/prom_json_encoder.rs b/src/config/src/utils/prom_json_encoder.rs index c6e595260b..600d624326 100644 --- a/src/config/src/utils/prom_json_encoder.rs +++ b/src/config/src/utils/prom_json_encoder.rs @@ -6,10 +6,10 @@ use std::io::{self, Write}; use prometheus::{ - proto::{self, MetricFamily, MetricType}, Encoder, Result, + proto::{self, MetricFamily, MetricType}, }; -use serde_json::{json, Map, Value}; +use serde_json::{Map, Value, json}; /// The text format of metric family. pub const TEXT_FORMAT: &str = "text/plain; version=0.0.4"; diff --git a/src/config/src/utils/record_batch_ext.rs b/src/config/src/utils/record_batch_ext.rs index ec2e594800..93d59a4b31 100644 --- a/src/config/src/utils/record_batch_ext.rs +++ b/src/config/src/utils/record_batch_ext.rs @@ -17,9 +17,9 @@ use std::sync::Arc; use arrow::{ array::{ - make_builder, new_null_array, ArrayBuilder, ArrayRef, BinaryBuilder, BooleanArray, - BooleanBuilder, Float64Array, Float64Builder, Int64Array, Int64Builder, NullBuilder, - RecordBatchOptions, StringArray, StringBuilder, UInt64Array, UInt64Builder, + ArrayBuilder, ArrayRef, BinaryBuilder, BooleanArray, BooleanBuilder, Float64Array, + Float64Builder, Int64Array, Int64Builder, NullBuilder, RecordBatchOptions, StringArray, + StringBuilder, UInt64Array, UInt64Builder, make_builder, new_null_array, }, record_batch::RecordBatch, }; diff --git a/src/config/src/utils/schema.rs b/src/config/src/utils/schema.rs index c6b3181a51..adf12a2d93 100644 --- a/src/config/src/utils/schema.rs +++ b/src/config/src/utils/schema.rs @@ -27,8 +27,8 @@ use serde_json::{Map, Value}; use super::str::find; use crate::{ - meta::{promql::HASH_LABEL, stream::StreamType}, FxIndexMap, TIMESTAMP_COL_NAME, + meta::{promql::HASH_LABEL, stream::StreamType}, }; const MAX_PARTITION_KEY_LENGTH: usize = 100; diff --git a/src/config/src/utils/sort.rs b/src/config/src/utils/sort.rs index 51aedbd143..3438ac242a 100644 --- a/src/config/src/utils/sort.rs +++ b/src/config/src/utils/sort.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/sql.rs b/src/config/src/utils/sql.rs index 54be94690c..2bc706ba12 100644 --- a/src/config/src/utils/sql.rs +++ b/src/config/src/utils/sql.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -106,7 +106,7 @@ fn is_aggregate_expression(expr: &Expr) -> bool { || results.iter().any(is_aggregate_expression) || else_result .as_ref() - .map_or(false, |e| is_aggregate_expression(e)) + .is_some_and(|e| is_aggregate_expression(e)) } Expr::Nested(expr) => { // Check nested expressions @@ -151,7 +151,7 @@ fn has_join(query: &Query) -> bool { || select .from .first() - .map_or(false, |table| !table.joins.is_empty()) + .is_some_and(|table| !table.joins.is_empty()) } else { false } diff --git a/src/config/src/utils/sysinfo/os.rs b/src/config/src/utils/sysinfo/os.rs index 23296b07e9..0ad2485ecd 100644 --- a/src/config/src/utils/sysinfo/os.rs +++ b/src/config/src/utils/sysinfo/os.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/tantivy/mod.rs b/src/config/src/utils/tantivy/mod.rs index 3406998363..e13e9459a3 100644 --- a/src/config/src/utils/tantivy/mod.rs +++ b/src/config/src/utils/tantivy/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/tantivy/tokenizer/o2_tokenizer.rs b/src/config/src/utils/tantivy/tokenizer/o2_tokenizer.rs index 5112c56f37..65616d2c4f 100644 --- a/src/config/src/utils/tantivy/tokenizer/o2_tokenizer.rs +++ b/src/config/src/utils/tantivy/tokenizer/o2_tokenizer.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/time.rs b/src/config/src/utils/time.rs index aa15d6db3b..0cbc72b51d 100644 --- a/src/config/src/utils/time.rs +++ b/src/config/src/utils/time.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/config/src/utils/util.rs b/src/config/src/utils/util.rs index 8d06235684..dbc81072bd 100644 --- a/src/config/src/utils/util.rs +++ b/src/config/src/utils/util.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,11 +17,7 @@ pub fn zero_or(v: T, def: T) -> T where T: PartialEq + Default, { - if v == Default::default() { - def - } else { - v - } + if v == Default::default() { def } else { v } } #[cfg(test)] diff --git a/src/handler/grpc/auth/mod.rs b/src/handler/grpc/auth/mod.rs index d8be5e014d..41d0a2c413 100644 --- a/src/handler/grpc/auth/mod.rs +++ b/src/handler/grpc/auth/mod.rs @@ -15,7 +15,7 @@ use config::meta::cluster::get_internal_grpc_token; use http_auth_basic::Credentials; -use tonic::{metadata::MetadataValue, Request, Status}; +use tonic::{Request, Status, metadata::MetadataValue}; use crate::common::{ infra::config::{ROOT_USER, USERS}, diff --git a/src/handler/grpc/flight/mod.rs b/src/handler/grpc/flight/mod.rs index 68c6dbc999..8178dc3e10 100644 --- a/src/handler/grpc/flight/mod.rs +++ b/src/handler/grpc/flight/mod.rs @@ -21,12 +21,12 @@ use std::{ use arrow::{ array::RecordBatch, - ipc::{writer::IpcWriteOptions, CompressionType}, + ipc::{CompressionType, writer::IpcWriteOptions}, }; use arrow_flight::{ - encode::FlightDataEncoderBuilder, error::FlightError, flight_service_server::FlightService, Action, ActionType, Criteria, Empty, FlightData, FlightDescriptor, FlightInfo, HandshakeRequest, HandshakeResponse, PollInfo, PutResult, SchemaResult, Ticket, + encode::FlightDataEncoderBuilder, error::FlightError, flight_service_server::FlightService, }; use arrow_schema::Schema; use config::{meta::search::ScanStats, metrics}; @@ -35,7 +35,7 @@ use datafusion::{ execution::SendableRecordBatchStream, physical_plan::{displayable, execute_stream}, }; -use futures::{stream::BoxStream, Stream, StreamExt, TryStreamExt}; +use futures::{Stream, StreamExt, TryStreamExt, stream::BoxStream}; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::search::TaskStatus; use prost::Message; diff --git a/src/handler/grpc/mod.rs b/src/handler/grpc/mod.rs index ec6bf7376f..964820e30c 100644 --- a/src/handler/grpc/mod.rs +++ b/src/handler/grpc/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/grpc/request/event.rs b/src/handler/grpc/request/event.rs index 2a75a0ccbf..05d07b02d4 100644 --- a/src/handler/grpc/request/event.rs +++ b/src/handler/grpc/request/event.rs @@ -24,7 +24,7 @@ use config::{ utils::inverted_index::convert_parquet_idx_file_name_to_tantivy_file, }; use opentelemetry::global; -use proto::cluster_rpc::{event_server::Event, EmptyResponse, FileList}; +use proto::cluster_rpc::{EmptyResponse, FileList, event_server::Event}; use tonic::{Request, Response, Status}; use tracing_opentelemetry::OpenTelemetrySpanExt; diff --git a/src/handler/grpc/request/ingest.rs b/src/handler/grpc/request/ingest.rs index 30c2a46e26..d2ef0e557c 100644 --- a/src/handler/grpc/request/ingest.rs +++ b/src/handler/grpc/request/ingest.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ use config::{ utils::json, }; use proto::cluster_rpc::{ - ingest_server::Ingest, IngestionRequest, IngestionResponse, IngestionType, + IngestionRequest, IngestionResponse, IngestionType, ingest_server::Ingest, }; use tonic::{Request, Response, Status}; diff --git a/src/handler/grpc/request/logs.rs b/src/handler/grpc/request/logs.rs index 66bd90165e..29c35cb6d6 100644 --- a/src/handler/grpc/request/logs.rs +++ b/src/handler/grpc/request/logs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use config::metrics; use opentelemetry_proto::tonic::collector::logs::v1::{ - logs_service_server::LogsService, ExportLogsServiceRequest, ExportLogsServiceResponse, + ExportLogsServiceRequest, ExportLogsServiceResponse, logs_service_server::LogsService, }; use tonic::{Response, Status}; diff --git a/src/handler/grpc/request/metrics/ingester.rs b/src/handler/grpc/request/metrics/ingester.rs index 14496bc613..6cdf8702a3 100644 --- a/src/handler/grpc/request/metrics/ingester.rs +++ b/src/handler/grpc/request/metrics/ingester.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,8 +15,8 @@ use config::{meta::otlp::OtlpRequestType, metrics}; use opentelemetry_proto::tonic::collector::metrics::v1::{ - metrics_service_server::MetricsService, ExportMetricsServiceRequest, - ExportMetricsServiceResponse, + ExportMetricsServiceRequest, ExportMetricsServiceResponse, + metrics_service_server::MetricsService, }; use tonic::{Response, Status}; diff --git a/src/handler/grpc/request/metrics/mod.rs b/src/handler/grpc/request/metrics/mod.rs index 6a0ae130c1..fea260aee4 100644 --- a/src/handler/grpc/request/metrics/mod.rs +++ b/src/handler/grpc/request/metrics/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/grpc/request/metrics/querier.rs b/src/handler/grpc/request/metrics/querier.rs index ddd72f64e4..98d476beda 100644 --- a/src/handler/grpc/request/metrics/querier.rs +++ b/src/handler/grpc/request/metrics/querier.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -21,8 +21,8 @@ use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::{ handler::grpc::{ - cluster_rpc::{metrics_server::Metrics, MetricsQueryRequest, MetricsQueryResponse}, MetadataMap, + cluster_rpc::{MetricsQueryRequest, MetricsQueryResponse, metrics_server::Metrics}, }, service::promql::search as SearchService, }; diff --git a/src/handler/grpc/request/mod.rs b/src/handler/grpc/request/mod.rs index af7ab6414d..3cd56e08c8 100644 --- a/src/handler/grpc/request/mod.rs +++ b/src/handler/grpc/request/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/grpc/request/query_cache.rs b/src/handler/grpc/request/query_cache.rs index 2566e94a99..1b8adf4135 100644 --- a/src/handler/grpc/request/query_cache.rs +++ b/src/handler/grpc/request/query_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,8 +14,9 @@ // along with this program. If not, see . use proto::cluster_rpc::{ - query_cache_server::QueryCache, DeleteResultCacheRequest, DeleteResultCacheResponse, - MultiQueryCacheResponse, QueryCacheRequest, QueryCacheRes, QueryCacheResponse, QueryResponse, + DeleteResultCacheRequest, DeleteResultCacheResponse, MultiQueryCacheResponse, + QueryCacheRequest, QueryCacheRes, QueryCacheResponse, QueryResponse, + query_cache_server::QueryCache, }; use tonic::{Request, Response, Status}; diff --git a/src/handler/grpc/request/search/mod.rs b/src/handler/grpc/request/search/mod.rs index 586f9129cf..4488d40158 100644 --- a/src/handler/grpc/request/search/mod.rs +++ b/src/handler/grpc/request/search/mod.rs @@ -22,10 +22,10 @@ use config::{ #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::search::{QueryManager, TaskStatus, WorkGroup}; use proto::cluster_rpc::{ - search_server::Search, CancelQueryRequest, CancelQueryResponse, DeleteResultRequest, - DeleteResultResponse, GetResultRequest, GetResultResponse, QueryStatusRequest, - QueryStatusResponse, SearchPartitionRequest, SearchPartitionResponse, SearchRequest, - SearchResponse, + CancelQueryRequest, CancelQueryResponse, DeleteResultRequest, DeleteResultResponse, + GetResultRequest, GetResultResponse, QueryStatusRequest, QueryStatusResponse, + SearchPartitionRequest, SearchPartitionResponse, SearchRequest, SearchResponse, + search_server::Search, }; use tonic::{Request, Response, Status}; diff --git a/src/handler/grpc/request/stream.rs b/src/handler/grpc/request/stream.rs index a23a9d10c1..9c7ab92e48 100644 --- a/src/handler/grpc/request/stream.rs +++ b/src/handler/grpc/request/stream.rs @@ -16,7 +16,7 @@ use config::meta::stream::StreamType; use futures_util::future::try_join_all; use proto::cluster_rpc::{ - streams_server::Streams, StreamStats, StreamStatsEntry, StreamStatsRequest, StreamStatsResponse, + StreamStats, StreamStatsEntry, StreamStatsRequest, StreamStatsResponse, streams_server::Streams, }; use tonic::{Request, Response, Status}; diff --git a/src/handler/grpc/request/traces.rs b/src/handler/grpc/request/traces.rs index ad3e25a8a1..bc4b3a04f4 100644 --- a/src/handler/grpc/request/traces.rs +++ b/src/handler/grpc/request/traces.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use config::{meta::otlp::OtlpRequestType, metrics}; use opentelemetry_proto::tonic::collector::trace::v1::{ - trace_service_server::TraceService, ExportTraceServiceRequest, ExportTraceServiceResponse, + ExportTraceServiceRequest, ExportTraceServiceResponse, trace_service_server::TraceService, }; use tonic::{Response, Status}; diff --git a/src/handler/http/auth/jwt.rs b/src/handler/http/auth/jwt.rs index b7d92d639b..bd594207d1 100644 --- a/src/handler/http/auth/jwt.rs +++ b/src/handler/http/auth/jwt.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/auth/mod.rs b/src/handler/http/auth/mod.rs index 436a53471a..959531ea21 100644 --- a/src/handler/http/auth/mod.rs +++ b/src/handler/http/auth/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/auth/script_server.rs b/src/handler/http/auth/script_server.rs index 3415139201..ad978398c7 100644 --- a/src/handler/http/auth/script_server.rs +++ b/src/handler/http/auth/script_server.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use actix_web::{dev::ServiceRequest, Error}; +use actix_web::{Error, dev::ServiceRequest}; use actix_web_httpauth::extractors::basic::BasicAuth; use config::get_config; diff --git a/src/handler/http/auth/token.rs b/src/handler/http/auth/token.rs index 988ce058ce..63b0bd1aaa 100644 --- a/src/handler/http/auth/token.rs +++ b/src/handler/http/auth/token.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,11 +13,11 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use actix_web::{dev::ServiceRequest, Error}; +use actix_web::{Error, dev::ServiceRequest}; #[cfg(feature = "enterprise")] use actix_web::{ error::ErrorUnauthorized, - http::{header, Method}, + http::{Method, header}, }; #[cfg(feature = "enterprise")] use o2_dex::{config::get_config as get_dex_config, service::auth::get_dex_jwks}; diff --git a/src/handler/http/auth/validator.rs b/src/handler/http/auth/validator.rs index 686943a8a6..c1a8fa20b7 100644 --- a/src/handler/http/auth/validator.rs +++ b/src/handler/http/auth/validator.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,10 +14,11 @@ // along with this program. If not, see . use actix_web::{ + Error, dev::ServiceRequest, error::{ErrorForbidden, ErrorUnauthorized}, - http::{header, Method}, - web, Error, + http::{Method, header}, + web, }; use config::{get_config, utils::base64}; #[cfg(feature = "enterprise")] @@ -35,7 +36,7 @@ use crate::{ }, }, utils::{ - auth::{get_hash, is_root_user, AuthExtractor}, + auth::{AuthExtractor, get_hash, is_root_user}, redirect_response::RedirectResponseBuilder, }, }, @@ -850,7 +851,7 @@ fn extract_relative_path(full_path: &str, path_prefix: &str) -> String { fn is_short_url_path(path_columns: &[&str]) -> bool { path_columns .get(1) - .map_or(false, |&segment| segment.to_lowercase() == "short") + .is_some_and(|&segment| segment.to_lowercase() == "short") } /// Handles authentication failure by logging the error and returning a redirect response. diff --git a/src/handler/http/mod.rs b/src/handler/http/mod.rs index bf61021d4c..2aabd2582c 100644 --- a/src/handler/http/mod.rs +++ b/src/handler/http/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/alerts/mod.rs b/src/handler/http/models/alerts/mod.rs index 089ccb6c8c..ccdb5c51db 100644 --- a/src/handler/http/models/alerts/mod.rs +++ b/src/handler/http/models/alerts/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/alerts/requests.rs b/src/handler/http/models/alerts/requests.rs index 41dd185047..25ff02672e 100644 --- a/src/handler/http/models/alerts/requests.rs +++ b/src/handler/http/models/alerts/requests.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/alerts/responses.rs b/src/handler/http/models/alerts/responses.rs index 7b7688d766..d9a306cb5c 100644 --- a/src/handler/http/models/alerts/responses.rs +++ b/src/handler/http/models/alerts/responses.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/dashboards.rs b/src/handler/http/models/dashboards.rs index 33794ba322..faffaf927d 100644 --- a/src/handler/http/models/dashboards.rs +++ b/src/handler/http/models/dashboards.rs @@ -1,6 +1,21 @@ +// Copyright 2025 OpenObserve Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + use chrono::{DateTime, FixedOffset, Utc}; use config::meta::{ - dashboards::{v1, v2, v3, v4, v5, Dashboard as MetaDashboard}, + dashboards::{Dashboard as MetaDashboard, v1, v2, v3, v4, v5}, folder::Folder as MetaFolder, }; use serde::{Deserialize, Serialize}; diff --git a/src/handler/http/models/destinations.rs b/src/handler/http/models/destinations.rs index 84a3ab7d60..5626968bfe 100644 --- a/src/handler/http/models/destinations.rs +++ b/src/handler/http/models/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/folders.rs b/src/handler/http/models/folders.rs index 20fec91346..7ab630364d 100644 --- a/src/handler/http/models/folders.rs +++ b/src/handler/http/models/folders.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/models/mod.rs b/src/handler/http/models/mod.rs index 7f7495b8ee..9d99e0713b 100644 --- a/src/handler/http/models/mod.rs +++ b/src/handler/http/models/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/actions/action.rs b/src/handler/http/request/actions/action.rs index 93a19573a4..6081ed737a 100644 --- a/src/handler/http/request/actions/action.rs +++ b/src/handler/http/request/actions/action.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::{collections::HashMap, io::Error, str::FromStr}; use actix_multipart::Multipart; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use bytes::Bytes; use config::meta::actions::action::{Action, ExecutionDetailsType, UpdateActionDetailsRequest}; use futures::{StreamExt, TryStreamExt}; @@ -34,7 +34,7 @@ use svix_ksuid::Ksuid; use crate::{ common::{ meta::{authz::Authz, http::HttpResponse as MetaHttpResponse}, - utils::auth::{check_permissions, remove_ownership, set_ownership, UserEmail}, + utils::auth::{UserEmail, check_permissions, remove_ownership, set_ownership}, }, handler::http::models::action::{GetActionDetailsResponse, GetActionInfoResponse}, service::organization::get_passcode, @@ -304,7 +304,7 @@ pub async fn upload_zipped_action( Err(_) => { return Ok( HttpResponse::BadRequest().body("Failed to read description field") - ) + ); } } } @@ -340,7 +340,7 @@ pub async fn upload_zipped_action( Err(_) => { return Ok( HttpResponse::BadRequest().body("Failed to read filename field") - ) + ); } } } @@ -363,7 +363,7 @@ pub async fn upload_zipped_action( match chunk { Ok(bytes) => name.extend_from_slice(&bytes), Err(_) => { - return Ok(HttpResponse::BadRequest().body("Failed to read name field")) + return Ok(HttpResponse::BadRequest().body("Failed to read name field")); } } } @@ -386,7 +386,7 @@ pub async fn upload_zipped_action( Ok(bytes) => details.extend_from_slice(&bytes), Err(_) => { return Ok(HttpResponse::BadRequest() - .body("Failed to read execution_details field")) + .body("Failed to read execution_details field")); } } } @@ -414,7 +414,7 @@ pub async fn upload_zipped_action( Err(_) => { return Ok( HttpResponse::BadRequest().body("Failed to read cron_expr field") - ) + ); } } } @@ -433,7 +433,7 @@ pub async fn upload_zipped_action( Ok(bytes) => env_vars.extend_from_slice(&bytes), Err(_) => { return Ok(HttpResponse::BadRequest() - .body("Failed to read environment_variables field")) + .body("Failed to read environment_variables field")); } } } @@ -461,7 +461,9 @@ pub async fn upload_zipped_action( match chunk { Ok(bytes) => owner.extend_from_slice(&bytes), Err(_) => { - return Ok(HttpResponse::BadRequest().body("Failed to read owner field")) + return Ok( + HttpResponse::BadRequest().body("Failed to read owner field") + ); } } } @@ -480,7 +482,7 @@ pub async fn upload_zipped_action( match chunk { Ok(bytes) => id.extend_from_slice(&bytes), Err(_) => { - return Ok(HttpResponse::BadRequest().body("Failed to read id field")) + return Ok(HttpResponse::BadRequest().body("Failed to read id field")); } } } @@ -503,7 +505,7 @@ pub async fn upload_zipped_action( Ok(bytes) => service_account.extend_from_slice(&bytes), Err(_) => { return Ok(HttpResponse::BadRequest() - .body("Failed to read service_account field")) + .body("Failed to read service_account field")); } } } diff --git a/src/handler/http/request/actions/operations.rs b/src/handler/http/request/actions/operations.rs index 71b8d85db4..31bb20f32c 100644 --- a/src/handler/http/request/actions/operations.rs +++ b/src/handler/http/request/actions/operations.rs @@ -15,14 +15,14 @@ use std::io::Error; use actix_http::header::HeaderMap; -use actix_web::{get, post, web, HttpResponse}; +use actix_web::{HttpResponse, get, post, web}; use itertools::Itertools; use o2_enterprise::enterprise::actions::{action_manager::trigger_action, meta::TriggerSource}; -use tracing::{span, Level}; +use tracing::{Level, span}; use crate::{ common::utils::{ - auth::{check_permissions, UserEmail}, + auth::{UserEmail, check_permissions}, http::get_or_create_trace_id, }, handler::http::models::action::TestActionRequest, diff --git a/src/handler/http/request/alerts/deprecated.rs b/src/handler/http/request/alerts/deprecated.rs index 2954e94b9f..5a4db673f1 100644 --- a/src/handler/http/request/alerts/deprecated.rs +++ b/src/handler/http/request/alerts/deprecated.rs @@ -16,7 +16,7 @@ use core::result::Result::Ok; use std::collections::HashMap; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use config::{ meta::{ alerts::alert::{Alert, AlertListFilter}, @@ -146,10 +146,7 @@ async fn list_stream_alerts(path: web::Path<(String, String)>, req: HttpRequest) let user_filter = query.get("owner").map(|v| v.to_string()); let enabled_filter = query .get("enabled") - .and_then(|field| match field.parse::() { - Ok(value) => Some(value), - Err(_) => None, - }); + .and_then(|field| field.parse::().ok()); let alert_filter = AlertListFilter { owner: user_filter, enabled: enabled_filter, @@ -224,10 +221,7 @@ async fn list_alerts(path: web::Path, req: HttpRequest) -> HttpResponse let user_filter = query.get("owner").map(|v| v.to_string()); let enabled_filter = query .get("enabled") - .and_then(|field| match field.parse::() { - Ok(value) => Some(value), - Err(_) => None, - }); + .and_then(|field| field.parse::().ok()); let stream_type_filter = get_stream_type_from_request(&query); let stream_name_filter = query.get("stream_name").map(|v| v.as_str()); diff --git a/src/handler/http/request/alerts/destinations.rs b/src/handler/http/request/alerts/destinations.rs index 0090eacf53..3d909f8c95 100644 --- a/src/handler/http/request/alerts/destinations.rs +++ b/src/handler/http/request/alerts/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use crate::{ common::meta::http::HttpResponse as MetaHttpResponse, diff --git a/src/handler/http/request/alerts/mod.rs b/src/handler/http/request/alerts/mod.rs index 25072027d6..a078129ed3 100644 --- a/src/handler/http/request/alerts/mod.rs +++ b/src/handler/http/request/alerts/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,14 +13,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use actix_web::{delete, get, patch, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, patch, post, put, web}; use config::meta::{ alerts::alert::Alert as MetaAlert, folder::DEFAULT_FOLDER, triggers::{Trigger, TriggerModule}, }; use hashbrown::HashMap; -use infra::db::{connect_to_orm, ORM_CLIENT}; +use infra::db::{ORM_CLIENT, connect_to_orm}; use svix_ksuid::Ksuid; use crate::{ diff --git a/src/handler/http/request/alerts/templates.rs b/src/handler/http/request/alerts/templates.rs index efe451c0b6..67370aeba3 100644 --- a/src/handler/http/request/alerts/templates.rs +++ b/src/handler/http/request/alerts/templates.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use crate::{ common::meta::http::HttpResponse as MetaHttpResponse, diff --git a/src/handler/http/request/authz/fga.rs b/src/handler/http/request/authz/fga.rs index 8a0ddcda20..0ac46117b0 100644 --- a/src/handler/http/request/authz/fga.rs +++ b/src/handler/http/request/authz/fga.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,7 +14,7 @@ // along with this program. If not, see . use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; #[cfg(feature = "enterprise")] use o2_dex::meta::auth::RoleRequest; diff --git a/src/handler/http/request/authz/mod.rs b/src/handler/http/request/authz/mod.rs index f6f1e352ef..189f1222c4 100644 --- a/src/handler/http/request/authz/mod.rs +++ b/src/handler/http/request/authz/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/clusters/mod.rs b/src/handler/http/request/clusters/mod.rs index b13b8f0c5f..fcddd13657 100644 --- a/src/handler/http/request/clusters/mod.rs +++ b/src/handler/http/request/clusters/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{get, HttpResponse}; +use actix_web::{HttpResponse, get}; use hashbrown::HashMap; #[cfg(feature = "enterprise")] use { diff --git a/src/handler/http/request/dashboards/mod.rs b/src/handler/http/request/dashboards/mod.rs index 0bbb558e0e..3559f3d160 100644 --- a/src/handler/http/request/dashboards/mod.rs +++ b/src/handler/http/request/dashboards/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::collections::HashMap; -use actix_web::{delete, get, http, post, put, web, HttpRequest, HttpResponse, Responder}; +use actix_web::{HttpRequest, HttpResponse, Responder, delete, get, http, post, put, web}; use crate::{ common::meta::http::HttpResponse as MetaHttpResponse, @@ -35,15 +35,33 @@ impl From for HttpResponse { match value { DashboardError::InfraError(err) => MetaHttpResponse::internal_error(err), DashboardError::DashboardNotFound => MetaHttpResponse::not_found("Dashboard not found"), - DashboardError::UpdateMissingHash => MetaHttpResponse::internal_error("Request to update existing dashboard with missing or invalid hash value. BUG"), - DashboardError::UpdateConflictingHash => MetaHttpResponse::conflict("Conflict: Failed to save due to concurrent changes. Please refresh the page after backing up your work to avoid losing changes."), - DashboardError::PutMissingTitle => MetaHttpResponse::internal_error("Dashboard should have title"), - DashboardError::MoveMissingFolderParam => MetaHttpResponse::bad_request("Please specify from & to folder from dashboard movement"), - DashboardError::MoveDestinationFolderNotFound => MetaHttpResponse::not_found("Folder not found"), + DashboardError::UpdateMissingHash => MetaHttpResponse::internal_error( + "Request to update existing dashboard with missing or invalid hash value. BUG", + ), + DashboardError::UpdateConflictingHash => MetaHttpResponse::conflict( + "Conflict: Failed to save due to concurrent changes. Please refresh the page after backing up your work to avoid losing changes.", + ), + DashboardError::PutMissingTitle => { + MetaHttpResponse::internal_error("Dashboard should have title") + } + DashboardError::MoveMissingFolderParam => MetaHttpResponse::bad_request( + "Please specify from & to folder from dashboard movement", + ), + DashboardError::MoveDestinationFolderNotFound => { + MetaHttpResponse::not_found("Folder not found") + } DashboardError::CreateFolderNotFound => MetaHttpResponse::not_found("Folder not found"), - DashboardError::CreateDefaultFolder => MetaHttpResponse::internal_error("Error saving default folder"), - DashboardError::DistinctValueError => MetaHttpResponse::internal_error("Error in updating distinct values"), - DashboardError::MoveDashboardDeleteOld(dashb_id, folder_id, e) => MetaHttpResponse::internal_error(format!("error deleting the dashboard {dashb_id} from old folder {folder_id} : {e}")), + DashboardError::CreateDefaultFolder => { + MetaHttpResponse::internal_error("Error saving default folder") + } + DashboardError::DistinctValueError => { + MetaHttpResponse::internal_error("Error in updating distinct values") + } + DashboardError::MoveDashboardDeleteOld(dashb_id, folder_id, e) => { + MetaHttpResponse::internal_error(format!( + "error deleting the dashboard {dashb_id} from old folder {folder_id} : {e}" + )) + } DashboardError::ListPermittedDashboardsError(err) => MetaHttpResponse::forbidden(err), } } diff --git a/src/handler/http/request/dashboards/reports.rs b/src/handler/http/request/dashboards/reports.rs index f9170de0ff..32d689a703 100644 --- a/src/handler/http/request/dashboards/reports.rs +++ b/src/handler/http/request/dashboards/reports.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{delete, get, http, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, http, post, put, web}; use config::meta::dashboards::reports::{Report, ReportListFilters}; use crate::{ @@ -126,10 +126,7 @@ async fn list_reports(org_id: web::Path, req: HttpRequest) -> Result() { - Ok(value) => Some(value), - Err(_) => None, - }); + .and_then(|field| field.parse::().ok()); let filters = ReportListFilters { folder, dashboard, diff --git a/src/handler/http/request/dashboards/timed_annotations.rs b/src/handler/http/request/dashboards/timed_annotations.rs index d55979dcf8..b0e4710543 100644 --- a/src/handler/http/request/dashboards/timed_annotations.rs +++ b/src/handler/http/request/dashboards/timed_annotations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use config::meta::timed_annotations::{ ListTimedAnnotationsQuery, TimedAnnotation, TimedAnnotationDelete, TimedAnnotationReq, }; diff --git a/src/handler/http/request/enrichment_table/mod.rs b/src/handler/http/request/enrichment_table/mod.rs index 006c397384..0ff03fae82 100644 --- a/src/handler/http/request/enrichment_table/mod.rs +++ b/src/handler/http/request/enrichment_table/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::io::Error; use actix_multipart::Multipart; -use actix_web::{post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, post, web}; use config::SIZE_IN_MB; use hashbrown::HashMap; diff --git a/src/handler/http/request/folders.rs b/src/handler/http/request/folders.rs index 7f1eee1909..47c82afc61 100644 --- a/src/handler/http/request/folders.rs +++ b/src/handler/http/request/folders.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse, Responder}; +use actix_web::{HttpRequest, HttpResponse, Responder, delete, get, post, put, web}; use crate::{ common::meta::http::HttpResponse as MetaHttpResponse, diff --git a/src/handler/http/request/functions/mod.rs b/src/handler/http/request/functions/mod.rs index 3e64bf330b..3ebea04ae5 100644 --- a/src/handler/http/request/functions/mod.rs +++ b/src/handler/http/request/functions/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, post, put, web}; use config::meta::function::{TestVRLRequest, Transform}; /// CreateFunction diff --git a/src/handler/http/request/keys/mod.rs b/src/handler/http/request/keys/mod.rs index b6e3cb55ef..ab66114d8b 100644 --- a/src/handler/http/request/keys/mod.rs +++ b/src/handler/http/request/keys/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,10 +15,10 @@ use std::io::Error; -use actix_web::{delete, get, http, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, http, post, put, web}; use infra::table::cipher::CipherEntry; #[cfg(feature = "enterprise")] -use o2_enterprise::enterprise::cipher::{http_repr::merge_updates, Cipher, CipherData}; +use o2_enterprise::enterprise::cipher::{Cipher, CipherData, http_repr::merge_updates}; #[cfg(feature = "enterprise")] use crate::cipher::{KeyAddRequest, KeyGetResponse, KeyInfo, KeyListResponse}; @@ -154,7 +154,7 @@ pub async fn get( Ok(None) => { return Ok(MetaHttpResponse::not_found(format!( "Key {key_name} not found" - ))) + ))); } Err(e) => return Ok(MetaHttpResponse::internal_error(e)), }; @@ -339,7 +339,7 @@ pub async fn update( Ok(None) => { return Ok(MetaHttpResponse::not_found(format!( "Key {key_name} not found" - ))) + ))); } Err(e) => return Ok(MetaHttpResponse::internal_error(e)), }; diff --git a/src/handler/http/request/kv/mod.rs b/src/handler/http/request/kv/mod.rs index e78f1d9653..6bf4b52f59 100644 --- a/src/handler/http/request/kv/mod.rs +++ b/src/handler/http/request/kv/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, http::header::ContentType, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, http::header::ContentType, post, web}; use hashbrown::HashMap; use crate::{common::meta::http::HttpResponse as MetaHttpResponse, service::kv}; diff --git a/src/handler/http/request/logs/ingest.rs b/src/handler/http/request/logs/ingest.rs index 920da239db..cc05de5ca4 100644 --- a/src/handler/http/request/logs/ingest.rs +++ b/src/handler/http/request/logs/ingest.rs @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{http, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, http, post, web}; use crate::{ common::meta::{ diff --git a/src/handler/http/request/logs/mod.rs b/src/handler/http/request/logs/mod.rs index 9e367a26f6..7f15d99259 100644 --- a/src/handler/http/request/logs/mod.rs +++ b/src/handler/http/request/logs/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/metrics/ingest.rs b/src/handler/http/request/metrics/ingest.rs index e68d4723e4..2756697c04 100644 --- a/src/handler/http/request/metrics/ingest.rs +++ b/src/handler/http/request/metrics/ingest.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{http, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, http, post, web}; use crate::{ common::meta::http::HttpResponse as MetaHttpResponse, diff --git a/src/handler/http/request/metrics/mod.rs b/src/handler/http/request/metrics/mod.rs index 9e367a26f6..7f15d99259 100644 --- a/src/handler/http/request/metrics/mod.rs +++ b/src/handler/http/request/metrics/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/mod.rs b/src/handler/http/request/mod.rs index 688e6904ea..bbeb272bd7 100644 --- a/src/handler/http/request/mod.rs +++ b/src/handler/http/request/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/organization/es.rs b/src/handler/http/request/organization/es.rs index 5317d18c0b..20f91184dd 100644 --- a/src/handler/http/request/organization/es.rs +++ b/src/handler/http/request/organization/es.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{get, http, put, route, web, HttpRequest, HttpResponse, Result}; +use actix_web::{HttpRequest, HttpResponse, Result, get, http, put, route, web}; #[route("/{org_id}/", method = "GET", method = "HEAD")] async fn org_index(_org_id: web::Path, req: HttpRequest) -> Result { diff --git a/src/handler/http/request/organization/mod.rs b/src/handler/http/request/organization/mod.rs index 9d6ebcad02..3fda3fdfad 100644 --- a/src/handler/http/request/organization/mod.rs +++ b/src/handler/http/request/organization/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/organization/org.rs b/src/handler/http/request/organization/org.rs index 0984f04c53..d938342dcb 100644 --- a/src/handler/http/request/organization/org.rs +++ b/src/handler/http/request/organization/org.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::{collections::HashSet, io::Error}; -use actix_web::{get, http, post, put, web, HttpResponse, Result}; +use actix_web::{HttpResponse, Result, get, http, post, put, web}; use infra::schema::STREAM_SCHEMAS_LATEST; use crate::{ @@ -24,11 +24,11 @@ use crate::{ meta::{ http::HttpResponse as MetaHttpResponse, organization::{ - OrgDetails, OrgUser, Organization, OrganizationResponse, PasscodeResponse, - RumIngestionResponse, CUSTOM, DEFAULT_ORG, THRESHOLD, + CUSTOM, DEFAULT_ORG, OrgDetails, OrgUser, Organization, OrganizationResponse, + PasscodeResponse, RumIngestionResponse, THRESHOLD, }, }, - utils::auth::{is_root_user, UserEmail}, + utils::auth::{UserEmail, is_root_user}, }, service::organization::{self, get_passcode, get_rum_token, update_passcode, update_rum_token}, }; diff --git a/src/handler/http/request/organization/settings.rs b/src/handler/http/request/organization/settings.rs index 9922d572c8..ba3c722bba 100644 --- a/src/handler/http/request/organization/settings.rs +++ b/src/handler/http/request/organization/settings.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error as StdErr; -use actix_web::{delete, get, post, web, HttpResponse}; +use actix_web::{HttpResponse, delete, get, post, web}; use config::get_config; use infra::errors::{DbError, Error}; #[cfg(feature = "enterprise")] diff --git a/src/handler/http/request/pipeline.rs b/src/handler/http/request/pipeline.rs index 3ed4e40c06..5524270c5a 100644 --- a/src/handler/http/request/pipeline.rs +++ b/src/handler/http/request/pipeline.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, http, post, put, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, http, post, put, web}; use ahash::HashMap; use config::{ider, meta::pipeline::Pipeline}; diff --git a/src/handler/http/request/promql/mod.rs b/src/handler/http/request/promql/mod.rs index c61c4641a7..c88fca04e9 100644 --- a/src/handler/http/request/promql/mod.rs +++ b/src/handler/http/request/promql/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{get, http, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, get, http, post, web}; use config::utils::time::{parse_milliseconds, parse_str_to_timestamp_micros}; use infra::errors; use promql_parser::parser; @@ -157,7 +157,7 @@ async fn query( { use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; let ast = parser::parse(&req.query.clone().unwrap()).unwrap(); @@ -414,7 +414,7 @@ async fn query_range( { use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; let ast = match parser::parse(&req.query.clone().unwrap_or_default()) { @@ -665,7 +665,7 @@ async fn series( { use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; let metric_name = match selector diff --git a/src/handler/http/request/rum/ingest.rs b/src/handler/http/request/rum/ingest.rs index 35c6d7b46c..e74d8a57f5 100644 --- a/src/handler/http/request/rum/ingest.rs +++ b/src/handler/http/request/rum/ingest.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,10 +13,10 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use std::io::{prelude::*, Error}; +use std::io::{Error, prelude::*}; -use actix_multipart::form::{bytes::Bytes, MultipartForm}; -use actix_web::{post, web, HttpResponse}; +use actix_multipart::form::{MultipartForm, bytes::Bytes}; +use actix_web::{HttpResponse, post, web}; use config::utils::json; use flate2::read::ZlibDecoder; use serde::{Deserialize, Serialize}; diff --git a/src/handler/http/request/rum/mod.rs b/src/handler/http/request/rum/mod.rs index 9e367a26f6..7f15d99259 100644 --- a/src/handler/http/request/rum/mod.rs +++ b/src/handler/http/request/rum/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/request/script_server/mod.rs b/src/handler/http/request/script_server/mod.rs index 4e104926ab..3b0f1f17b9 100644 --- a/src/handler/http/request/script_server/mod.rs +++ b/src/handler/http/request/script_server/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::collections::HashMap; -use actix_web::{delete, get, post, put, web, HttpResponse, Responder}; +use actix_web::{HttpResponse, Responder, delete, get, post, put, web}; use config::meta::actions::action::ActionType; use o2_enterprise::enterprise::actions::action_deployer::ACTION_DEPLOYER; diff --git a/src/handler/http/request/search/mod.rs b/src/handler/http/request/search/mod.rs index 49dc272be1..12c53431da 100644 --- a/src/handler/http/request/search/mod.rs +++ b/src/handler/http/request/search/mod.rs @@ -15,20 +15,19 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{get, http::StatusCode, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, get, http::StatusCode, post, web}; use arrow_schema::Schema; use chrono::{Duration, Utc}; use config::{ - get_config, + DISTINCT_FIELDS, META_ORG_ID, TIMESTAMP_COL_NAME, get_config, meta::{ search::{SearchEventType, SearchHistoryHitResponse}, - self_reporting::usage::{RequestStats, UsageType, USAGE_STREAM}, + self_reporting::usage::{RequestStats, USAGE_STREAM, UsageType}, sql::resolve_stream_names, stream::StreamType, }, metrics, utils::{base64, json}, - DISTINCT_FIELDS, META_ORG_ID, TIMESTAMP_COL_NAME, }; use infra::{cache::stats, errors}; use tracing::{Instrument, Span}; @@ -284,7 +283,7 @@ pub async fn search( use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; if !is_root_user(&user_id) { @@ -453,11 +452,7 @@ pub async fn around( .await .iter() .any(|fn_name| sql.contains(&format!("{}(", fn_name))); - if uses_fn { - sql - } else { - default_sql - } + if uses_fn { sql } else { default_sql } } }, }; diff --git a/src/handler/http/request/search/multi_streams.rs b/src/handler/http/request/search/multi_streams.rs index f70f1bcadb..a8ee0cc1c9 100644 --- a/src/handler/http/request/search/multi_streams.rs +++ b/src/handler/http/request/search/multi_streams.rs @@ -15,10 +15,10 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{get, http::StatusCode, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, get, http::StatusCode, post, web}; use chrono::{Duration, Utc}; use config::{ - get_config, + TIMESTAMP_COL_NAME, get_config, meta::{ function::VRLResultResolver, search::{self, PARTIAL_ERROR_RESPONSE_MESSAGE}, @@ -28,7 +28,6 @@ use config::{ }, metrics, utils::{base64, json}, - TIMESTAMP_COL_NAME, }; use infra::errors; use tracing::{Instrument, Span}; @@ -229,7 +228,7 @@ pub async fn search_multi( use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; if !is_root_user(user_id) { diff --git a/src/handler/http/request/search/query_manager.rs b/src/handler/http/request/search/query_manager.rs index 474cfc2961..ce193daa52 100644 --- a/src/handler/http/request/search/query_manager.rs +++ b/src/handler/http/request/search/query_manager.rs @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, put, web, HttpResponse}; +use actix_web::{HttpResponse, delete, get, put, web}; use o2_enterprise::enterprise::common::infra::config::get_config as get_o2_config; use crate::common::meta::http::HttpResponse as MetaHttpResponse; diff --git a/src/handler/http/request/search/saved_view.rs b/src/handler/http/request/search/saved_view.rs index 83cdc39d93..cd571f88e8 100644 --- a/src/handler/http/request/search/saved_view.rs +++ b/src/handler/http/request/search/saved_view.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpResponse}; +use actix_web::{HttpResponse, delete, get, post, put, web}; use crate::{ common::{ @@ -229,7 +229,7 @@ pub async fn update_view( #[cfg(test)] mod tests { - use actix_web::{test, App}; + use actix_web::{App, test}; use super::*; diff --git a/src/handler/http/request/search/search_job.rs b/src/handler/http/request/search/search_job.rs index a5ac36b26b..d63b9370e1 100644 --- a/src/handler/http/request/search/search_job.rs +++ b/src/handler/http/request/search/search_job.rs @@ -15,7 +15,7 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{delete, get, http::StatusCode, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, delete, get, http::StatusCode, post, web}; use config::{ get_config, meta::{ @@ -282,7 +282,7 @@ pub async fn delete_job( // 1. cancel the query match cancel_job_inner(&org_id, &job_id, &user_id).await { Ok(res) if res.status() != StatusCode::OK && res.status() != StatusCode::BAD_REQUEST => { - return Ok(res) + return Ok(res); } Err(e) => return Ok(MetaHttpResponse::bad_request(e)), _ => {} diff --git a/src/handler/http/request/search/utils.rs b/src/handler/http/request/search/utils.rs index 01ca6f0737..be38ec3468 100644 --- a/src/handler/http/request/search/utils.rs +++ b/src/handler/http/request/search/utils.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ use o2_openfga::meta::mapping::OFGA_MODELS; use crate::common::{ infra::config::USERS, meta::{self, http::HttpResponse as MetaHttpResponse}, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; // Check permissions on stream diff --git a/src/handler/http/request/service_accounts/mod.rs b/src/handler/http/request/service_accounts/mod.rs index 90704cd2e0..6632f29c03 100644 --- a/src/handler/http/request/service_accounts/mod.rs +++ b/src/handler/http/request/service_accounts/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,9 +16,9 @@ use std::io::{Error, ErrorKind}; use actix_web::{ - delete, get, + HttpRequest, HttpResponse, delete, get, http::{self}, - post, put, web, HttpRequest, HttpResponse, + post, put, web, }; use config::utils::rand::generate_random_string; use hashbrown::HashMap; diff --git a/src/handler/http/request/short_url/mod.rs b/src/handler/http/request/short_url/mod.rs index de4415f439..2c62e876c4 100644 --- a/src/handler/http/request/short_url/mod.rs +++ b/src/handler/http/request/short_url/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::io::Error; use actix_http::StatusCode; -use actix_web::{get, post, web, HttpRequest, HttpResponse}; +use actix_web::{HttpRequest, HttpResponse, get, post, web}; use config::meta::short_url::ShortenUrlResponse; use crate::{ diff --git a/src/handler/http/request/status/mod.rs b/src/handler/http/request/status/mod.rs index e3a4f3f49f..442bfc6196 100644 --- a/src/handler/http/request/status/mod.rs +++ b/src/handler/http/request/status/mod.rs @@ -16,19 +16,19 @@ use std::{io::Error, sync::Arc}; use actix_web::{ - cookie, + HttpRequest, HttpResponse, cookie, cookie::{Cookie, SameSite}, get, head, http::header, - put, web, HttpRequest, HttpResponse, + put, web, }; use arrow_schema::Schema; use config::{ + Config, META_ORG_ID, QUICK_MODEL_FIELDS, SQL_FULL_TEXT_SEARCH_FIELDS, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, get_config, get_instance_id, meta::{cluster::NodeStatus, function::ZoFunction}, utils::{json, schema_ext::SchemaExt}, - Config, META_ORG_ID, QUICK_MODEL_FIELDS, SQL_FULL_TEXT_SEARCH_FIELDS, TIMESTAMP_COL_NAME, }; use hashbrown::HashMap; use infra::{ @@ -43,7 +43,7 @@ use { crate::common::utils::{auth::extract_auth_str, jwt::verify_decode_token}, crate::handler::http::auth::{ jwt::process_token, - validator::{get_user_email_from_auth_str, ID_TOKEN_HEADER, PKCE_STATE_ORG}, + validator::{ID_TOKEN_HEADER, PKCE_STATE_ORG, get_user_email_from_auth_str}, }, crate::service::self_reporting::audit, config::{ider, utils::base64}, diff --git a/src/handler/http/request/stream/mod.rs b/src/handler/http/request/stream/mod.rs index c7b644b7e0..7b6d59ad07 100644 --- a/src/handler/http/request/stream/mod.rs +++ b/src/handler/http/request/stream/mod.rs @@ -18,7 +18,7 @@ use std::{ io::{Error, ErrorKind}, }; -use actix_web::{delete, get, http, post, put, web, HttpRequest, HttpResponse, Responder}; +use actix_web::{HttpRequest, HttpResponse, Responder, delete, get, http, post, put, web}; use config::{ meta::stream::{StreamSettings, StreamType, UpdateStreamSettings}, utils::schema::format_stream_name, diff --git a/src/handler/http/request/syslog/mod.rs b/src/handler/http/request/syslog/mod.rs index 55104159e2..e0e9669851 100644 --- a/src/handler/http/request/syslog/mod.rs +++ b/src/handler/http/request/syslog/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{delete, get, post, put, web, HttpResponse, Responder}; +use actix_web::{HttpResponse, Responder, delete, get, post, put, web}; use crate::{ common::meta::syslog::{SyslogRoute, SyslogServer}, diff --git a/src/handler/http/request/traces/mod.rs b/src/handler/http/request/traces/mod.rs index 1507f0222e..67a044231b 100644 --- a/src/handler/http/request/traces/mod.rs +++ b/src/handler/http/request/traces/mod.rs @@ -15,8 +15,8 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{get, http, post, web, HttpRequest, HttpResponse}; -use config::{get_config, meta::stream::StreamType, metrics, utils::json, TIMESTAMP_COL_NAME}; +use actix_web::{HttpRequest, HttpResponse, get, http, post, web}; +use config::{TIMESTAMP_COL_NAME, get_config, meta::stream::StreamType, metrics, utils::json}; use infra::errors; use serde::Serialize; use tracing::{Instrument, Span}; @@ -159,7 +159,7 @@ pub async fn get_latest_traces( use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; let user_id = in_req.headers().get("user_id").unwrap(); if !is_root_user(user_id.to_str().unwrap()) { diff --git a/src/handler/http/request/users/mod.rs b/src/handler/http/request/users/mod.rs index ab55f3c178..fcbe60ab98 100644 --- a/src/handler/http/request/users/mod.rs +++ b/src/handler/http/request/users/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,15 +16,14 @@ use std::{io::Error, sync::Arc}; use actix_web::{ - cookie, delete, get, + HttpRequest, HttpResponse, cookie, delete, get, http::{self}, - post, put, web, HttpRequest, HttpResponse, + post, put, web, }; use actix_web_httpauth::extractors::basic::BasicAuth; use config::{ - get_config, + Config, get_config, utils::{base64, json}, - Config, }; use serde::Serialize; use strum::IntoEnumIterator; @@ -44,7 +43,7 @@ use crate::{ UserRequest, UserRole, }, }, - utils::auth::{generate_presigned_url, UserEmail}, + utils::auth::{UserEmail, generate_presigned_url}, }, service::users, }; @@ -674,7 +673,7 @@ async fn audit_unauthorized_error(mut audit_message: AuditMessage) { #[cfg(test)] mod tests { - use actix_web::{test, App}; + use actix_web::{App, test}; use actix_web_httpauth::headers::authorization::Basic; use super::*; diff --git a/src/handler/http/request/users/service_accounts.rs b/src/handler/http/request/users/service_accounts.rs index 19e0a56493..473c58719f 100644 --- a/src/handler/http/request/users/service_accounts.rs +++ b/src/handler/http/request/users/service_accounts.rs @@ -1,4 +1,19 @@ -use actix_web::{post, web, Error, HttpRequest, HttpResponse}; +// Copyright 2025 OpenObserve Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +use actix_web::{Error, HttpRequest, HttpResponse, post, web}; #[cfg(feature = "enterprise")] use o2_dex::{config::get_config as get_dex_config, service::auth::get_dex_jwks}; #[cfg(feature = "enterprise")] diff --git a/src/handler/http/request/websocket/mod.rs b/src/handler/http/request/websocket/mod.rs index 20c37029c7..ecf2a3c75f 100644 --- a/src/handler/http/request/websocket/mod.rs +++ b/src/handler/http/request/websocket/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ pub mod session; pub mod sort; pub mod utils; -use actix_web::{get, web, Error, HttpRequest, HttpResponse}; +use actix_web::{Error, HttpRequest, HttpResponse, get, web}; use config::get_config; use session::WsSession; use utils::sessions_cache_utils; diff --git a/src/handler/http/request/websocket/search.rs b/src/handler/http/request/websocket/search.rs index 671841d659..399c0ce574 100644 --- a/src/handler/http/request/websocket/search.rs +++ b/src/handler/http/request/websocket/search.rs @@ -17,11 +17,11 @@ use config::{ get_config, meta::{ search::{ - Response, SearchEventType, SearchPartitionRequest, SearchPartitionResponse, - PARTIAL_ERROR_RESPONSE_MESSAGE, + PARTIAL_ERROR_RESPONSE_MESSAGE, Response, SearchEventType, SearchPartitionRequest, + SearchPartitionResponse, }, - sql::{resolve_stream_names, OrderBy}, - websocket::{SearchEventReq, SearchResultType, MAX_QUERY_RANGE_LIMIT_ERROR_MESSAGE}, + sql::{OrderBy, resolve_stream_names}, + websocket::{MAX_QUERY_RANGE_LIMIT_ERROR_MESSAGE, SearchEventReq, SearchResultType}, }, }; use infra::errors::{Error, ErrorCodes}; @@ -42,7 +42,7 @@ use crate::{ }, handler::http::request::websocket::{ session::send_message, - utils::{search_registry_utils, TimeOffset, WsServerEvents}, + utils::{TimeOffset, WsServerEvents, search_registry_utils}, }, service::search::{ self as SearchService, cache, datafusion::distributed_plan::streaming_aggs_exec, sql::Sql, @@ -1015,11 +1015,11 @@ async fn write_results_to_cache( } log::info!( - "[WS_SEARCH]: Writing results to file for trace_id: {}, file_path: {}, accumulated_results len: {}", - c_resp.trace_id, - c_resp.file_path, - accumulated_results.len() - ); + "[WS_SEARCH]: Writing results to file for trace_id: {}, file_path: {}, accumulated_results len: {}", + c_resp.trace_id, + c_resp.file_path, + accumulated_results.len() + ); let cfg = get_config(); let mut cached_responses = Vec::new(); diff --git a/src/handler/http/request/websocket/session.rs b/src/handler/http/request/websocket/session.rs index e1a74078a3..a82e003824 100644 --- a/src/handler/http/request/websocket/session.rs +++ b/src/handler/http/request/websocket/session.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -41,7 +41,7 @@ use super::utils::search_registry_utils::SearchState; use crate::handler::http::request::websocket::utils::search_registry_utils; use crate::handler::http::request::websocket::{ search, - utils::{sessions_cache_utils, WsClientEvents, WsServerEvents}, + utils::{WsClientEvents, WsServerEvents, sessions_cache_utils}, }; #[cfg(feature = "enterprise")] use crate::service::self_reporting::audit; diff --git a/src/handler/http/request/websocket/utils.rs b/src/handler/http/request/websocket/utils.rs index 01671623c7..4236b35ee9 100644 --- a/src/handler/http/request/websocket/utils.rs +++ b/src/handler/http/request/websocket/utils.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -36,7 +36,7 @@ pub mod enterprise_utils { use crate::common::{ infra::config::USERS, - utils::auth::{is_root_user, AuthExtractor}, + utils::auth::{AuthExtractor, is_root_user}, }; // Check if the user is a root user (has all permissions) @@ -93,7 +93,7 @@ pub mod sessions_cache_utils { use super::search_registry_utils::SearchState; use crate::{ common::infra::config::WS_SESSIONS, - handler::http::request::websocket::session::{WsSession, SEARCH_REGISTRY}, + handler::http::request::websocket::session::{SEARCH_REGISTRY, WsSession}, }; pub async fn run_gc_ws_sessions() { diff --git a/src/handler/http/router/middlewares/check_keep_alive.rs b/src/handler/http/router/middlewares/check_keep_alive.rs index 16a7008e4b..7b05ba2537 100644 --- a/src/handler/http/router/middlewares/check_keep_alive.rs +++ b/src/handler/http/router/middlewares/check_keep_alive.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/router/middlewares/mod.rs b/src/handler/http/router/middlewares/mod.rs index a0be662eda..3e4a192ce3 100644 --- a/src/handler/http/router/middlewares/mod.rs +++ b/src/handler/http/router/middlewares/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/handler/http/router/middlewares/slow_log.rs b/src/handler/http/router/middlewares/slow_log.rs index 1de6ba5998..94a5a760cf 100644 --- a/src/handler/http/router/middlewares/slow_log.rs +++ b/src/handler/http/router/middlewares/slow_log.rs @@ -14,13 +14,13 @@ // along with this program. If not, see . use std::{ - future::{ready, Ready}, + future::{Ready, ready}, time::{Duration, Instant}, }; use actix_web::{ - dev::{forward_ready, Service, ServiceRequest, ServiceResponse, Transform}, Error, + dev::{Service, ServiceRequest, ServiceResponse, Transform, forward_ready}, }; use futures_util::future::LocalBoxFuture; diff --git a/src/handler/http/router/mod.rs b/src/handler/http/router/mod.rs index ba261eeb85..daf87d4d20 100644 --- a/src/handler/http/router/mod.rs +++ b/src/handler/http/router/mod.rs @@ -17,13 +17,14 @@ use std::{rc::Rc, str::FromStr}; use actix_cors::Cors; use actix_web::{ + HttpRequest, HttpResponse, body::MessageBody, dev::{Service, ServiceRequest, ServiceResponse}, http::header, - middleware, web, HttpRequest, HttpResponse, + middleware, web, }; use actix_web_httpauth::middleware::HttpAuthentication; -use actix_web_lab::middleware::{from_fn, Next}; +use actix_web_lab::middleware::{Next, from_fn}; use config::get_config; use futures::FutureExt; use utoipa::OpenApi; @@ -32,8 +33,8 @@ use utoipa_swagger_ui::SwaggerUi; use { crate::{common::meta::ingestion::INGESTION_EP, service::self_reporting::audit}, actix_http::h1::Payload, - actix_web::{web::BytesMut, HttpMessage}, - base64::{engine::general_purpose, Engine as _}, + actix_web::{HttpMessage, web::BytesMut}, + base64::{Engine as _, engine::general_purpose}, futures::StreamExt, o2_enterprise::enterprise::common::{ auditor::{AuditMessage, HttpMeta, Protocol}, @@ -574,8 +575,8 @@ pub fn get_other_service_routes(svc: &mut web::ServiceConfig) { #[cfg(test)] mod tests { use actix_web::{ - test::{call_service, init_service, TestRequest}, App, + test::{TestRequest, call_service, init_service}, }; use super::*; diff --git a/src/handler/http/router/openapi.rs b/src/handler/http/router/openapi.rs index 60c7e342c7..78bd9c6805 100644 --- a/src/handler/http/router/openapi.rs +++ b/src/handler/http/router/openapi.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,7 +14,7 @@ // along with this program. If not, see . use config::{get_config, meta::stream::StreamType}; -use utoipa::{openapi::security::SecurityScheme, Modify, OpenApi}; +use utoipa::{Modify, OpenApi, openapi::security::SecurityScheme}; use crate::{common::meta, handler::http::request}; diff --git a/src/handler/http/router/ui.rs b/src/handler/http/router/ui.rs index db3838ae1c..d235dbd1a8 100644 --- a/src/handler/http/router/ui.rs +++ b/src/handler/http/router/ui.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -44,7 +44,7 @@ pub async fn serve(path: web::Path) -> EmbedResponse. use config::{ - meta::stream::{FileMeta, StreamStats, StreamType}, RwHashMap, + meta::stream::{FileMeta, StreamStats, StreamType}, }; use once_cell::sync::Lazy; diff --git a/src/infra/src/cache/storage.rs b/src/infra/src/cache/storage.rs index 7ccd1963bb..067f869925 100644 --- a/src/infra/src/cache/storage.rs +++ b/src/infra/src/cache/storage.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,10 +18,10 @@ use std::ops::Range; use async_trait::async_trait; use bytes::Bytes; use config::utils::time::BASE_TIME; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use object_store::{ - path::Path, Attributes, GetOptions, GetResult, GetResultPayload, ListResult, MultipartUpload, - ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, + Attributes, GetOptions, GetResult, GetResultPayload, ListResult, MultipartUpload, ObjectMeta, + ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, path::Path, }; use once_cell::sync::Lazy; diff --git a/src/infra/src/cache/tmpfs.rs b/src/infra/src/cache/tmpfs.rs index 33de9c1cb8..9dd9a426aa 100644 --- a/src/infra/src/cache/tmpfs.rs +++ b/src/infra/src/cache/tmpfs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/cluster_coordinator/destinations.rs b/src/infra/src/cluster_coordinator/destinations.rs index 81d2fc88c8..bff0985af4 100644 --- a/src/infra/src/cluster_coordinator/destinations.rs +++ b/src/infra/src/cluster_coordinator/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/cluster_coordinator/mod.rs b/src/infra/src/cluster_coordinator/mod.rs index 1974d1bb0f..885bf21a54 100644 --- a/src/infra/src/cluster_coordinator/mod.rs +++ b/src/infra/src/cluster_coordinator/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/cluster_coordinator/pipelines.rs b/src/infra/src/cluster_coordinator/pipelines.rs index 6e943bbdbf..fedc763321 100644 --- a/src/infra/src/cluster_coordinator/pipelines.rs +++ b/src/infra/src/cluster_coordinator/pipelines.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/db/etcd.rs b/src/infra/src/db/etcd.rs index 1e9b3b92e6..0a96dcc2f2 100644 --- a/src/infra/src/db/etcd.rs +++ b/src/infra/src/db/etcd.rs @@ -16,8 +16,8 @@ use std::{ cmp::min, sync::{ - atomic::{AtomicU8, Ordering}, Arc, + atomic::{AtomicU8, Ordering}, }, }; @@ -29,7 +29,7 @@ use etcd_client::{ }; use hashbrown::HashMap; use tokio::{ - sync::{mpsc, OnceCell}, + sync::{OnceCell, mpsc}, task::JoinHandle, time, }; @@ -401,7 +401,7 @@ impl super::Db for Etcd { } let start_dt = item_key .split('/') - .last() + .next_back() .unwrap() .parse::() .unwrap_or_default(); diff --git a/src/infra/src/db/mod.rs b/src/infra/src/db/mod.rs index c37ed362e4..b713404e07 100644 --- a/src/infra/src/db/mod.rs +++ b/src/infra/src/db/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ use bytes::Bytes; use config::{get_config, meta::meta_store::MetaStore}; use hashbrown::HashMap; use sea_orm::{DatabaseConnection, SqlxMySqlConnector, SqlxPostgresConnector, SqlxSqliteConnector}; -use tokio::sync::{mpsc, OnceCell}; +use tokio::sync::{OnceCell, mpsc}; use crate::errors::{DbError, Error, Result}; diff --git a/src/infra/src/db/mysql.rs b/src/infra/src/db/mysql.rs index cb7ac9ed2e..d8ef932e8f 100644 --- a/src/infra/src/db/mysql.rs +++ b/src/infra/src/db/mysql.rs @@ -24,10 +24,10 @@ use config::{ use hashbrown::HashMap; use once_cell::sync::Lazy; use sqlx::{ - mysql::{MySqlConnectOptions, MySqlPoolOptions}, MySql, Pool, + mysql::{MySqlConnectOptions, MySqlPoolOptions}, }; -use tokio::sync::{mpsc, OnceCell}; +use tokio::sync::{OnceCell, mpsc}; use super::{DBIndex, IndexStatement}; use crate::errors::*; diff --git a/src/infra/src/db/nats.rs b/src/infra/src/db/nats.rs index bf37789a92..a275bc2dbf 100644 --- a/src/infra/src/db/nats.rs +++ b/src/infra/src/db/nats.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,13 +15,13 @@ use std::{ sync::{ - atomic::{AtomicU8, Ordering}, Arc, + atomic::{AtomicU8, Ordering}, }, time::Duration, }; -use async_nats::{jetstream, Client, ServerAddr}; +use async_nats::{Client, ServerAddr, jetstream}; use async_trait::async_trait; use bytes::Bytes; use config::{ @@ -35,7 +35,7 @@ use futures::{StreamExt, TryStreamExt}; use hashbrown::HashMap; use once_cell::sync::Lazy; use tokio::{ - sync::{mpsc, Mutex, OnceCell}, + sync::{Mutex, OnceCell, mpsc}, task::JoinHandle, }; @@ -509,7 +509,7 @@ impl super::Db for NatsDb { let key = key_decode(&k); let start_dt = key .split('/') - .last() + .next_back() .unwrap() .parse::() .unwrap_or_default(); @@ -529,7 +529,7 @@ impl super::Db for NatsDb { .map(|key| async move { let start_dt = key .split('/') - .last() + .next_back() .unwrap() .parse::() .unwrap_or_default(); diff --git a/src/infra/src/db/postgres.rs b/src/infra/src/db/postgres.rs index d6f00bedad..01d9fa7b6f 100644 --- a/src/infra/src/db/postgres.rs +++ b/src/infra/src/db/postgres.rs @@ -24,10 +24,10 @@ use config::{ use hashbrown::HashMap; use once_cell::sync::Lazy; use sqlx::{ - postgres::{PgConnectOptions, PgPoolOptions}, Pool, Postgres, + postgres::{PgConnectOptions, PgPoolOptions}, }; -use tokio::sync::{mpsc, OnceCell}; +use tokio::sync::{OnceCell, mpsc}; use super::{DBIndex, IndexStatement}; use crate::errors::*; diff --git a/src/infra/src/db/sqlite.rs b/src/infra/src/db/sqlite.rs index f3e55df1e2..0cbb93c17f 100644 --- a/src/infra/src/db/sqlite.rs +++ b/src/infra/src/db/sqlite.rs @@ -17,17 +17,17 @@ use std::{collections::HashSet, str::FromStr, sync::Arc, time::Duration}; use async_trait::async_trait; use bytes::Bytes; -use config::{cluster, utils::util::zero_or, FxIndexMap}; +use config::{FxIndexMap, cluster, utils::util::zero_or}; use hashbrown::HashMap; use once_cell::sync::Lazy; use sqlx::{ + Pool, Sqlite, sqlite::{ SqliteConnectOptions, SqliteJournalMode, SqliteLockingMode, SqlitePoolOptions, SqliteSynchronous, }, - Pool, Sqlite, }; -use tokio::sync::{mpsc, Mutex, OnceCell, RwLock}; +use tokio::sync::{Mutex, OnceCell, RwLock, mpsc}; use super::{DBIndex, IndexStatement}; use crate::{ diff --git a/src/infra/src/errors/grpc.rs b/src/infra/src/errors/grpc.rs index c0022fbaa5..80af1bc6cf 100644 --- a/src/infra/src/errors/grpc.rs +++ b/src/infra/src/errors/grpc.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/errors/mod.rs b/src/infra/src/errors/mod.rs index be2fd299bc..5948fa23d1 100644 --- a/src/infra/src/errors/mod.rs +++ b/src/infra/src/errors/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/file_list/mysql.rs b/src/infra/src/file_list/mysql.rs index c3de29fe30..c7a068bcaf 100644 --- a/src/infra/src/file_list/mysql.rs +++ b/src/infra/src/file_list/mysql.rs @@ -25,7 +25,7 @@ use config::{ utils::{ hash::Sum64, parquet::parse_file_key_columns, - time::{end_of_the_day, DAY_MICRO_SECS}, + time::{DAY_MICRO_SECS, end_of_the_day}, }, }; use hashbrown::HashMap; @@ -33,8 +33,8 @@ use sqlx::{Executor, MySql, QueryBuilder, Row}; use crate::{ db::{ - mysql::{create_index, CLIENT}, IndexStatement, + mysql::{CLIENT, create_index}, }, errors::{DbError, Error, Result}, }; diff --git a/src/infra/src/file_list/postgres.rs b/src/infra/src/file_list/postgres.rs index 68d5dc26f8..c0d821dbeb 100644 --- a/src/infra/src/file_list/postgres.rs +++ b/src/infra/src/file_list/postgres.rs @@ -25,7 +25,7 @@ use config::{ utils::{ hash::Sum64, parquet::parse_file_key_columns, - time::{end_of_the_day, DAY_MICRO_SECS}, + time::{DAY_MICRO_SECS, end_of_the_day}, }, }; use hashbrown::HashMap; @@ -33,8 +33,8 @@ use sqlx::{Executor, Postgres, QueryBuilder, Row}; use crate::{ db::{ - postgres::{create_index, CLIENT}, IndexStatement, + postgres::{CLIENT, create_index}, }, errors::{Error, Result}, }; diff --git a/src/infra/src/file_list/sqlite.rs b/src/infra/src/file_list/sqlite.rs index 4ea7eb4728..cd101e0524 100644 --- a/src/infra/src/file_list/sqlite.rs +++ b/src/infra/src/file_list/sqlite.rs @@ -23,7 +23,7 @@ use config::{ }, utils::{ parquet::parse_file_key_columns, - time::{end_of_the_day, DAY_MICRO_SECS}, + time::{DAY_MICRO_SECS, end_of_the_day}, }, }; use hashbrown::HashMap; @@ -31,8 +31,8 @@ use sqlx::{Executor, Pool, QueryBuilder, Row, Sqlite}; use crate::{ db::{ - sqlite::{create_index, CLIENT_RO, CLIENT_RW}, IndexStatement, + sqlite::{CLIENT_RO, CLIENT_RW, create_index}, }, errors::{Error, Result}, }; diff --git a/src/infra/src/local_lock.rs b/src/infra/src/local_lock.rs index 01f27643d9..989933c923 100644 --- a/src/infra/src/local_lock.rs +++ b/src/infra/src/local_lock.rs @@ -70,7 +70,7 @@ mod tests { use tokio::{ sync::RwLock, - time::{sleep, Duration}, + time::{Duration, sleep}, }; use super::*; diff --git a/src/infra/src/pipeline/mod.rs b/src/infra/src/pipeline/mod.rs index a14a45e777..0a6feead6a 100644 --- a/src/infra/src/pipeline/mod.rs +++ b/src/infra/src/pipeline/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use async_trait::async_trait; use config::meta::{ meta_store::MetaStore, - pipeline::{components::PipelineSource, Pipeline}, + pipeline::{Pipeline, components::PipelineSource}, stream::StreamParams, }; use once_cell::sync::Lazy; diff --git a/src/infra/src/pipeline/mysql.rs b/src/infra/src/pipeline/mysql.rs index 18898f4f36..98a67a8889 100644 --- a/src/infra/src/pipeline/mysql.rs +++ b/src/infra/src/pipeline/mysql.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use async_trait::async_trait; use config::{ meta::{ - pipeline::{components::PipelineSource, Pipeline}, + pipeline::{Pipeline, components::PipelineSource}, stream::StreamParams, }, utils::json, diff --git a/src/infra/src/pipeline/postgres.rs b/src/infra/src/pipeline/postgres.rs index 7bb865984e..2e46826f14 100644 --- a/src/infra/src/pipeline/postgres.rs +++ b/src/infra/src/pipeline/postgres.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use async_trait::async_trait; use config::{ meta::{ - pipeline::{components::PipelineSource, Pipeline}, + pipeline::{Pipeline, components::PipelineSource}, stream::StreamParams, }, utils::json, diff --git a/src/infra/src/pipeline/sqlite.rs b/src/infra/src/pipeline/sqlite.rs index bc37bfa017..bf12b05cf8 100644 --- a/src/infra/src/pipeline/sqlite.rs +++ b/src/infra/src/pipeline/sqlite.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use async_trait::async_trait; use config::{ meta::{ - pipeline::{components::PipelineSource, Pipeline}, + pipeline::{Pipeline, components::PipelineSource}, stream::StreamParams, }, utils::json, diff --git a/src/infra/src/queue/mod.rs b/src/infra/src/queue/mod.rs index ec11916bdf..d32c526781 100644 --- a/src/infra/src/queue/mod.rs +++ b/src/infra/src/queue/mod.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use async_trait::async_trait; use bytes::Bytes; use config::meta::meta_store::MetaStore; -use tokio::sync::{mpsc, OnceCell}; +use tokio::sync::{OnceCell, mpsc}; use crate::errors::{Error, Result}; diff --git a/src/infra/src/scheduler/mod.rs b/src/infra/src/scheduler/mod.rs index bfc4bac46e..cd31e79fea 100644 --- a/src/infra/src/scheduler/mod.rs +++ b/src/infra/src/scheduler/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/scheduler/mysql.rs b/src/infra/src/scheduler/mysql.rs index 6528c6ccca..249be9a2bc 100644 --- a/src/infra/src/scheduler/mysql.rs +++ b/src/infra/src/scheduler/mysql.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,13 +20,12 @@ use config::metrics::DB_QUERY_NUMS; use sqlx::Row; use super::{ - get_scheduler_max_retries, Trigger, TriggerId, TriggerModule, TriggerStatus, TRIGGERS_KEY, + TRIGGERS_KEY, Trigger, TriggerId, TriggerModule, TriggerStatus, get_scheduler_max_retries, }; use crate::{ db::{ - self, - mysql::{create_index, CLIENT}, - IndexStatement, + self, IndexStatement, + mysql::{CLIENT, create_index}, }, errors::{DbError, Error, Result}, }; diff --git a/src/infra/src/scheduler/postgres.rs b/src/infra/src/scheduler/postgres.rs index 183d2a1b1c..e2a109bf03 100644 --- a/src/infra/src/scheduler/postgres.rs +++ b/src/infra/src/scheduler/postgres.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,12 +19,11 @@ use chrono::Duration; use config::metrics::DB_QUERY_NUMS; use sqlx::Row; -use super::{get_scheduler_max_retries, Trigger, TriggerModule, TriggerStatus, TRIGGERS_KEY}; +use super::{TRIGGERS_KEY, Trigger, TriggerModule, TriggerStatus, get_scheduler_max_retries}; use crate::{ db::{ - self, - postgres::{create_index, CLIENT}, - IndexStatement, + self, IndexStatement, + postgres::{CLIENT, create_index}, }, errors::{DbError, Error, Result}, }; diff --git a/src/infra/src/scheduler/sqlite.rs b/src/infra/src/scheduler/sqlite.rs index 9b897a611f..6eccf8aae4 100644 --- a/src/infra/src/scheduler/sqlite.rs +++ b/src/infra/src/scheduler/sqlite.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,12 +18,11 @@ use chrono::Duration; use config::utils::json; use sqlx::{Pool, Row, Sqlite}; -use super::{get_scheduler_max_retries, Trigger, TriggerModule, TriggerStatus, TRIGGERS_KEY}; +use super::{TRIGGERS_KEY, Trigger, TriggerModule, TriggerStatus, get_scheduler_max_retries}; use crate::{ db::{ - self, - sqlite::{create_index, CLIENT_RO, CLIENT_RW}, - IndexStatement, + self, IndexStatement, + sqlite::{CLIENT_RO, CLIENT_RW, create_index}, }, errors::{DbError, Error, Result}, }; diff --git a/src/infra/src/schema/history/mod.rs b/src/infra/src/schema/history/mod.rs index 69a90fff73..8978ff5f48 100644 --- a/src/infra/src/schema/history/mod.rs +++ b/src/infra/src/schema/history/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/schema/history/mysql.rs b/src/infra/src/schema/history/mysql.rs index f3609f63ba..aa96b193e8 100644 --- a/src/infra/src/schema/history/mysql.rs +++ b/src/infra/src/schema/history/mysql.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,8 +19,8 @@ use datafusion::arrow::datatypes::Schema; use crate::{ db::{ - mysql::{create_index, CLIENT}, IndexStatement, + mysql::{CLIENT, create_index}, }, errors::{Error, Result}, }; diff --git a/src/infra/src/schema/history/postgres.rs b/src/infra/src/schema/history/postgres.rs index 9216cab6f7..49de899b12 100644 --- a/src/infra/src/schema/history/postgres.rs +++ b/src/infra/src/schema/history/postgres.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,8 +19,8 @@ use datafusion::arrow::datatypes::Schema; use crate::{ db::{ - postgres::{create_index, CLIENT}, IndexStatement, + postgres::{CLIENT, create_index}, }, errors::{Error, Result}, }; diff --git a/src/infra/src/schema/history/sqlite.rs b/src/infra/src/schema/history/sqlite.rs index c0694dd6d4..9a61cb4dfe 100644 --- a/src/infra/src/schema/history/sqlite.rs +++ b/src/infra/src/schema/history/sqlite.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,8 +19,8 @@ use datafusion::arrow::datatypes::Schema; use crate::{ db::{ - sqlite::{create_index, CLIENT_RW}, IndexStatement, + sqlite::{CLIENT_RW, create_index}, }, errors::{Error, Result}, }; diff --git a/src/infra/src/schema/mod.rs b/src/infra/src/schema/mod.rs index febd87b524..27b485ca54 100644 --- a/src/infra/src/schema/mod.rs +++ b/src/infra/src/schema/mod.rs @@ -17,12 +17,11 @@ use std::{collections::HashMap, sync::Arc}; use chrono::Utc; use config::{ - get_config, + BLOOM_FILTER_DEFAULT_FIELDS, RwAHashMap, RwHashMap, SQL_FULL_TEXT_SEARCH_FIELDS, + SQL_SECONDARY_INDEX_SEARCH_FIELDS, get_config, ider::SnowflakeIdGenerator, meta::stream::{PartitionTimeLevel, StreamSettings, StreamType}, utils::{json, schema_ext::SchemaExt}, - RwAHashMap, RwHashMap, BLOOM_FILTER_DEFAULT_FIELDS, SQL_FULL_TEXT_SEARCH_FIELDS, - SQL_SECONDARY_INDEX_SEARCH_FIELDS, }; use datafusion::arrow::datatypes::{DataType, Field, FieldRef, Schema, SchemaRef}; use futures::{StreamExt, TryStreamExt}; diff --git a/src/infra/src/storage/local.rs b/src/infra/src/storage/local.rs index 62d8d3440f..06fc6d54b9 100644 --- a/src/infra/src/storage/local.rs +++ b/src/infra/src/storage/local.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,12 +20,12 @@ use bytes::Bytes; use config::metrics; use futures::stream::BoxStream; use object_store::{ - limit::LimitStore, local::LocalFileSystem, path::Path, Error, GetOptions, GetResult, - ListResult, MultipartUpload, ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayload, - PutResult, Result, + Error, GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, + PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, limit::LimitStore, + local::LocalFileSystem, path::Path, }; -use crate::storage::{format_key, CONCURRENT_REQUESTS}; +use crate::storage::{CONCURRENT_REQUESTS, format_key}; pub struct Local { client: LimitStore>, diff --git a/src/infra/src/storage/mod.rs b/src/infra/src/storage/mod.rs index 0267d1d5c9..0bcab5b953 100644 --- a/src/infra/src/storage/mod.rs +++ b/src/infra/src/storage/mod.rs @@ -19,7 +19,7 @@ use bytes::buf::Buf; use config::{get_config, is_local_disk_storage, meta::stream::FileMeta, metrics}; use datafusion::parquet::{data_type::AsBytes, file::metadata::ParquetMetaData}; use futures::{StreamExt, TryStreamExt}; -use object_store::{path::Path, GetRange, ObjectMeta, ObjectStore, WriteMultipart}; +use object_store::{GetRange, ObjectMeta, ObjectStore, WriteMultipart, path::Path}; use once_cell::sync::Lazy; use parquet::file::metadata::ParquetMetaDataReader; diff --git a/src/infra/src/storage/remote.rs b/src/infra/src/storage/remote.rs index 61b5fe7702..9bcff56579 100644 --- a/src/infra/src/storage/remote.rs +++ b/src/infra/src/storage/remote.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,11 +20,11 @@ use bytes::Bytes; use config::{get_config, metrics}; use futures::stream::BoxStream; use object_store::{ - limit::LimitStore, path::Path, Error, GetOptions, GetResult, ListResult, MultipartUpload, - ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, + Error, GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, + PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, limit::LimitStore, path::Path, }; -use crate::storage::{format_key, CONCURRENT_REQUESTS}; +use crate::storage::{CONCURRENT_REQUESTS, format_key}; pub struct Remote { client: LimitStore>, diff --git a/src/infra/src/table/action_scripts.rs b/src/infra/src/table/action_scripts.rs index fe381410f5..3e00bf4d8b 100644 --- a/src/infra/src/table/action_scripts.rs +++ b/src/infra/src/table/action_scripts.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -27,7 +27,7 @@ use super::{ get_lock, }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{self, DbError, Error}, table::entity::action_scripts::{Column, Entity}, }; diff --git a/src/infra/src/table/alerts/intermediate.rs b/src/infra/src/table/alerts/intermediate.rs index 1cb7a0f114..082b75cd71 100644 --- a/src/infra/src/table/alerts/intermediate.rs +++ b/src/infra/src/table/alerts/intermediate.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/alerts/mod.rs b/src/infra/src/table/alerts/mod.rs index 389844d29e..d78f6456c2 100644 --- a/src/infra/src/table/alerts/mod.rs +++ b/src/infra/src/table/alerts/mod.rs @@ -18,8 +18,8 @@ use std::str::FromStr; use chrono::{DateTime, FixedOffset, TimeZone, Utc}; use config::meta::{ alerts::{ - alert::{Alert as MetaAlert, ListAlertsParams}, QueryCondition as MetaQueryCondition, TriggerCondition as MetaTriggerCondition, + alert::{Alert as MetaAlert, ListAlertsParams}, }, folder::{Folder as MetaFolder, FolderType}, stream::StreamType as MetaStreamType, @@ -27,8 +27,8 @@ use config::meta::{ use hashbrown::HashMap; use itertools::Itertools; use sea_orm::{ - prelude::Expr, sea_query::Func, ActiveModelTrait, ColumnTrait, ConnectionTrait, EntityTrait, - ModelTrait, PaginatorTrait, QueryFilter, QueryOrder, Set, TransactionTrait, TryIntoModel, + ActiveModelTrait, ColumnTrait, ConnectionTrait, EntityTrait, ModelTrait, PaginatorTrait, + QueryFilter, QueryOrder, Set, TransactionTrait, TryIntoModel, prelude::Expr, sea_query::Func, }; use svix_ksuid::{Ksuid, KsuidLike}; diff --git a/src/infra/src/table/cipher.rs b/src/infra/src/table/cipher.rs index f2a77fba4d..a2bb67d7ff 100644 --- a/src/infra/src/table/cipher.rs +++ b/src/infra/src/table/cipher.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,8 +13,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use aes_siv::{siv::Aes256Siv, KeyInit}; -use base64::{prelude::BASE64_STANDARD, Engine}; +use aes_siv::{KeyInit, siv::Aes256Siv}; +use base64::{Engine, prelude::BASE64_STANDARD}; use config::get_config; use once_cell::sync::Lazy; use sea_orm::{ColumnTrait, EntityTrait, Order, QueryFilter, QueryOrder, QuerySelect, Set, SqlErr}; @@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize}; use super::{entity::cipher_keys::*, get_lock}; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, }; diff --git a/src/infra/src/table/dashboards.rs b/src/infra/src/table/dashboards.rs index 141dd553e0..183974b914 100644 --- a/src/infra/src/table/dashboards.rs +++ b/src/infra/src/table/dashboards.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,15 +15,15 @@ use config::meta::{ dashboards::{ - v1::Dashboard as DashboardV1, v2::Dashboard as DashboardV2, v3::Dashboard as DashboardV3, - v4::Dashboard as DashboardV4, v5::Dashboard as DashboardV5, Dashboard, - ListDashboardsParams, + Dashboard, ListDashboardsParams, v1::Dashboard as DashboardV1, + v2::Dashboard as DashboardV2, v3::Dashboard as DashboardV3, v4::Dashboard as DashboardV4, + v5::Dashboard as DashboardV5, }, folder::{Folder, FolderType}, }; use sea_orm::{ - prelude::Expr, sea_query::Func, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, - IntoActiveModel, ModelTrait, PaginatorTrait, QueryFilter, QueryOrder, Set, TryIntoModel, + ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel, ModelTrait, + PaginatorTrait, QueryFilter, QueryOrder, Set, TryIntoModel, prelude::Expr, sea_query::Func, }; use serde_json::Value as JsonValue; use svix_ksuid::KsuidLike; @@ -34,7 +34,7 @@ use super::{ folders::folder_type_into_i16, }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{self, GetDashboardError}, }; @@ -488,7 +488,7 @@ fn inner_data_as_json(dashboard: Dashboard) -> Result #[cfg(test)] mod tests { - use sea_orm::{entity::prelude::*, DatabaseBackend, MockDatabase, Transaction}; + use sea_orm::{DatabaseBackend, MockDatabase, Transaction, entity::prelude::*}; use super::*; diff --git a/src/infra/src/table/destinations.rs b/src/infra/src/table/destinations.rs index a22c69cc0f..efa34b1cf7 100644 --- a/src/infra/src/table/destinations.rs +++ b/src/infra/src/table/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,7 +22,7 @@ use sea_orm::{ }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{DestinationError, Error}, table::{ entity::{ diff --git a/src/infra/src/table/distinct_values.rs b/src/infra/src/table/distinct_values.rs index 160039cd46..3bcb53e1d6 100644 --- a/src/infra/src/table/distinct_values.rs +++ b/src/infra/src/table/distinct_values.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,14 +14,14 @@ // along with this program. If not, see . use sea_orm::{ - entity::prelude::*, ColumnTrait, ConnectionTrait, EntityTrait, FromQueryResult, QueryFilter, - Schema, Set, + ColumnTrait, ConnectionTrait, EntityTrait, FromQueryResult, QueryFilter, Schema, Set, + entity::prelude::*, }; use serde::{Deserialize, Serialize}; use super::get_lock; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{self, DbError, Error}, }; diff --git a/src/infra/src/table/folders.rs b/src/infra/src/table/folders.rs index 71d06fd7ad..196b9b7559 100644 --- a/src/infra/src/table/folders.rs +++ b/src/infra/src/table/folders.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,7 +22,7 @@ use svix_ksuid::{Ksuid, KsuidLike}; use super::entity::folders::{ActiveModel, Column, Entity, Model}; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{self, FromStrError}, }; diff --git a/src/infra/src/table/migration/m20241114_000001_create_folders_table.rs b/src/infra/src/table/migration/m20241114_000001_create_folders_table.rs index 15d4b0faac..25bf2e5d1e 100644 --- a/src/infra/src/table/migration/m20241114_000001_create_folders_table.rs +++ b/src/infra/src/table/migration/m20241114_000001_create_folders_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241115_150000_populate_folders_table.rs b/src/infra/src/table/migration/m20241115_150000_populate_folders_table.rs index c6a3eb1860..9fdaf347ea 100644 --- a/src/infra/src/table/migration/m20241115_150000_populate_folders_table.rs +++ b/src/infra/src/table/migration/m20241115_150000_populate_folders_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241116_000001_delete_metas.rs b/src/infra/src/table/migration/m20241116_000001_delete_metas.rs index 3d48ff0dcd..0ea3e3d3cb 100644 --- a/src/infra/src/table/migration/m20241116_000001_delete_metas.rs +++ b/src/infra/src/table/migration/m20241116_000001_delete_metas.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241116_000002_drop_folders_created_at_column.rs b/src/infra/src/table/migration/m20241116_000002_drop_folders_created_at_column.rs index ddba149825..3deb7a286f 100644 --- a/src/infra/src/table/migration/m20241116_000002_drop_folders_created_at_column.rs +++ b/src/infra/src/table/migration/m20241116_000002_drop_folders_created_at_column.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241119_000001_create_dashboards_table.rs b/src/infra/src/table/migration/m20241119_000001_create_dashboards_table.rs index 7a436a43ff..961abec230 100644 --- a/src/infra/src/table/migration/m20241119_000001_create_dashboards_table.rs +++ b/src/infra/src/table/migration/m20241119_000001_create_dashboards_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241119_000002_populate_dashboards_table.rs b/src/infra/src/table/migration/m20241119_000002_populate_dashboards_table.rs index c1bb15b632..76a43d99b6 100644 --- a/src/infra/src/table/migration/m20241119_000002_populate_dashboards_table.rs +++ b/src/infra/src/table/migration/m20241119_000002_populate_dashboards_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241119_000003_delete_metas.rs b/src/infra/src/table/migration/m20241119_000003_delete_metas.rs index 6ea0d4ec54..c19762f102 100644 --- a/src/infra/src/table/migration/m20241119_000003_delete_metas.rs +++ b/src/infra/src/table/migration/m20241119_000003_delete_metas.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241209_120000_create_alerts_table.rs b/src/infra/src/table/migration/m20241209_120000_create_alerts_table.rs index f47b6d2cfd..14bab23b43 100644 --- a/src/infra/src/table/migration/m20241209_120000_create_alerts_table.rs +++ b/src/infra/src/table/migration/m20241209_120000_create_alerts_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241215_190333_delete_metas.rs b/src/infra/src/table/migration/m20241215_190333_delete_metas.rs index f0f8df838b..2badcfda91 100644 --- a/src/infra/src/table/migration/m20241215_190333_delete_metas.rs +++ b/src/infra/src/table/migration/m20241215_190333_delete_metas.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241217_154900_alter_folders_table_idx.rs b/src/infra/src/table/migration/m20241217_154900_alter_folders_table_idx.rs index 5334931fa7..e6174ccc7e 100644 --- a/src/infra/src/table/migration/m20241217_154900_alter_folders_table_idx.rs +++ b/src/infra/src/table/migration/m20241217_154900_alter_folders_table_idx.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20241217_155000_populate_alerts_table.rs b/src/infra/src/table/migration/m20241217_155000_populate_alerts_table.rs index 4368ae8a16..9c28a9314a 100644 --- a/src/infra/src/table/migration/m20241217_155000_populate_alerts_table.rs +++ b/src/infra/src/table/migration/m20241217_155000_populate_alerts_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250109_092400_recreate_tables_with_ksuids.rs b/src/infra/src/table/migration/m20250109_092400_recreate_tables_with_ksuids.rs index 1654aa47ee..9d1f7348f6 100644 --- a/src/infra/src/table/migration/m20250109_092400_recreate_tables_with_ksuids.rs +++ b/src/infra/src/table/migration/m20250109_092400_recreate_tables_with_ksuids.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -43,8 +43,8 @@ use itertools::Itertools; use sea_orm::{ - sea_query::{Table, TableCreateStatement}, DeriveIden, EntityTrait, IntoActiveModel, PaginatorTrait, Set, TransactionTrait, + sea_query::{Table, TableCreateStatement}, }; use sea_orm_migration::prelude::*; diff --git a/src/infra/src/table/migration/m20250113_144600_create_unique_folder_name_idx.rs b/src/infra/src/table/migration/m20250113_144600_create_unique_folder_name_idx.rs index a09d0e8451..a8831bb3f5 100644 --- a/src/infra/src/table/migration/m20250113_144600_create_unique_folder_name_idx.rs +++ b/src/infra/src/table/migration/m20250113_144600_create_unique_folder_name_idx.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250121_120000_create_cipher_table.rs b/src/infra/src/table/migration/m20250121_120000_create_cipher_table.rs index 81daea08d1..7781dd43ca 100644 --- a/src/infra/src/table/migration/m20250121_120000_create_cipher_table.rs +++ b/src/infra/src/table/migration/m20250121_120000_create_cipher_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_102300_create_destinations_table.rs b/src/infra/src/table/migration/m20250125_102300_create_destinations_table.rs index 56609ed528..6d4367ee6f 100644 --- a/src/infra/src/table/migration/m20250125_102300_create_destinations_table.rs +++ b/src/infra/src/table/migration/m20250125_102300_create_destinations_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_115400_create_templates_table.rs b/src/infra/src/table/migration/m20250125_115400_create_templates_table.rs index 5adb7862bd..f41df57281 100644 --- a/src/infra/src/table/migration/m20250125_115400_create_templates_table.rs +++ b/src/infra/src/table/migration/m20250125_115400_create_templates_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_132500_populate_templates_table.rs b/src/infra/src/table/migration/m20250125_132500_populate_templates_table.rs index d3da43b60b..2a01662ede 100644 --- a/src/infra/src/table/migration/m20250125_132500_populate_templates_table.rs +++ b/src/infra/src/table/migration/m20250125_132500_populate_templates_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_133700_populate_destinations_table.rs b/src/infra/src/table/migration/m20250125_133700_populate_destinations_table.rs index 316670598e..d54e7d4e0b 100644 --- a/src/infra/src/table/migration/m20250125_133700_populate_destinations_table.rs +++ b/src/infra/src/table/migration/m20250125_133700_populate_destinations_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_153005_delete_metas_destinations.rs b/src/infra/src/table/migration/m20250125_153005_delete_metas_destinations.rs index a06d55b340..9471e5da96 100644 --- a/src/infra/src/table/migration/m20250125_153005_delete_metas_destinations.rs +++ b/src/infra/src/table/migration/m20250125_153005_delete_metas_destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250125_172300_delete_metas_templates.rs b/src/infra/src/table/migration/m20250125_172300_delete_metas_templates.rs index 6316fa3fb4..290c84fe6b 100644 --- a/src/infra/src/table/migration/m20250125_172300_delete_metas_templates.rs +++ b/src/infra/src/table/migration/m20250125_172300_delete_metas_templates.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/m20250213_000001_add_dashboard_updated_at.rs b/src/infra/src/table/migration/m20250213_000001_add_dashboard_updated_at.rs index 58871a6e7b..11c916d0d0 100644 --- a/src/infra/src/table/migration/m20250213_000001_add_dashboard_updated_at.rs +++ b/src/infra/src/table/migration/m20250213_000001_add_dashboard_updated_at.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/migration/mod.rs b/src/infra/src/table/migration/mod.rs index a39e84ceaa..69659eebf7 100644 --- a/src/infra/src/table/migration/mod.rs +++ b/src/infra/src/table/migration/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/mod.rs b/src/infra/src/table/mod.rs index 0c1b1b5ca0..679059a026 100644 --- a/src/infra/src/table/mod.rs +++ b/src/infra/src/table/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ use migration::Migrator; use sea_orm_migration::MigratorTrait; use crate::{ - db::{connect_to_orm, sqlite::CLIENT_RW, ORM_CLIENT, SQLITE_STORE}, + db::{ORM_CLIENT, SQLITE_STORE, connect_to_orm, sqlite::CLIENT_RW}, dist_lock, }; diff --git a/src/infra/src/table/search_job/common.rs b/src/infra/src/table/search_job/common.rs index c5c77200eb..6c37197f32 100644 --- a/src/infra/src/table/search_job/common.rs +++ b/src/infra/src/table/search_job/common.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/search_job/mod.rs b/src/infra/src/table/search_job/mod.rs index 9c337e900c..81393b0766 100644 --- a/src/infra/src/table/search_job/mod.rs +++ b/src/infra/src/table/search_job/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/infra/src/table/search_job/search_job_partitions.rs b/src/infra/src/table/search_job/search_job_partitions.rs index 7f511f1d07..63c729b83b 100644 --- a/src/infra/src/table/search_job/search_job_partitions.rs +++ b/src/infra/src/table/search_job/search_job_partitions.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,9 +14,9 @@ // along with this program. If not, see . use sea_orm::{ + ColumnTrait, EntityTrait, Order, QueryFilter, QueryOrder, QuerySelect, TransactionTrait, prelude::Expr, sea_query::{LockType, SimpleExpr}, - ColumnTrait, EntityTrait, Order, QueryFilter, QueryOrder, QuerySelect, TransactionTrait, }; use serde::{Deserialize, Serialize}; @@ -25,7 +25,7 @@ use super::{ common::{OperatorType, Value}, }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, orm_err, }; diff --git a/src/infra/src/table/search_job/search_job_results.rs b/src/infra/src/table/search_job/search_job_results.rs index f3f584ad49..e353aa372d 100644 --- a/src/infra/src/table/search_job/search_job_results.rs +++ b/src/infra/src/table/search_job/search_job_results.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize}; use super::super::{entity::search_job_results::*, get_lock}; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, orm_err, }; diff --git a/src/infra/src/table/search_job/search_jobs.rs b/src/infra/src/table/search_job/search_jobs.rs index 9f7e3dea23..4e8a69546e 100644 --- a/src/infra/src/table/search_job/search_jobs.rs +++ b/src/infra/src/table/search_job/search_jobs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,10 +15,10 @@ use config::cluster::LOCAL_NODE; use sea_orm::{ - prelude::Expr, - sea_query::{Keyword, LockType, SimpleExpr}, ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, QueryOrder, QuerySelect, Set, TransactionTrait, UpdateMany, UpdateResult, + prelude::Expr, + sea_query::{Keyword, LockType, SimpleExpr}, }; use serde::{Deserialize, Serialize}; @@ -34,7 +34,7 @@ use super::{ common::{OperatorType, Value}, }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, orm_err, }; diff --git a/src/infra/src/table/search_queue.rs b/src/infra/src/table/search_queue.rs index bd00826140..aeb8e7b21f 100644 --- a/src/infra/src/table/search_queue.rs +++ b/src/infra/src/table/search_queue.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ use sea_orm::{ColumnTrait, EntityTrait, PaginatorTrait, QueryFilter, Set}; use super::{entity::search_queue::*, get_lock}; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, }; diff --git a/src/infra/src/table/short_urls.rs b/src/infra/src/table/short_urls.rs index b5f532025e..30280b5561 100644 --- a/src/infra/src/table/short_urls.rs +++ b/src/infra/src/table/short_urls.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,16 +14,16 @@ // along with this program. If not, see . use sea_orm::{ - entity::prelude::*, - sea_query::{Alias, DynIden}, ColumnTrait, ConnectionTrait, DatabaseBackend, EntityTrait, FromQueryResult, Order, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect, Schema, Set, + entity::prelude::*, + sea_query::{Alias, DynIden}, }; use serde::{Deserialize, Serialize}; use super::get_lock; use crate::{ - db::{connect_to_orm, mysql, postgres, sqlite, IndexStatement, ORM_CLIENT}, + db::{IndexStatement, ORM_CLIENT, connect_to_orm, mysql, postgres, sqlite}, errors::{self, DbError, Error}, }; diff --git a/src/infra/src/table/templates.rs b/src/infra/src/table/templates.rs index 2eb9c22a90..8e9d0badee 100644 --- a/src/infra/src/table/templates.rs +++ b/src/infra/src/table/templates.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -25,7 +25,7 @@ use sea_orm::{ }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::{Error, TemplateError}, table::{ entity::templates::{ActiveModel, Column, Entity, Model}, diff --git a/src/infra/src/table/timed_annotation_panels.rs b/src/infra/src/table/timed_annotation_panels.rs index aec41b4b75..d39130eb0c 100644 --- a/src/infra/src/table/timed_annotation_panels.rs +++ b/src/infra/src/table/timed_annotation_panels.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,7 +18,7 @@ use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, Set, TransactionTrait}; use super::{entity::timed_annotation_panels, get_lock}; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, }; diff --git a/src/infra/src/table/timed_annotations.rs b/src/infra/src/table/timed_annotations.rs index 60a5ea9445..b6d0c2f073 100644 --- a/src/infra/src/table/timed_annotations.rs +++ b/src/infra/src/table/timed_annotations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,8 +18,8 @@ use std::collections::HashMap; use chrono::Utc; use config::{ider, meta::timed_annotations::*}; use sea_orm::{ - prelude::Expr, ColumnTrait, Condition, DatabaseTransaction, EntityTrait, QueryFilter, Set, - TransactionTrait, + ColumnTrait, Condition, DatabaseTransaction, EntityTrait, QueryFilter, Set, TransactionTrait, + prelude::Expr, }; use super::{ @@ -30,7 +30,7 @@ use super::{ get_lock, }; use crate::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors, }; @@ -513,8 +513,8 @@ pub async fn add_many( } /// Helper function to insert a single `TimedAnnotation` record and its associated panels -async fn insert_timed_annotation<'a>( - txn: &'a DatabaseTransaction, +async fn insert_timed_annotation( + txn: &DatabaseTransaction, dashboard_id: &str, timed_annotation: TimedAnnotation, use_given_id: bool, diff --git a/src/ingester/bin/wal-reader.rs b/src/ingester/bin/wal-reader.rs index b37331b59f..5dbe89a7ea 100644 --- a/src/ingester/bin/wal-reader.rs +++ b/src/ingester/bin/wal-reader.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use ingester::{errors::Result, Entry}; +use ingester::{Entry, errors::Result}; use wal::Reader; fn main() -> Result<()> { diff --git a/src/ingester/src/entry.rs b/src/ingester/src/entry.rs index 5109249f21..50686f59c7 100644 --- a/src/ingester/src/entry.rs +++ b/src/ingester/src/entry.rs @@ -21,7 +21,7 @@ use std::{ use arrow::{array::Int64Array, record_batch::RecordBatch}; use arrow_schema::Schema; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use config::utils::record_batch_ext::{convert_json_to_record_batch, RecordBatchExt}; +use config::utils::record_batch_ext::{RecordBatchExt, convert_json_to_record_batch}; use serde::{Deserialize, Serialize}; use snafu::ResultExt; diff --git a/src/ingester/src/immutable.rs b/src/ingester/src/immutable.rs index 5a1f4809c4..020f864683 100644 --- a/src/ingester/src/immutable.rs +++ b/src/ingester/src/immutable.rs @@ -21,16 +21,16 @@ use once_cell::sync::Lazy; use snafu::ResultExt; use tokio::{ fs, - sync::{mpsc, RwLock}, + sync::{RwLock, mpsc}, }; use crate::{ + ReadRecordBatchEntry, entry::PersistStat, errors::{DeleteFileSnafu, RenameFileSnafu, Result, TokioMpscSendSnafu, WriteDataSnafu}, memtable::MemTable, rwmap::RwIndexMap, writer::WriterKey, - ReadRecordBatchEntry, }; pub(crate) static IMMUTABLES: Lazy>> = diff --git a/src/ingester/src/lib.rs b/src/ingester/src/lib.rs index 07875d80e2..5662ab4ad1 100644 --- a/src/ingester/src/lib.rs +++ b/src/ingester/src/lib.rs @@ -30,8 +30,8 @@ use config::RwAHashMap; pub use entry::Entry; pub use immutable::read_from_immutable; use once_cell::sync::Lazy; -use tokio::sync::{mpsc, Mutex}; -pub use writer::{check_memtable_size, flush_all, get_writer, read_from_memtable, Writer}; +use tokio::sync::{Mutex, mpsc}; +pub use writer::{Writer, check_memtable_size, flush_all, get_writer, read_from_memtable}; pub(crate) type ReadRecordBatchEntry = (Arc, Vec>); diff --git a/src/ingester/src/memtable.rs b/src/ingester/src/memtable.rs index b57c7e52a8..221939e116 100644 --- a/src/ingester/src/memtable.rs +++ b/src/ingester/src/memtable.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,8 +16,8 @@ use std::{ path::PathBuf, sync::{ - atomic::{AtomicU64, Ordering}, Arc, + atomic::{AtomicU64, Ordering}, }, }; @@ -26,10 +26,10 @@ use config::metrics; use hashbrown::HashMap; use crate::{ + ReadRecordBatchEntry, entry::{Entry, PersistStat, RecordBatchEntry}, errors::Result, stream::Stream, - ReadRecordBatchEntry, }; pub(crate) struct MemTable { diff --git a/src/ingester/src/partition.rs b/src/ingester/src/partition.rs index 620530e954..317a03a4cb 100644 --- a/src/ingester/src/partition.rs +++ b/src/ingester/src/partition.rs @@ -31,9 +31,9 @@ use snafu::ResultExt; use tokio::{fs::OpenOptions, io::AsyncWriteExt}; use crate::{ + ReadRecordBatchEntry, entry::{Entry, PersistStat, RecordBatchEntry}, errors::*, - ReadRecordBatchEntry, }; pub(crate) struct Partition { diff --git a/src/ingester/src/rwmap.rs b/src/ingester/src/rwmap.rs index ea60184d2c..f9e924b487 100644 --- a/src/ingester/src/rwmap.rs +++ b/src/ingester/src/rwmap.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/ingester/src/stream.rs b/src/ingester/src/stream.rs index c3941c445b..2572091870 100644 --- a/src/ingester/src/stream.rs +++ b/src/ingester/src/stream.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,10 +19,10 @@ use arrow_schema::Schema; use config::utils::schema_ext::SchemaExt; use crate::{ + ReadRecordBatchEntry, entry::{Entry, PersistStat, RecordBatchEntry}, errors::*, partition::Partition, - ReadRecordBatchEntry, }; pub(crate) struct Stream { diff --git a/src/ingester/src/wal.rs b/src/ingester/src/wal.rs index 84b38842fd..b1580c090c 100644 --- a/src/ingester/src/wal.rs +++ b/src/ingester/src/wal.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use std::{ - fs::{create_dir_all, File}, + fs::{File, create_dir_all}, io::{BufRead, BufReader}, path::PathBuf, sync::Arc, @@ -249,11 +249,7 @@ async fn wal_scan_files(root_dir: impl Into, ext: &str) -> Result>>> = Lazy::new(|| { diff --git a/src/job/compactor.rs b/src/job/compactor.rs index af9708e994..164189264e 100644 --- a/src/job/compactor.rs +++ b/src/job/compactor.rs @@ -20,13 +20,13 @@ use config::{ get_config, meta::{ cluster::CompactionJobType, - stream::{FileKey, ALL_STREAM_TYPES}, + stream::{ALL_STREAM_TYPES, FileKey}, }, metrics, }; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::common::infra::config::get_config as get_o2_config; -use tokio::sync::{mpsc, Mutex}; +use tokio::sync::{Mutex, mpsc}; use crate::service::compact; diff --git a/src/job/files/broadcast.rs b/src/job/files/broadcast.rs index e0311fb010..21b526f06c 100644 --- a/src/job/files/broadcast.rs +++ b/src/job/files/broadcast.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/job/files/idx.rs b/src/job/files/idx.rs index 26a3f0cbfd..79b20dd183 100644 --- a/src/job/files/idx.rs +++ b/src/job/files/idx.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,19 +16,18 @@ use std::sync::Arc; use arrow::array::{ - make_builder, Array, ArrayBuilder, BinaryArray, BinaryBuilder, BooleanArray, BooleanBuilder, - Int64Array, Int64Builder, RecordBatch, StringArray, StringBuilder, + Array, ArrayBuilder, BinaryArray, BinaryBuilder, BooleanArray, BooleanBuilder, Int64Array, + Int64Builder, RecordBatch, StringArray, StringBuilder, make_builder, }; use arrow_schema::{DataType, Schema}; use config::{ - ider, + FILE_EXT_PARQUET, ider, meta::stream::{FileMeta, StreamPartition, StreamPartitionType, StreamType}, utils::{ parquet::new_parquet_writer, - record_batch_ext::{concat_batches, RecordBatchExt}, + record_batch_ext::{RecordBatchExt, concat_batches}, schema::format_partition_key, }, - FILE_EXT_PARQUET, }; use hashbrown::HashMap; use infra::storage; diff --git a/src/job/files/mod.rs b/src/job/files/mod.rs index 7215fe74b5..c8e191f01b 100644 --- a/src/job/files/mod.rs +++ b/src/job/files/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,10 +14,10 @@ // along with this program. If not, see . use config::{ - cluster::{is_offline, LOCAL_NODE}, + FILE_EXT_PARQUET, + cluster::{LOCAL_NODE, is_offline}, ider, meta::stream::StreamType, - FILE_EXT_PARQUET, }; pub mod broadcast; diff --git a/src/job/files/parquet.rs b/src/job/files/parquet.rs index d10579d72d..3c8fe426cb 100644 --- a/src/job/files/parquet.rs +++ b/src/job/files/parquet.rs @@ -23,8 +23,8 @@ use std::{ use anyhow::Context; use arrow::{ array::{ - new_null_array, Array, ArrayRef, BinaryBuilder, BooleanArray, BooleanBuilder, Int64Array, - Int64Builder, StringArray, StringBuilder, + Array, ArrayRef, BinaryBuilder, BooleanArray, BooleanBuilder, Int64Array, Int64Builder, + StringArray, StringBuilder, new_null_array, }, datatypes::Field, record_batch::RecordBatch, @@ -33,7 +33,8 @@ use arrow_schema::{DataType, Schema, SchemaRef}; use bytes::Bytes; use chrono::{Duration, Utc}; use config::{ - cluster, get_config, + FxIndexMap, INDEX_FIELD_NAME_FOR_ALL, INDEX_SEGMENT_LENGTH, PARQUET_BATCH_SIZE, + TIMESTAMP_COL_NAME, cluster, get_config, meta::{ bitvec::BitVec, inverted_index::InvertedIndexFormat, @@ -51,17 +52,15 @@ use config::{ get_recordbatch_reader_from_bytes, read_metadata_from_file, read_schema_from_file, }, schema_ext::SchemaExt, - tantivy::tokenizer::{o2_tokenizer_build, O2_TOKENIZER}, + tantivy::tokenizer::{O2_TOKENIZER, o2_tokenizer_build}, }, - FxIndexMap, INDEX_FIELD_NAME_FOR_ALL, INDEX_SEGMENT_LENGTH, PARQUET_BATCH_SIZE, - TIMESTAMP_COL_NAME, }; use futures::TryStreamExt; use hashbrown::HashSet; use infra::{ schema::{ - get_stream_setting_bloom_filter_fields, get_stream_setting_fts_fields, - get_stream_setting_index_fields, unwrap_stream_settings, SchemaCache, + SchemaCache, get_stream_setting_bloom_filter_fields, get_stream_setting_fts_fields, + get_stream_setting_index_fields, unwrap_stream_settings, }, storage, }; diff --git a/src/job/flatten_compactor.rs b/src/job/flatten_compactor.rs index ea2f98e112..71c65ba4ed 100644 --- a/src/job/flatten_compactor.rs +++ b/src/job/flatten_compactor.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::sync::Arc; use config::{cluster::LOCAL_NODE, get_config, meta::stream::FileKey}; -use tokio::sync::{mpsc, Mutex}; +use tokio::sync::{Mutex, mpsc}; use crate::service::compact; diff --git a/src/job/metrics.rs b/src/job/metrics.rs index 3eaeaf27b9..5e1b20db80 100644 --- a/src/job/metrics.rs +++ b/src/job/metrics.rs @@ -25,13 +25,14 @@ use config::{ use hashbrown::HashMap; use infra::{cache, db::get_db}; use once_cell::sync::Lazy; -use opentelemetry::{global, metrics::Histogram, KeyValue}; +use opentelemetry::{KeyValue, global, metrics::Histogram}; use opentelemetry_sdk::{ + Resource, metrics::{ - new_view, reader::DefaultTemporalitySelector, Aggregation, Instrument, PeriodicReader, - SdkMeterProvider, Stream, + Aggregation, Instrument, PeriodicReader, SdkMeterProvider, Stream, new_view, + reader::DefaultTemporalitySelector, }, - runtime, Resource, + runtime, }; use tokio::{sync::Mutex, time}; diff --git a/src/job/mmdb_downloader.rs b/src/job/mmdb_downloader.rs index f1d34506b3..3365ca313b 100644 --- a/src/job/mmdb_downloader.rs +++ b/src/job/mmdb_downloader.rs @@ -16,8 +16,8 @@ use std::sync::Arc; use config::{ - utils::download_utils::{download_file, is_digest_different}, MMDB_ASN_FILE_NAME, MMDB_CITY_FILE_NAME, + utils::download_utils::{download_file, is_digest_different}, }; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::common::infra::config::get_config as get_o2_config; diff --git a/src/job/promql_self_consume.rs b/src/job/promql_self_consume.rs index 1353cbf9c6..f47992c7c3 100644 --- a/src/job/promql_self_consume.rs +++ b/src/job/promql_self_consume.rs @@ -14,24 +14,24 @@ // along with this program. If not, see . use config::{ + META_ORG_ID, cluster::LOCAL_NODE, get_config, meta::{cluster::get_internal_grpc_token, stream::StreamType}, metrics::get_registry, utils::{prom_json_encoder::JsonEncoder, util::zero_or}, - META_ORG_ID, }; use hashbrown::HashSet; use once_cell::sync::Lazy; use proto::cluster_rpc::{ - ingest_client::IngestClient, IngestionData, IngestionRequest, IngestionType, + IngestionData, IngestionRequest, IngestionType, ingest_client::IngestClient, }; use serde_json::Value; use tokio::time::{self, Duration}; use tonic::{ + Request, codec::CompressionEncoding, metadata::{MetadataKey, MetadataValue}, - Request, }; use crate::service::{self, grpc::get_ingester_channel}; diff --git a/src/job/syslog_server.rs b/src/job/syslog_server.rs index b9e63e28b5..be7b6d6278 100644 --- a/src/job/syslog_server.rs +++ b/src/job/syslog_server.rs @@ -21,12 +21,12 @@ use std::{ use once_cell::sync::Lazy; use tokio::{ net::{TcpListener, UdpSocket}, - sync::{broadcast, RwLock}, + sync::{RwLock, broadcast}, }; use crate::{ common::infra::config::SYSLOG_ENABLED, - handler::tcp_udp::{tcp_server, udp_server, STOP_SRV}, + handler::tcp_udp::{STOP_SRV, tcp_server, udp_server}, service::db::syslog::toggle_syslog_setting, }; diff --git a/src/main.rs b/src/main.rs index 338e7de82d..7bdbce08aa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,13 +19,13 @@ use std::{ net::SocketAddr, str::FromStr, sync::{ - atomic::{AtomicU16, Ordering}, Arc, + atomic::{AtomicU16, Ordering}, }, time::Duration, }; -use actix_web::{dev::ServerHandle, http::KeepAlive, middleware, web, App, HttpServer}; +use actix_web::{App, HttpServer, dev::ServerHandle, http::KeepAlive, middleware, web}; use actix_web_lab::middleware::from_fn; use actix_web_opentelemetry::RequestTracing; use arrow_flight::flight_service_server::FlightServiceServer; @@ -62,14 +62,14 @@ use openobserve::{ job, router, service::{db, metadata, search::SEARCH_SERVER, self_reporting, tls::http_tls_config}, }; -use opentelemetry::{global, trace::TracerProvider, KeyValue}; +use opentelemetry::{KeyValue, global, trace::TracerProvider}; use opentelemetry_otlp::WithExportConfig; use opentelemetry_proto::tonic::collector::{ logs::v1::logs_service_server::LogsServiceServer, metrics::v1::metrics_service_server::MetricsServiceServer, trace::v1::trace_service_server::TraceServiceServer, }; -use opentelemetry_sdk::{propagation::TraceContextPropagator, Resource}; +use opentelemetry_sdk::{Resource, propagation::TraceContextPropagator}; use proto::cluster_rpc::{ event_server::EventServer, ingest_server::IngestServer, metrics_server::MetricsServer, query_cache_server::QueryCacheServer, search_server::SearchServer, @@ -78,7 +78,7 @@ use proto::cluster_rpc::{ #[cfg(feature = "profiling")] use pyroscope::PyroscopeAgent; #[cfg(feature = "profiling")] -use pyroscope_pprofrs::{pprof_backend, PprofConfig}; +use pyroscope_pprofrs::{PprofConfig, pprof_backend}; use tokio::sync::oneshot; use tonic::{ codec::CompressionEncoding, @@ -91,7 +91,7 @@ use tracing_subscriber::Registry; #[cfg(feature = "pyroscope")] use { pyroscope::PyroscopeAgent, - pyroscope_pprofrs::{pprof_backend, PprofConfig}, + pyroscope_pprofrs::{PprofConfig, pprof_backend}, }; #[cfg(feature = "mimalloc")] @@ -101,7 +101,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; use tracing_subscriber::{ - filter::LevelFilter as TracingLevelFilter, fmt::Layer, prelude::*, EnvFilter, + EnvFilter, filter::LevelFilter as TracingLevelFilter, fmt::Layer, prelude::*, }; #[tokio::main] @@ -847,7 +847,7 @@ async fn init_http_server_without_tracing() -> Result<(), anyhow::Error> { async fn graceful_shutdown(handle: ServerHandle) { #[cfg(unix)] { - use tokio::signal::unix::{signal, SignalKind}; + use tokio::signal::unix::{SignalKind, signal}; let mut sigquit = signal(SignalKind::quit()).unwrap(); let mut sigterm = signal(SignalKind::terminate()).unwrap(); diff --git a/src/proto/build.rs b/src/proto/build.rs index aeb0445afb..e2de8377ec 100644 --- a/src/proto/build.rs +++ b/src/proto/build.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/proto/src/generated/mod.rs b/src/proto/src/generated/mod.rs index 4b0234c2f3..e39fd58869 100644 --- a/src/proto/src/generated/mod.rs +++ b/src/proto/src/generated/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/proto/src/lib.rs b/src/proto/src/lib.rs index e7d6137aaf..ee1e2aa9bc 100644 --- a/src/proto/src/lib.rs +++ b/src/proto/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/report_server/src/report.rs b/src/report_server/src/report.rs index d16f0666cd..0359133cca 100644 --- a/src/report_server/src/report.rs +++ b/src/report_server/src/report.rs @@ -1,23 +1,23 @@ use chromiumoxide::{ + Page, browser::{Browser, BrowserConfig}, cdp::browser_protocol::page::PrintToPdfParams, - detection::{default_executable, DetectionOptions}, + detection::{DetectionOptions, default_executable}, fetcher::{BrowserFetcher, BrowserFetcherOptions}, handler::viewport::Viewport, - Page, }; use config::get_config; use futures::StreamExt; use lettre::{ - message::{header::ContentType, MultiPart, SinglePart}, + AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor, + message::{MultiPart, SinglePart, header::ContentType}, transport::smtp::{ authentication::Credentials, client::{Tls, TlsParameters}, }, - AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor, }; use once_cell::sync::Lazy; -use tokio::time::{sleep, Duration}; +use tokio::time::{Duration, sleep}; use crate::models::{self, ReportType}; diff --git a/src/report_server/src/router.rs b/src/report_server/src/router.rs index c311193f88..abbd2e3e5b 100644 --- a/src/report_server/src/router.rs +++ b/src/report_server/src/router.rs @@ -1,11 +1,11 @@ use std::{collections::HashMap, io::Error}; -use actix_web::{get, http::StatusCode, put, web, HttpRequest, HttpResponse as ActixHttpResponse}; +use actix_web::{HttpRequest, HttpResponse as ActixHttpResponse, get, http::StatusCode, put, web}; use serde::{Deserialize, Serialize}; use crate::{ models::{self, ReportType}, - report::{generate_report, send_email, SMTP_CLIENT}, + report::{SMTP_CLIENT, generate_report, send_email}, }; /// HTTP response diff --git a/src/report_server/src/server.rs b/src/report_server/src/server.rs index 17c5b0d1d6..7144a9564c 100644 --- a/src/report_server/src/server.rs +++ b/src/report_server/src/server.rs @@ -1,6 +1,6 @@ use std::net::SocketAddr; -use actix_web::{dev::ServerHandle, middleware, web, App, HttpServer}; +use actix_web::{App, HttpServer, dev::ServerHandle, middleware, web}; use crate::router::{healthz, send_report}; @@ -51,7 +51,7 @@ pub async fn spawn_server() -> Result<(), anyhow::Error> { async fn graceful_shutdown(handle: ServerHandle) { #[cfg(unix)] { - use tokio::signal::unix::{signal, SignalKind}; + use tokio::signal::unix::{SignalKind, signal}; let mut sigquit = signal(SignalKind::quit()).unwrap(); let mut sigterm = signal(SignalKind::terminate()).unwrap(); diff --git a/src/router/grpc/ingest/logs.rs b/src/router/grpc/ingest/logs.rs index 216e8a0dea..858d2075f3 100644 --- a/src/router/grpc/ingest/logs.rs +++ b/src/router/grpc/ingest/logs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,10 +15,10 @@ use config::meta::cluster::get_internal_grpc_token; use opentelemetry_proto::tonic::collector::logs::v1::{ - logs_service_client::LogsServiceClient, logs_service_server::LogsService, - ExportLogsServiceRequest, ExportLogsServiceResponse, + ExportLogsServiceRequest, ExportLogsServiceResponse, logs_service_client::LogsServiceClient, + logs_service_server::LogsService, }; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request, Response, Status}; +use tonic::{Request, Response, Status, codec::CompressionEncoding, metadata::MetadataValue}; use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::service::{grpc::get_ingester_channel, search::MetadataMap}; diff --git a/src/router/grpc/ingest/metrics.rs b/src/router/grpc/ingest/metrics.rs index 2ed310d36c..d953662969 100644 --- a/src/router/grpc/ingest/metrics.rs +++ b/src/router/grpc/ingest/metrics.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,10 +15,10 @@ use config::meta::cluster::get_internal_grpc_token; use opentelemetry_proto::tonic::collector::metrics::v1::{ - metrics_service_client::MetricsServiceClient, metrics_service_server::MetricsService, ExportMetricsServiceRequest, ExportMetricsServiceResponse, + metrics_service_client::MetricsServiceClient, metrics_service_server::MetricsService, }; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request, Response, Status}; +use tonic::{Request, Response, Status, codec::CompressionEncoding, metadata::MetadataValue}; use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::service::{grpc::get_ingester_channel, search::MetadataMap}; diff --git a/src/router/grpc/ingest/mod.rs b/src/router/grpc/ingest/mod.rs index 46c92f2914..19646fdf44 100644 --- a/src/router/grpc/ingest/mod.rs +++ b/src/router/grpc/ingest/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/router/grpc/ingest/traces.rs b/src/router/grpc/ingest/traces.rs index 70deee6b41..f1a5e4a3db 100644 --- a/src/router/grpc/ingest/traces.rs +++ b/src/router/grpc/ingest/traces.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,10 +15,10 @@ use config::meta::cluster::get_internal_grpc_token; use opentelemetry_proto::tonic::collector::trace::v1::{ - trace_service_client::TraceServiceClient, trace_service_server::TraceService, ExportTraceServiceRequest, ExportTraceServiceResponse, + trace_service_client::TraceServiceClient, trace_service_server::TraceService, }; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request, Response, Status}; +use tonic::{Request, Response, Status, codec::CompressionEncoding, metadata::MetadataValue}; use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::service::{grpc::get_ingester_channel, search::MetadataMap}; diff --git a/src/router/grpc/mod.rs b/src/router/grpc/mod.rs index 9e367a26f6..7f15d99259 100644 --- a/src/router/grpc/mod.rs +++ b/src/router/grpc/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/router/http/mod.rs b/src/router/http/mod.rs index ed41488fef..0709965777 100644 --- a/src/router/http/mod.rs +++ b/src/router/http/mod.rs @@ -24,8 +24,9 @@ use ::config::{ utils::rand::get_rand_element, }; use actix_web::{ + FromRequest, HttpRequest, HttpResponse, http::{Error, Method}, - route, web, FromRequest, HttpRequest, HttpResponse, + route, web, }; use crate::common::{infra::cluster, utils::http::get_search_type_from_request}; @@ -441,10 +442,10 @@ async fn proxy_ws( match ws::ws_proxy(req, payload, &ws_url).await { Ok(res) => { log::info!( - "[WS_ROUTER] Successfully proxied WebSocket connection to backend: {}, took: {} ms", - ws_url, - start.elapsed().as_millis() - ); + "[WS_ROUTER] Successfully proxied WebSocket connection to backend: {}, took: {} ms", + ws_url, + start.elapsed().as_millis() + ); Ok(res) } Err(e) => { diff --git a/src/router/http/ws.rs b/src/router/http/ws.rs index fcf58e15b8..d06de45955 100644 --- a/src/router/http/ws.rs +++ b/src/router/http/ws.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::{str::FromStr, sync::Arc}; -use actix_web::{rt, web, Error, HttpRequest, HttpResponse}; +use actix_web::{Error, HttpRequest, HttpResponse, rt, web}; use actix_ws::Message; use config::get_config; use futures_util::{SinkExt, StreamExt}; diff --git a/src/router/mod.rs b/src/router/mod.rs index 75ebff5adc..d540e4faa1 100644 --- a/src/router/mod.rs +++ b/src/router/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/alerts/alert.rs b/src/service/alerts/alert.rs index 6b6013f4b0..d39ad64b29 100644 --- a/src/service/alerts/alert.rs +++ b/src/service/alerts/alert.rs @@ -21,16 +21,16 @@ use std::{ use async_trait::async_trait; use chrono::{Duration, Local, TimeZone, Timelike, Utc}; use config::{ - get_config, + SMTP_CLIENT, TIMESTAMP_COL_NAME, get_config, meta::{ alerts::{ - alert::{Alert, AlertListFilter, ListAlertsParams}, FrequencyType, Operator, QueryType, + alert::{Alert, AlertListFilter, ListAlertsParams}, }, destinations::{ AwsSns, DestinationType, Email, Endpoint, HTTPType, Module, Template, TemplateType, }, - folder::{Folder, FolderType, DEFAULT_FOLDER}, + folder::{DEFAULT_FOLDER, Folder, FolderType}, search::{SearchEventContext, SearchEventType}, sql::resolve_stream_names, stream::StreamType, @@ -39,12 +39,11 @@ use config::{ base64, json::{Map, Value}, }, - SMTP_CLIENT, TIMESTAMP_COL_NAME, }; use cron::Schedule; use infra::{schema::unwrap_stream_settings, table}; use itertools::Itertools; -use lettre::{message::MultiPart, AsyncTransport, Message}; +use lettre::{AsyncTransport, Message, message::MultiPart}; use sea_orm::{ConnectionTrait, TransactionTrait}; use svix_ksuid::Ksuid; @@ -54,7 +53,7 @@ use crate::{ utils::auth::{is_ofga_unsupported, remove_ownership, set_ownership}, }, service::{ - alerts::{build_sql, destinations, QueryConditionExt}, + alerts::{QueryConditionExt, build_sql, destinations}, db, folders, search::sql::RE_ONLY_SELECT, short_url, @@ -130,7 +129,9 @@ pub enum AlertError { #[error(transparent)] GetDestinationWithTemplateError(#[from] db::alerts::destinations::DestinationError), - #[error("Alert period is greater than max query range of {max_query_range_hours} hours for stream \"{stream_name}\"")] + #[error( + "Alert period is greater than max query range of {max_query_range_hours} hours for stream \"{stream_name}\"" + )] PeriodExceedsMaxQueryRange { max_query_range_hours: i64, stream_name: String, diff --git a/src/service/alerts/derived_streams.rs b/src/service/alerts/derived_streams.rs index a06101a839..e90e440e72 100644 --- a/src/service/alerts/derived_streams.rs +++ b/src/service/alerts/derived_streams.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -82,7 +82,7 @@ pub async fn save( .query_condition .promql .as_ref() - .map_or(false, |promql| promql.is_empty()) + .is_some_and(|promql| promql.is_empty()) || derived_stream.query_condition.promql_condition.is_none() { return Err(anyhow::anyhow!( diff --git a/src/service/alerts/destinations.rs b/src/service/alerts/destinations.rs index 03317f2161..d4cfb03ddb 100644 --- a/src/service/alerts/destinations.rs +++ b/src/service/alerts/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/alerts/mod.rs b/src/service/alerts/mod.rs index b1df4889b5..f97baa77f9 100644 --- a/src/service/alerts/mod.rs +++ b/src/service/alerts/mod.rs @@ -18,7 +18,7 @@ use arrow_schema::DataType; use async_trait::async_trait; use chrono::{Duration, Utc}; use config::{ - ider, + TIMESTAMP_COL_NAME, ider, meta::{ alerts::{AggFunction, Condition, Operator, QueryCondition, QueryType, TriggerCondition}, search::{SearchEventContext, SearchEventType, SqlQuery}, @@ -29,7 +29,6 @@ use config::{ base64, json::{Map, Value}, }, - TIMESTAMP_COL_NAME, }; use super::promql; @@ -610,12 +609,7 @@ async fn build_sql( if sql.is_empty() { sql = format!( "SELECT {} AS alert_agg_value, MIN({}) as zo_sql_min_time, MAX({}) AS zo_sql_max_time FROM \"{}\" {} HAVING {}", - func_expr, - TIMESTAMP_COL_NAME, - TIMESTAMP_COL_NAME, - stream_name, - where_sql, - having_expr + func_expr, TIMESTAMP_COL_NAME, TIMESTAMP_COL_NAME, stream_name, where_sql, having_expr ); } Ok(sql) diff --git a/src/service/alerts/scheduler/handlers.rs b/src/service/alerts/scheduler/handlers.rs index 31d42d6ea2..f7bbfe837e 100644 --- a/src/service/alerts/scheduler/handlers.rs +++ b/src/service/alerts/scheduler/handlers.rs @@ -41,7 +41,7 @@ use proto::cluster_rpc; use crate::service::{ alerts::{ - alert::{get_alert_start_end_time, get_by_name, get_row_column_map, AlertExt}, + alert::{AlertExt, get_alert_start_end_time, get_by_name, get_row_column_map}, derived_streams::DerivedStreamExt, }, dashboards::reports::SendReport, @@ -307,7 +307,9 @@ async fn handle_alert_triggers( { alert.enabled = false; if let Err(e) = set_without_updating_trigger(&org_id, alert).await { - log::error!("[SCHEDULER trace_id {trace_id}] Failed to update alert: {alert_name} after trigger: {e}"); + log::error!( + "[SCHEDULER trace_id {trace_id}] Failed to update alert: {alert_name} after trigger: {e}" + ); } } } @@ -883,7 +885,12 @@ async fn handle_derived_stream_triggers( "Source node DerivedStream QueryCondition error during query evaluation, caused by {}", e ); - log::error!("[SCHEDULER trace_id {trace_id}] pipeline org/name({}/{}): source node DerivedStream failed at QueryCondition evaluation with error: {}", pipeline.org, pipeline.name, e); + log::error!( + "[SCHEDULER trace_id {trace_id}] pipeline org/name({}/{}): source node DerivedStream failed at QueryCondition evaluation with error: {}", + pipeline.org, + pipeline.name, + e + ); // update TriggerData that's to be reported to _meta trigger_data_stream.status = TriggerDataStatus::Failed; @@ -910,7 +917,7 @@ async fn handle_derived_stream_triggers( end = now + 1; } Ok((ret, next)) => { - let is_satisfied = ret.as_ref().map_or(false, |ret| !ret.is_empty()); + let is_satisfied = ret.as_ref().is_some_and(|ret| !ret.is_empty()); // ingest evaluation result into destination if is_satisfied { @@ -1105,7 +1112,7 @@ async fn handle_derived_stream_triggers( db::scheduler::delete(&trigger.org, trigger.module, &trigger.module_key).await { log::error!( - "[SCHEDULER trace_id {trace_id}] pipeline error deleting trigger after pipeline {}/{} reached maximum retries:, {}", + "[SCHEDULER trace_id {trace_id}] pipeline error deleting trigger after pipeline {}/{} reached maximum retries:, {}", &pipeline.org, &pipeline.name, e, @@ -1138,7 +1145,7 @@ async fn handle_derived_stream_triggers( pipeline.enabled = false; if let Err(e) = db::pipeline::update(&pipeline, None).await { log::error!( - "[SCHEDULER trace_id {trace_id}] pipeline error pausing pipeline {}/{} after it's reached reached maximum retries:, {}", + "[SCHEDULER trace_id {trace_id}] pipeline error pausing pipeline {}/{} after it's reached reached maximum retries:, {}", &pipeline.org, &pipeline.name, e, diff --git a/src/service/alerts/scheduler/worker.rs b/src/service/alerts/scheduler/worker.rs index 6c5c11bbd9..c9afc867b5 100644 --- a/src/service/alerts/scheduler/worker.rs +++ b/src/service/alerts/scheduler/worker.rs @@ -16,12 +16,12 @@ use std::{collections::HashMap, sync::Arc}; use anyhow::Result; use tokio::{ - sync::{mpsc, Mutex, Semaphore}, + sync::{Mutex, Semaphore, mpsc}, time, }; use super::handlers::handle_triggers; -use crate::service::db::scheduler::{pull as scheduler_pull, Trigger, TriggerModule}; +use crate::service::db::scheduler::{Trigger, TriggerModule, pull as scheduler_pull}; #[derive(Debug, Clone)] pub struct ScheduledJob { diff --git a/src/service/alerts/templates.rs b/src/service/alerts/templates.rs index 1a231b028f..6bd2edca8f 100644 --- a/src/service/alerts/templates.rs +++ b/src/service/alerts/templates.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/circuit_breaker.rs b/src/service/circuit_breaker.rs index 222c5c7d61..349b5ab500 100644 --- a/src/service/circuit_breaker.rs +++ b/src/service/circuit_breaker.rs @@ -14,8 +14,8 @@ // along with this program. If not, see . use std::sync::{ - atomic::{AtomicI64, AtomicU64, Ordering}, Arc, LazyLock, + atomic::{AtomicI64, AtomicU64, Ordering}, }; use chrono::Utc; diff --git a/src/service/compact/deleted.rs b/src/service/compact/deleted.rs index 46967f3aec..bb3f4f95d1 100644 --- a/src/service/compact/deleted.rs +++ b/src/service/compact/deleted.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/compact/flatten.rs b/src/service/compact/flatten.rs index 56f3de5546..c806fe5c68 100644 --- a/src/service/compact/flatten.rs +++ b/src/service/compact/flatten.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,10 +17,11 @@ use std::sync::Arc; use ::datafusion::arrow::datatypes::Schema; use arrow::array::{ - make_builder, new_null_array, ArrayBuilder, ArrayRef, RecordBatch, StringArray, StringBuilder, + ArrayBuilder, ArrayRef, RecordBatch, StringArray, StringBuilder, make_builder, new_null_array, }; use arrow_schema::{DataType, Field}; use config::{ + FxIndexMap, cluster::LOCAL_NODE, get_config, meta::{ @@ -31,13 +32,12 @@ use config::{ json, parquet::{read_recordbatch_from_bytes, write_recordbatch_to_parquet}, }, - FxIndexMap, }; use hashbrown::HashSet; use infra::{file_list as infra_file_list, storage}; use once_cell::sync::Lazy; use parking_lot::RwLock; -use tokio::sync::{mpsc, Semaphore}; +use tokio::sync::{Semaphore, mpsc}; use crate::{common::infra::cluster::get_node_from_consistent_hash, service::db}; diff --git a/src/service/compact/merge.rs b/src/service/compact/merge.rs index 0db54ee04d..c364bd7db8 100644 --- a/src/service/compact/merge.rs +++ b/src/service/compact/merge.rs @@ -21,6 +21,7 @@ use arrow_schema::{DataType, Field}; use bytes::Bytes; use chrono::{DateTime, Datelike, Duration, TimeZone, Timelike, Utc}; use config::{ + FILE_EXT_PARQUET, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, get_config, ider, is_local_disk_storage, meta::{ @@ -37,23 +38,21 @@ use config::{ schema_ext::SchemaExt, time::{day_micros, hour_micros}, }, - FILE_EXT_PARQUET, TIMESTAMP_COL_NAME, }; use hashbrown::{HashMap, HashSet}; use infra::{ cache::file_data, dist_lock, file_list as infra_file_list, schema::{ - get_stream_setting_bloom_filter_fields, get_stream_setting_fts_fields, + SchemaCache, get_stream_setting_bloom_filter_fields, get_stream_setting_fts_fields, get_stream_setting_index_fields, unwrap_partition_time_level, unwrap_stream_settings, - SchemaCache, }, storage, }; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::common::downsampling::get_largest_downsampling_rule; use tokio::{ - sync::{mpsc, Semaphore}, + sync::{Semaphore, mpsc}, task::JoinHandle, }; @@ -64,8 +63,8 @@ use crate::{ db, file_list, schema::generate_schema_for_defined_schema_fields, search::{ - datafusion::exec::{self, MergeParquetResult}, DATAFUSION_RUNTIME, + datafusion::exec::{self, MergeParquetResult}, }, stream, }, @@ -1018,7 +1017,10 @@ pub async fn merge_files( retain_file_list.len(), new_file_keys, new_file_metas.iter().map(|m| m.original_size).sum::(), - new_file_metas.iter().map(|m| m.compressed_size).sum::(), + new_file_metas + .iter() + .map(|m| m.compressed_size) + .sum::(), start.elapsed().as_millis(), ); } diff --git a/src/service/compact/mod.rs b/src/service/compact/mod.rs index 482a368b69..7001ae4420 100644 --- a/src/service/compact/mod.rs +++ b/src/service/compact/mod.rs @@ -19,7 +19,7 @@ use config::{ get_config, meta::{ cluster::{CompactionJobType, Role}, - stream::{PartitionTimeLevel, StreamType, ALL_STREAM_TYPES}, + stream::{ALL_STREAM_TYPES, PartitionTimeLevel, StreamType}, }, }; use infra::{ @@ -28,7 +28,7 @@ use infra::{ }; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::common::downsampling::get_matching_downsampling_rules; -use tokio::sync::{mpsc, Semaphore}; +use tokio::sync::{Semaphore, mpsc}; use crate::{common::infra::cluster::get_node_from_consistent_hash, service::db}; diff --git a/src/service/compact/retention.rs b/src/service/compact/retention.rs index fcfe552f28..5116b6ef2c 100644 --- a/src/service/compact/retention.rs +++ b/src/service/compact/retention.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -20,7 +20,7 @@ use config::{ cluster::LOCAL_NODE, get_config, is_local_disk_storage, meta::stream::{FileKey, FileListDeleted, FileMeta, PartitionTimeLevel, StreamType, TimeRange}, - utils::time::{hour_micros, BASE_TIME}, + utils::time::{BASE_TIME, hour_micros}, }; use infra::{cache, dist_lock, file_list as infra_file_list}; use itertools::Itertools; diff --git a/src/service/dashboards/mod.rs b/src/service/dashboards/mod.rs index 62750ebe03..1fea92c49c 100644 --- a/src/service/dashboards/mod.rs +++ b/src/service/dashboards/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ use config::{ ider, meta::{ dashboards::{Dashboard, ListDashboardsParams}, - folder::{Folder, FolderType, DEFAULT_FOLDER}, + folder::{DEFAULT_FOLDER, Folder, FolderType}, stream::{DistinctField, StreamType}, }, }; diff --git a/src/service/dashboards/reports.rs b/src/service/dashboards/reports.rs index 548a5940f2..29b355ab21 100644 --- a/src/service/dashboards/reports.rs +++ b/src/service/dashboards/reports.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,10 +17,10 @@ use std::{str::FromStr, time::Duration}; use actix_web::http; use async_trait::async_trait; -use chromiumoxide::{browser::Browser, cdp::browser_protocol::page::PrintToPdfParams, Page}; +use chromiumoxide::{Page, browser::Browser, cdp::browser_protocol::page::PrintToPdfParams}; use chrono::Timelike; use config::{ - get_chrome_launch_options, get_config, + SMTP_CLIENT, get_chrome_launch_options, get_config, meta::dashboards::{ datetime_now, reports::{ @@ -28,14 +28,13 @@ use config::{ ReportFrequencyType, ReportListFilters, ReportTimerangeType, }, }, - SMTP_CLIENT, }; use cron::Schedule; -use futures::{future::try_join_all, StreamExt}; +use futures::{StreamExt, future::try_join_all}; use infra::table; use lettre::{ - message::{header::ContentType, MultiPart, SinglePart}, AsyncTransport, Message, + message::{MultiPart, SinglePart, header::ContentType}, }; use reqwest::Client; diff --git a/src/service/dashboards/timed_annotations.rs b/src/service/dashboards/timed_annotations.rs index 36792e8ed2..221867fd71 100644 --- a/src/service/dashboards/timed_annotations.rs +++ b/src/service/dashboards/timed_annotations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/alerts/alert.rs b/src/service/db/alerts/alert.rs index 7e827f3068..030caa03ec 100644 --- a/src/service/db/alerts/alert.rs +++ b/src/service/db/alerts/alert.rs @@ -20,7 +20,7 @@ use config::meta::{ }; use infra::{ cluster_coordinator::alerts as cluster, - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, table::alerts as table, }; use sea_orm::{ConnectionTrait, TransactionTrait}; diff --git a/src/service/db/alerts/destinations.rs b/src/service/db/alerts/destinations.rs index d3d76b05b4..0099ed05ac 100644 --- a/src/service/db/alerts/destinations.rs +++ b/src/service/db/alerts/destinations.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -94,7 +94,9 @@ pub async fn set(destination: Destination) -> Result Result<(), DestinationError> { ) .await { - log::error!("[Destination] error triggering super cluster event to remove destination from cache: {e}"); + log::error!( + "[Destination] error triggering super cluster event to remove destination from cache: {e}" + ); } } diff --git a/src/service/db/alerts/mod.rs b/src/service/db/alerts/mod.rs index 4bb4622c77..9dc0ed7522 100644 --- a/src/service/db/alerts/mod.rs +++ b/src/service/db/alerts/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/alerts/realtime_triggers.rs b/src/service/db/alerts/realtime_triggers.rs index cc9c8b45d1..e206eca492 100644 --- a/src/service/db/alerts/realtime_triggers.rs +++ b/src/service/db/alerts/realtime_triggers.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/alerts/templates.rs b/src/service/db/alerts/templates.rs index 540dd9ac59..0f4b2c8ade 100644 --- a/src/service/db/alerts/templates.rs +++ b/src/service/db/alerts/templates.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -128,7 +128,9 @@ pub async fn delete(org_id: &str, name: &str) -> Result<(), TemplateError> { ) .await { - log::error!("[Template] error triggering super cluster event to remove template from cache: {e}"); + log::error!( + "[Template] error triggering super cluster event to remove template from cache: {e}" + ); } } diff --git a/src/service/db/compact/downsampling.rs b/src/service/db/compact/downsampling.rs index 1bf1040e00..986fb36df9 100644 --- a/src/service/db/compact/downsampling.rs +++ b/src/service/db/compact/downsampling.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use config::{cluster::LOCAL_NODE, meta::stream::StreamType, RwAHashMap}; +use config::{RwAHashMap, cluster::LOCAL_NODE, meta::stream::StreamType}; use once_cell::sync::Lazy; use crate::service::db; diff --git a/src/service/db/compact/file_list.rs b/src/service/db/compact/file_list.rs index 7cb602b329..2125f947eb 100644 --- a/src/service/db/compact/file_list.rs +++ b/src/service/db/compact/file_list.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/compact/files.rs b/src/service/db/compact/files.rs index 056f84a96f..468e3908d8 100644 --- a/src/service/db/compact/files.rs +++ b/src/service/db/compact/files.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use config::{cluster::LOCAL_NODE, meta::stream::StreamType, RwAHashMap}; +use config::{RwAHashMap, cluster::LOCAL_NODE, meta::stream::StreamType}; use once_cell::sync::Lazy; use crate::service::db; diff --git a/src/service/db/compact/mod.rs b/src/service/db/compact/mod.rs index 2c5fb0c71c..2feed55e84 100644 --- a/src/service/db/compact/mod.rs +++ b/src/service/db/compact/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/compact/organization.rs b/src/service/db/compact/organization.rs index d9ecceaf1a..79ec4614d8 100644 --- a/src/service/db/compact/organization.rs +++ b/src/service/db/compact/organization.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/compact/retention.rs b/src/service/db/compact/retention.rs index 653c23ef4e..a32b4f6ab3 100644 --- a/src/service/db/compact/retention.rs +++ b/src/service/db/compact/retention.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,9 +16,9 @@ use std::sync::Arc; use config::{ + RwHashMap, meta::stream::StreamType, utils::time::{hour_micros, now_micros}, - RwHashMap, }; use once_cell::sync::Lazy; diff --git a/src/service/db/dashboards/mod.rs b/src/service/db/dashboards/mod.rs index 136e7fa4fa..3d093d1214 100644 --- a/src/service/db/dashboards/mod.rs +++ b/src/service/db/dashboards/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/distinct_values.rs b/src/service/db/distinct_values.rs index 1a02ab15af..ee8213618b 100644 --- a/src/service/db/distinct_values.rs +++ b/src/service/db/distinct_values.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/enrichment_table.rs b/src/service/db/enrichment_table.rs index 005a728a8e..64f0eb9dcc 100644 --- a/src/service/db/enrichment_table.rs +++ b/src/service/db/enrichment_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/file_list/broadcast.rs b/src/service/db/file_list/broadcast.rs index 8995783544..d4bff3ed73 100644 --- a/src/service/db/file_list/broadcast.rs +++ b/src/service/db/file_list/broadcast.rs @@ -19,15 +19,15 @@ use config::{ cluster::LOCAL_NODE, get_config, meta::{ - cluster::{get_internal_grpc_token, Node, NodeStatus, Role, RoleGroup}, + cluster::{Node, NodeStatus, Role, RoleGroup, get_internal_grpc_token}, stream::FileKey, }, }; use hashbrown::HashMap; use once_cell::sync::Lazy; use proto::cluster_rpc; -use tokio::sync::{mpsc, RwLock}; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request}; +use tokio::sync::{RwLock, mpsc}; +use tonic::{Request, codec::CompressionEncoding, metadata::MetadataValue}; use crate::{common::infra::cluster, service::grpc::get_cached_channel}; diff --git a/src/service/db/file_list/mod.rs b/src/service/db/file_list/mod.rs index 1c3085d667..5904d39703 100644 --- a/src/service/db/file_list/mod.rs +++ b/src/service/db/file_list/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use config::{meta::stream::FileMeta, RwHashMap, RwHashSet}; +use config::{RwHashMap, RwHashSet, meta::stream::FileMeta}; use dashmap::{DashMap, DashSet}; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::{ diff --git a/src/service/db/instance.rs b/src/service/db/instance.rs index b182f27e78..f7c5c8ab9c 100644 --- a/src/service/db/instance.rs +++ b/src/service/db/instance.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/keys.rs b/src/service/db/keys.rs index a74a43d686..f978a0f75b 100644 --- a/src/service/db/keys.rs +++ b/src/service/db/keys.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -59,10 +59,18 @@ pub async fn add(entry: CipherEntry) -> Result<(), anyhow::Error> { match o2_enterprise::enterprise::super_cluster::queue::keys_put(entry.clone()).await { Ok(_) => { - log::info!("successfully sent key add notification to super cluster queue for {}/{}", entry.org,entry.name); + log::info!( + "successfully sent key add notification to super cluster queue for {}/{}", + entry.org, + entry.name + ); } Err(e) => { - log::error!("error in sending cipher key add notification to super cluster queue for {}/{} : {e}", entry.org,entry.name); + log::error!( + "error in sending cipher key add notification to super cluster queue for {}/{} : {e}", + entry.org, + entry.name + ); } } } @@ -96,11 +104,17 @@ pub async fn update(entry: CipherEntry) -> Result<(), errors::Error> { { Ok(_) => { log::info!( - "successfully sent cipher key update notification to super cluster queue for {}/{}",entry.org,entry.name + "successfully sent cipher key update notification to super cluster queue for {}/{}", + entry.org, + entry.name ); } Err(e) => { - log::error!("error in sending cipher key update notification to super cluster queue for {}/{} : {e}",entry.org,entry.name); + log::error!( + "error in sending cipher key update notification to super cluster queue for {}/{} : {e}", + entry.org, + entry.name + ); } } } @@ -137,7 +151,9 @@ pub async fn remove(org: &str, kind: EntryKind, name: &str) -> Result<(), errors ); } Err(e) => { - log::error!("error in sending cipher key delete notification to super cluster queue for {org}/{name} : {e}"); + log::error!( + "error in sending cipher key delete notification to super cluster queue for {org}/{name} : {e}" + ); } } } diff --git a/src/service/db/mod.rs b/src/service/db/mod.rs index fb93f07667..34803d249e 100644 --- a/src/service/db/mod.rs +++ b/src/service/db/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -48,7 +48,7 @@ pub mod syslog; pub mod user; pub mod version; -pub(crate) use infra_db::{get_coordinator, Event, NEED_WATCH, NO_NEED_WATCH}; +pub(crate) use infra_db::{Event, NEED_WATCH, NO_NEED_WATCH, get_coordinator}; #[inline] pub(crate) async fn get(key: &str) -> Result { diff --git a/src/service/db/pipeline.rs b/src/service/db/pipeline.rs index d5004b2400..655acf1174 100644 --- a/src/service/db/pipeline.rs +++ b/src/service/db/pipeline.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use std::sync::Arc; use config::meta::{ - pipeline::{components::PipelineSource, Pipeline}, + pipeline::{Pipeline, components::PipelineSource}, stream::StreamParams, }; use infra::{ @@ -196,7 +196,9 @@ async fn update_cache(event: PipelineTableEvent<'_>) { if let Err(e) = o2_enterprise::enterprise::super_cluster::queue::pipelines_delete(&key).await { - log::error!("[Pipeline] error triggering super cluster event to remove pipeline from cache: {e}"); + log::error!( + "[Pipeline] error triggering super cluster event to remove pipeline from cache: {e}" + ); } } } @@ -229,7 +231,9 @@ async fn update_cache(event: PipelineTableEvent<'_>) { ) .await { - log::error!("[Pipeline] error triggering super cluster event to add pipeline to cache: {e}"); + log::error!( + "[Pipeline] error triggering super cluster event to add pipeline to cache: {e}" + ); } } }; diff --git a/src/service/db/saved_view.rs b/src/service/db/saved_view.rs index ec7c37a744..e74820b24f 100644 --- a/src/service/db/saved_view.rs +++ b/src/service/db/saved_view.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/scheduler.rs b/src/service/db/scheduler.rs index 9c41980a9f..9a173c2912 100644 --- a/src/service/db/scheduler.rs +++ b/src/service/db/scheduler.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/schema.rs b/src/service/db/schema.rs index 980c505c05..d3740d96b1 100644 --- a/src/service/db/schema.rs +++ b/src/service/db/schema.rs @@ -29,8 +29,8 @@ use hashbrown::{HashMap, HashSet}; use infra::{ cache, schema::{ - unwrap_stream_settings, SchemaCache, STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS, - STREAM_SCHEMAS_COMPRESSED, STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, + STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS, STREAM_SCHEMAS_COMPRESSED, + STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, SchemaCache, unwrap_stream_settings, }, }; #[cfg(feature = "enterprise")] diff --git a/src/service/db/search_job/mod.rs b/src/service/db/search_job/mod.rs index 0910548220..5467228754 100644 --- a/src/service/db/search_job/mod.rs +++ b/src/service/db/search_job/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/search_job/search_job_partitions.rs b/src/service/db/search_job/search_job_partitions.rs index 4c0b220c53..cea059328b 100644 --- a/src/service/db/search_job/search_job_partitions.rs +++ b/src/service/db/search_job/search_job_partitions.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/search_job/search_job_results.rs b/src/service/db/search_job/search_job_results.rs index 61bd44b407..8509cad258 100644 --- a/src/service/db/search_job/search_job_results.rs +++ b/src/service/db/search_job/search_job_results.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/search_job/search_jobs.rs b/src/service/db/search_job/search_jobs.rs index 6044da5f2b..2aaf06255e 100644 --- a/src/service/db/search_job/search_jobs.rs +++ b/src/service/db/search_job/search_jobs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/db/short_url.rs b/src/service/db/short_url.rs index 11a540355c..b48341b6b7 100644 --- a/src/service/db/short_url.rs +++ b/src/service/db/short_url.rs @@ -15,7 +15,7 @@ use std::sync::Arc; -use anyhow::{anyhow, Context}; +use anyhow::{Context, anyhow}; use chrono::Utc; use config::get_config; use infra::{db::Event, table::short_urls}; @@ -203,7 +203,7 @@ mod cluster { mod super_cluster { use o2_enterprise::enterprise::common::infra::config::get_config as get_o2_config; - use super::{short_urls, SHORT_URL_KEY}; + use super::{SHORT_URL_KEY, short_urls}; /// Sends event to super cluster queue for a new short URL entry. pub async fn emit_put_event( diff --git a/src/service/db/version.rs b/src/service/db/version.rs index e93093b764..c792fc53c6 100644 --- a/src/service/db/version.rs +++ b/src/service/db/version.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/enrichment/mod.rs b/src/service/enrichment/mod.rs index 9b1c80e795..bd1f378452 100644 --- a/src/service/enrichment/mod.rs +++ b/src/service/enrichment/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/enrichment_table/geoip.rs b/src/service/enrichment_table/geoip.rs index f90d4fcf27..c193d239a9 100644 --- a/src/service/enrichment_table/geoip.rs +++ b/src/service/enrichment_table/geoip.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,12 +17,12 @@ use std::{collections::BTreeMap, fs, net::IpAddr, sync::Arc, time::SystemTime}; -use config::{get_config, MMDB_CITY_FILE_NAME}; +use config::{MMDB_CITY_FILE_NAME, get_config}; #[cfg(feature = "enterprise")] use maxminddb::geoip2::Enterprise; use maxminddb::{ - geoip2::{City, ConnectionType, Isp}, MaxMindDBError, Reader, + geoip2::{City, ConnectionType, Isp}, }; use serde::{Deserialize, Serialize}; use vector_enrichment::{Case, Condition, IndexHandle, Table}; diff --git a/src/service/enrichment_table/mod.rs b/src/service/enrichment_table/mod.rs index 7936fddfe5..04bb42bc9a 100644 --- a/src/service/enrichment_table/mod.rs +++ b/src/service/enrichment_table/mod.rs @@ -17,12 +17,13 @@ use std::{collections::HashMap, io::Error, sync::Arc}; use actix_multipart::Multipart; use actix_web::{ - http::{self, StatusCode}, HttpResponse, + http::{self, StatusCode}, }; use bytes::Bytes; use chrono::Utc; use config::{ + SIZE_IN_MB, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, get_config, meta::{ @@ -30,14 +31,13 @@ use config::{ stream::{PartitionTimeLevel, StreamType}, }, utils::{flatten::format_key, json, schema_ext::SchemaExt}, - SIZE_IN_MB, TIMESTAMP_COL_NAME, }; use futures::{StreamExt, TryStreamExt}; use infra::{ cache::stats, schema::{ - SchemaCache, STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS, STREAM_SCHEMAS_COMPRESSED, - STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, + STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS, STREAM_SCHEMAS_COMPRESSED, + STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, SchemaCache, }, }; diff --git a/src/service/exporter/mod.rs b/src/service/exporter/mod.rs index c51b5705c0..43f4259918 100644 --- a/src/service/exporter/mod.rs +++ b/src/service/exporter/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/exporter/otlp_metrics_exporter.rs b/src/service/exporter/otlp_metrics_exporter.rs index a60b59b115..42126b593d 100644 --- a/src/service/exporter/otlp_metrics_exporter.rs +++ b/src/service/exporter/otlp_metrics_exporter.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -21,10 +21,10 @@ use config::meta::otlp::OtlpRequestType; use opentelemetry::metrics::Result; use opentelemetry_proto::tonic::collector::metrics::v1::ExportMetricsServiceRequest; use opentelemetry_sdk::metrics::{ + InstrumentKind, data::{ResourceMetrics, Temporality}, exporter::PushMetricsExporter, reader::TemporalitySelector, - InstrumentKind, }; use crate::service::metrics::otlp::handle_otlp_request; diff --git a/src/service/folders.rs b/src/service/folders.rs index 1a3604df01..30160e5529 100644 --- a/src/service/folders.rs +++ b/src/service/folders.rs @@ -18,11 +18,11 @@ use config::{ meta::{ alerts::alert::ListAlertsParams, dashboards::ListDashboardsParams, - folder::{Folder, FolderType, DEFAULT_FOLDER}, + folder::{DEFAULT_FOLDER, Folder, FolderType}, }, }; use infra::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, table, }; diff --git a/src/service/functions.rs b/src/service/functions.rs index 2662d1d88f..3d50f8466d 100644 --- a/src/service/functions.rs +++ b/src/service/functions.rs @@ -16,8 +16,8 @@ use std::io::Error; use actix_web::{ - http::{self, StatusCode}, HttpResponse, + http::{self, StatusCode}, }; use config::{ meta::{ @@ -109,7 +109,7 @@ pub async fn test_run_function( return Ok(HttpResponse::BadRequest().json(MetaHttpResponse::error( StatusCode::BAD_REQUEST.into(), e.to_string(), - ))) + ))); } }; @@ -386,10 +386,7 @@ fn extract_num_args(func: &mut Transform) { } async fn check_existing_fn(org_id: &str, fn_name: &str) -> Option { - match db::functions::get(org_id, fn_name).await { - Ok(function) => Some(function), - Err(_) => None, - } + (db::functions::get(org_id, fn_name).await).ok() } #[cfg(test)] @@ -439,9 +436,11 @@ mod tests { let list_resp = list_functions("nexus".to_string(), None).await; assert!(list_resp.is_ok()); - assert!(delete_function("nexus".to_string(), "dummyfn".to_owned()) - .await - .is_ok()); + assert!( + delete_function("nexus".to_string(), "dummyfn".to_owned()) + .await + .is_ok() + ); } #[tokio::test] diff --git a/src/service/grpc.rs b/src/service/grpc.rs index 61b9187138..8b1a175d47 100644 --- a/src/service/grpc.rs +++ b/src/service/grpc.rs @@ -15,16 +15,16 @@ use std::sync::Arc; -use config::{get_config, meta::cluster::NodeInfo, utils::rand::get_rand_element, RwAHashMap}; +use config::{RwAHashMap, get_config, meta::cluster::NodeInfo, utils::rand::get_rand_element}; use infra::errors::{Error, ErrorCodes}; use once_cell::sync::Lazy; use proto::cluster_rpc::{self, metrics_client::MetricsClient, search_client::SearchClient}; use tonic::{ + Request, Status, codec::CompressionEncoding, metadata::{MetadataKey, MetadataValue}, service::interceptor::InterceptedService, transport::{Certificate, Channel, ClientTlsConfig}, - Request, Status, }; use tracing_opentelemetry::OpenTelemetrySpanExt; @@ -110,7 +110,9 @@ pub async fn make_grpc_search_client( request: &mut Request, node: &Arc, ) -> Result< - SearchClient) -> Result, Status>>>, + SearchClient< + InterceptedService) -> Result, Status> + use>, + >, Error, > { let cfg = get_config(); @@ -158,7 +160,9 @@ pub async fn make_grpc_metrics_client( request: &mut Request, node: &Arc, ) -> Result< - MetricsClient) -> Result, Status>>>, + MetricsClient< + InterceptedService) -> Result, Status> + use>, + >, Error, > { let cfg = get_config(); diff --git a/src/service/ingestion/grpc.rs b/src/service/ingestion/grpc.rs index 8ba52ff2fe..9b70e12dd5 100644 --- a/src/service/ingestion/grpc.rs +++ b/src/service/ingestion/grpc.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use config::utils::json; use opentelemetry_proto::tonic::{ - common::v1::{any_value::Value, AnyValue}, + common::v1::{AnyValue, any_value::Value}, metrics::v1::{exemplar, number_data_point}, }; diff --git a/src/service/ingestion/ingestion_service.rs b/src/service/ingestion/ingestion_service.rs index 05f5be9be8..5e4930ae4c 100644 --- a/src/service/ingestion/ingestion_service.rs +++ b/src/service/ingestion/ingestion_service.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,7 +16,7 @@ use anyhow::Error; use config::meta::cluster::get_internal_grpc_token; use proto::cluster_rpc; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request}; +use tonic::{Request, codec::CompressionEncoding, metadata::MetadataValue}; use crate::service::grpc::get_ingester_channel; diff --git a/src/service/ingestion/mod.rs b/src/service/ingestion/mod.rs index 347a1259a4..879e44e779 100644 --- a/src/service/ingestion/mod.rs +++ b/src/service/ingestion/mod.rs @@ -18,9 +18,10 @@ use std::{ sync::Arc, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::{Duration, TimeZone, Utc}; use config::{ + SIZE_IN_MB, TIMESTAMP_COL_NAME, cluster::{LOCAL_NODE, LOCAL_NODE_ID}, ider::SnowflakeIdGenerator, meta::{ @@ -33,12 +34,11 @@ use config::{ }, metrics, utils::{flatten, json::*, schema::format_partition_key}, - SIZE_IN_MB, TIMESTAMP_COL_NAME, }; use infra::schema::STREAM_RECORD_ID_GENERATOR; use proto::cluster_rpc::IngestionType; use vrl::{ - compiler::{runtime::Runtime, CompilationResult, TargetValueRef}, + compiler::{CompilationResult, TargetValueRef, runtime::Runtime}, prelude::state, }; @@ -545,7 +545,7 @@ pub fn create_log_ingestion_req( #[cfg(test)] mod tests { - use infra::schema::{unwrap_stream_settings, STREAM_SETTINGS}; + use infra::schema::{STREAM_SETTINGS, unwrap_stream_settings}; use super::*; diff --git a/src/service/logs/bulk.rs b/src/service/logs/bulk.rs index 47aa9342bb..24c67311ae 100644 --- a/src/service/logs/bulk.rs +++ b/src/service/logs/bulk.rs @@ -22,14 +22,13 @@ use actix_web::web; use anyhow::Result; use chrono::{Duration, Utc}; use config::{ - get_config, + BLOCKED_STREAMS, ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, get_config, meta::{ self_reporting::usage::UsageType, stream::{StreamParams, StreamType}, }, metrics, utils::{flatten, json, time::parse_timestamp_micro_from_value}, - BLOCKED_STREAMS, ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use super::{ingestion_log_enabled, log_failed_record}; diff --git a/src/service/logs/ingest.rs b/src/service/logs/ingest.rs index 53bb9d9be7..c32c0af1dc 100644 --- a/src/service/logs/ingest.rs +++ b/src/service/logs/ingest.rs @@ -22,18 +22,18 @@ use actix_web::http; use anyhow::Result; use chrono::{Duration, Utc}; use config::{ + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, meta::{ self_reporting::usage::UsageType, stream::{StreamParams, StreamType}, }, metrics, utils::{flatten, json, time::parse_timestamp_micro_from_value}, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use flate2::read::GzDecoder; use opentelemetry_proto::tonic::{ collector::metrics::v1::ExportMetricsServiceRequest, - common::v1::{any_value::Value, AnyValue, KeyValue}, + common::v1::{AnyValue, KeyValue, any_value::Value}, metrics::v1::metric::Data, }; use prost::Message; diff --git a/src/service/logs/mod.rs b/src/service/logs/mod.rs index 2d2a04da04..97b5a8b90a 100644 --- a/src/service/logs/mod.rs +++ b/src/service/logs/mod.rs @@ -24,7 +24,7 @@ use anyhow::Result; use arrow_schema::{DataType, Field}; use bulk::SCHEMA_CONFORMANCE_FAILED; use config::{ - get_config, + DISTINCT_FIELDS, get_config, meta::{ alerts::alert::Alert, self_reporting::usage::{RequestStats, UsageType}, @@ -32,19 +32,19 @@ use config::{ }, metrics, utils::{ - json::{estimate_json_bytes, get_string_value, pickup_string_value, Map, Value}, + json::{Map, Value, estimate_json_bytes, get_string_value, pickup_string_value}, schema_ext::SchemaExt, }, - DISTINCT_FIELDS, }; -use infra::schema::{unwrap_partition_time_level, SchemaCache}; +use infra::schema::{SchemaCache, unwrap_partition_time_level}; use super::{ db::organization::get_org_setting, - ingestion::{evaluate_trigger, write_file, TriggerAlertData}, + ingestion::{TriggerAlertData, evaluate_trigger, write_file}, metadata::{ - distinct_values::{DvItem, DISTINCT_STREAM_PREFIX}, - write, MetadataItem, MetadataType, + MetadataItem, MetadataType, + distinct_values::{DISTINCT_STREAM_PREFIX, DvItem}, + write, }, schema::stream_schema_exists, }; diff --git a/src/service/logs/otlp_grpc.rs b/src/service/logs/otlp_grpc.rs index ffff8cddc6..993d64e0ae 100644 --- a/src/service/logs/otlp_grpc.rs +++ b/src/service/logs/otlp_grpc.rs @@ -15,19 +15,18 @@ use std::collections::{HashMap, HashSet}; -use actix_web::{http, HttpResponse}; +use actix_web::{HttpResponse, http}; use anyhow::Result; use bytes::BytesMut; use chrono::{Duration, Utc}; use config::{ - get_config, + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, get_config, meta::{ self_reporting::usage::UsageType, stream::{StreamParams, StreamType}, }, metrics, utils::{flatten, json}, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use opentelemetry::trace::{SpanId, TraceId}; use opentelemetry_proto::tonic::collector::logs::v1::{ @@ -430,8 +429,8 @@ mod tests { use opentelemetry_proto::tonic::{ collector::logs::v1::ExportLogsServiceRequest, common::v1::{ - any_value::Value::{IntValue, StringValue}, AnyValue, InstrumentationScope, KeyValue, + any_value::Value::{IntValue, StringValue}, }, logs::v1::{LogRecord, ResourceLogs, ScopeLogs}, }; diff --git a/src/service/logs/otlp_http.rs b/src/service/logs/otlp_http.rs index abdfcc306a..2bd84d68c9 100644 --- a/src/service/logs/otlp_http.rs +++ b/src/service/logs/otlp_http.rs @@ -15,19 +15,18 @@ use std::collections::{HashMap, HashSet}; -use actix_web::{http, web, HttpResponse}; +use actix_web::{HttpResponse, http, web}; use anyhow::Result; use bytes::BytesMut; use chrono::{Duration, Utc}; use config::{ - get_config, + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, get_config, meta::{ self_reporting::usage::UsageType, stream::{StreamParams, StreamType}, }, metrics, utils::{flatten, json}, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use opentelemetry::trace::{SpanId, TraceId}; use opentelemetry_proto::tonic::collector::logs::v1::{ diff --git a/src/service/logs/syslog.rs b/src/service/logs/syslog.rs index 23eede989d..0954c5fd8a 100644 --- a/src/service/logs/syslog.rs +++ b/src/service/logs/syslog.rs @@ -18,18 +18,17 @@ use std::{ net::SocketAddr, }; -use actix_web::{http, HttpResponse}; +use actix_web::{HttpResponse, http}; use anyhow::Result; use chrono::{Duration, Utc}; use config::{ - get_config, + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, get_config, meta::{ self_reporting::usage::UsageType, stream::{StreamParams, StreamType}, }, metrics, utils::{flatten, json}, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use syslog_loose::{Message, ProcId, Protocol}; diff --git a/src/service/metadata/distinct_values.rs b/src/service/metadata/distinct_values.rs index d441f29c40..cff2d9bb68 100644 --- a/src/service/metadata/distinct_values.rs +++ b/src/service/metadata/distinct_values.rs @@ -16,17 +16,16 @@ use std::{ collections::HashMap, sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }, }; use arrow_schema::{DataType, Field, Schema}; use config::{ - get_config, + FxIndexMap, TIMESTAMP_COL_NAME, get_config, meta::stream::StreamType, utils::{json, schema::infer_json_schema_from_map}, - FxIndexMap, TIMESTAMP_COL_NAME, }; use infra::{ errors::{Error, Result}, @@ -36,7 +35,7 @@ use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use serde_json::{Map, Value}; use tokio::{ - sync::{mpsc, RwLock}, + sync::{RwLock, mpsc}, time, }; diff --git a/src/service/metadata/mod.rs b/src/service/metadata/mod.rs index 933a9e5220..f078e574de 100644 --- a/src/service/metadata/mod.rs +++ b/src/service/metadata/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/metadata/trace_list_index.rs b/src/service/metadata/trace_list_index.rs index adfffc63f9..3817dfbc5f 100644 --- a/src/service/metadata/trace_list_index.rs +++ b/src/service/metadata/trace_list_index.rs @@ -17,17 +17,16 @@ use std::{ collections::HashMap, hash::Hash, sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }, }; use arrow_schema::{DataType, Field, Schema}; use config::{ - get_config, + TIMESTAMP_COL_NAME, get_config, meta::stream::{StreamPartition, StreamSettings, StreamType}, utils::{json, schema_ext::SchemaExt}, - TIMESTAMP_COL_NAME, }; use infra::schema::unwrap_partition_time_level; use once_cell::sync::Lazy; @@ -239,8 +238,8 @@ mod tests { service::{ ingestion, metadata::{ - trace_list_index::{TraceListIndex, TraceListItem, STREAM_NAME}, Metadata, MetadataItem, + trace_list_index::{STREAM_NAME, TraceListIndex, TraceListItem}, }, }, }; diff --git a/src/service/metrics/json.rs b/src/service/metrics/json.rs index 96feade162..1d1e3e246f 100644 --- a/src/service/metrics/json.rs +++ b/src/service/metrics/json.rs @@ -16,21 +16,21 @@ use std::{collections::HashMap, io::BufReader, sync::Arc}; use actix_web::{http, web}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use config::{ + TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, meta::{ alerts::alert::Alert, - promql::{Metadata, HASH_LABEL, METADATA_LABEL, NAME_LABEL, TYPE_LABEL, VALUE_LABEL}, + promql::{HASH_LABEL, METADATA_LABEL, Metadata, NAME_LABEL, TYPE_LABEL, VALUE_LABEL}, self_reporting::usage::UsageType, stream::{PartitioningDetails, StreamParams, StreamType}, }, metrics, utils::{flatten, json, schema::infer_json_schema, schema_ext::SchemaExt, time}, - TIMESTAMP_COL_NAME, }; use datafusion::arrow::datatypes::Schema; -use infra::schema::{unwrap_partition_time_level, SchemaCache}; +use infra::schema::{SchemaCache, unwrap_partition_time_level}; use super::get_exclude_labels; use crate::{ @@ -42,7 +42,7 @@ use crate::{ service::{ alerts::alert::AlertExt, db, format_stream_name, - ingestion::{evaluate_trigger, get_write_partition_key, write_file, TriggerAlertData}, + ingestion::{TriggerAlertData, evaluate_trigger, get_write_partition_key, write_file}, pipeline::batch_execution::ExecutablePipeline, schema::check_for_schema, self_reporting::report_request_usage_stats, diff --git a/src/service/metrics/mod.rs b/src/service/metrics/mod.rs index 70df5d657e..709b4d43ce 100644 --- a/src/service/metrics/mod.rs +++ b/src/service/metrics/mod.rs @@ -14,8 +14,8 @@ // along with this program. If not, see . use config::{ - meta::promql::{Metadata, EXEMPLARS_LABEL, HASH_LABEL, METADATA_LABEL, VALUE_LABEL}, - utils::hash::{gxhash, Sum64}, + meta::promql::{EXEMPLARS_LABEL, HASH_LABEL, METADATA_LABEL, Metadata, VALUE_LABEL}, + utils::hash::{Sum64, gxhash}, }; use datafusion::arrow::datatypes::Schema; use once_cell::sync::Lazy; diff --git a/src/service/metrics/otlp.rs b/src/service/metrics/otlp.rs index 8ed451a717..466c8056b1 100644 --- a/src/service/metrics/otlp.rs +++ b/src/service/metrics/otlp.rs @@ -19,10 +19,11 @@ use std::{ sync::Arc, }; -use actix_web::{http, web, HttpResponse}; +use actix_web::{HttpResponse, http, web}; use bytes::BytesMut; use chrono::Utc; use config::{ + TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, meta::{ alerts::alert, @@ -33,10 +34,9 @@ use config::{ }, metrics, utils::{flatten, json, schema_ext::SchemaExt}, - TIMESTAMP_COL_NAME, }; use hashbrown::HashSet; -use infra::schema::{unwrap_partition_time_level, update_setting, SchemaCache}; +use infra::schema::{SchemaCache, unwrap_partition_time_level, update_setting}; use opentelemetry::trace::{SpanId, TraceId}; use opentelemetry_proto::tonic::{ collector::metrics::v1::{ @@ -52,9 +52,9 @@ use crate::{ alerts::alert::AlertExt, db, format_stream_name, ingestion::{ - evaluate_trigger, + TriggerAlertData, evaluate_trigger, grpc::{get_exemplar_val, get_metric_val, get_val}, - write_file, TriggerAlertData, + write_file, }, metrics::{format_label_name, get_exclude_labels}, pipeline::batch_execution::ExecutablePipeline, diff --git a/src/service/metrics/prom.rs b/src/service/metrics/prom.rs index 284c39d6c8..751600fe49 100644 --- a/src/service/metrics/prom.rs +++ b/src/service/metrics/prom.rs @@ -18,6 +18,7 @@ use std::{collections::HashMap, sync::Arc}; use actix_web::web; use chrono::{TimeZone, Utc}; use config::{ + FxIndexMap, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, get_config, meta::{ @@ -28,14 +29,13 @@ use config::{ }, metrics, utils::{json, schema_ext::SchemaExt, time::parse_i64_to_timestamp_micros}, - FxIndexMap, TIMESTAMP_COL_NAME, }; use datafusion::arrow::datatypes::Schema; use hashbrown::HashSet; use infra::{ cache::stats, errors::{Error, Result}, - schema::{unwrap_partition_time_level, update_setting, SchemaCache}, + schema::{SchemaCache, unwrap_partition_time_level, update_setting}, }; use promql_parser::{label::MatchOp, parser}; use prost::Message; @@ -49,7 +49,7 @@ use crate::{ service::{ alerts::alert::AlertExt, db, format_stream_name, - ingestion::{evaluate_trigger, write_file, TriggerAlertData}, + ingestion::{TriggerAlertData, evaluate_trigger, write_file}, metrics::format_label_name, pipeline::batch_execution::ExecutablePipeline, schema::{check_for_schema, stream_schema_exists}, diff --git a/src/service/pipeline/batch_execution.rs b/src/service/pipeline/batch_execution.rs index c2b404b8e7..d8e15b9cee 100644 --- a/src/service/pipeline/batch_execution.rs +++ b/src/service/pipeline/batch_execution.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,26 +15,26 @@ use std::collections::{HashMap, HashSet}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use chrono::Utc; use config::{ meta::{ function::{Transform, VRLResultResolver}, - pipeline::{components::NodeData, Pipeline}, + pipeline::{Pipeline, components::NodeData}, self_reporting::error::{ErrorData, ErrorSource, PipelineError}, stream::{StreamParams, StreamType}, }, utils::{ flatten, - json::{get_string_value, Value}, + json::{Value, get_string_value}, }, }; use futures::future::try_join_all; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::pipeline::pipeline_wal_writer::get_pipeline_wal_writer; use once_cell::sync::Lazy; -use tokio::sync::mpsc::{channel, Receiver, Sender}; +use tokio::sync::mpsc::{Receiver, Sender, channel}; use crate::{ common::infra::config::QUERY_FUNCTIONS, @@ -526,7 +526,9 @@ async fn process_node( } resolve_res => { let err_msg = if let Err(e) = resolve_res { - format!("Dynamic stream name detected in destination, but failed to resolve due to {e}. Record dropped") + format!( + "Dynamic stream name detected in destination, but failed to resolve due to {e}. Record dropped" + ) } else { "Dynamic Stream Name resolved to empty. Record dropped" .to_string() @@ -718,8 +720,8 @@ async fn process_node( .await { log::error!( - "[Pipeline({pipeline_id})]: DestinationNode failed sending errors for collection caused by: {send_err}" - ); + "[Pipeline({pipeline_id})]: DestinationNode failed sending errors for collection caused by: {send_err}" + ); } } } diff --git a/src/service/pipeline/mod.rs b/src/service/pipeline/mod.rs index 7690794aa3..cd51060b88 100644 --- a/src/service/pipeline/mod.rs +++ b/src/service/pipeline/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,7 +14,7 @@ // along with this program. If not, see . use config::meta::{ - pipeline::{components::PipelineSource, Pipeline, PipelineList}, + pipeline::{Pipeline, PipelineList, components::PipelineSource}, search::SearchEventType, stream::ListStreamParams, }; @@ -45,7 +45,7 @@ pub async fn save_pipeline(mut pipeline: Pipeline) -> Result<(), PipelineError> } // Save DerivedStream details if there's any - if let PipelineSource::Scheduled(ref mut derived_stream) = &mut pipeline.source { + if let PipelineSource::Scheduled(derived_stream) = &mut pipeline.source { derived_stream.query_condition.search_event_type = Some(SearchEventType::DerivedStream); derived_stream.org_id = pipeline.org.clone(); // save derived_stream to triggers table @@ -119,7 +119,7 @@ pub async fn update_pipeline(mut pipeline: Pipeline) -> Result<(), PipelineError pipeline.version += 1; // Save DerivedStream details if there's any - if let PipelineSource::Scheduled(ref mut derived_stream) = &mut pipeline.source { + if let PipelineSource::Scheduled(derived_stream) = &mut pipeline.source { derived_stream.query_condition.search_event_type = Some(SearchEventType::DerivedStream); if let Err(e) = super::alerts::derived_streams::save( derived_stream.clone(), @@ -177,7 +177,7 @@ pub async fn enable_pipeline( pipeline.enabled = value; // add or remove trigger if it's a scheduled pipeline - if let PipelineSource::Scheduled(ref mut derived_stream) = &mut pipeline.source { + if let PipelineSource::Scheduled(derived_stream) = &mut pipeline.source { derived_stream.query_condition.search_event_type = Some(SearchEventType::DerivedStream); if pipeline.enabled { super::alerts::derived_streams::save( diff --git a/src/service/promql/aggregations/bottomk.rs b/src/service/promql/aggregations/bottomk.rs index 798df796ea..65c427781b 100644 --- a/src/service/promql/aggregations/bottomk.rs +++ b/src/service/promql/aggregations/bottomk.rs @@ -16,7 +16,7 @@ use datafusion::error::Result; use promql_parser::parser::{Expr as PromExpr, LabelModifier}; -use crate::service::promql::{value::Value, Engine}; +use crate::service::promql::{Engine, value::Value}; pub async fn bottomk( ctx: &mut Engine, diff --git a/src/service/promql/aggregations/count_values.rs b/src/service/promql/aggregations/count_values.rs index 7bfc3ec814..c3d5813173 100644 --- a/src/service/promql/aggregations/count_values.rs +++ b/src/service/promql/aggregations/count_values.rs @@ -17,8 +17,8 @@ use datafusion::error::{DataFusionError, Result}; use promql_parser::parser::{Expr as PromExpr, LabelModifier}; use crate::service::promql::{ - value::{InstantValue, Label, Sample, Value}, Engine, + value::{InstantValue, Label, Sample, Value}, }; pub async fn count_values( diff --git a/src/service/promql/aggregations/max.rs b/src/service/promql/aggregations/max.rs index 13e386d904..d5dec8a9f1 100644 --- a/src/service/promql/aggregations/max.rs +++ b/src/service/promql/aggregations/max.rs @@ -25,11 +25,7 @@ pub fn max(timestamp: i64, param: &Option, data: Value) -> Result data, "max", |prev, val| { - if prev >= val { - prev - } else { - val - } + if prev >= val { prev } else { val } }, )?; if score_values.is_none() { diff --git a/src/service/promql/aggregations/min.rs b/src/service/promql/aggregations/min.rs index f3664debc2..91309c95ab 100644 --- a/src/service/promql/aggregations/min.rs +++ b/src/service/promql/aggregations/min.rs @@ -20,11 +20,7 @@ use crate::service::promql::{aggregations::score_to_instant_value, value::Value} pub fn min(timestamp: i64, param: &Option, data: Value) -> Result { let score_values = super::eval_arithmetic(param, data, "min", |prev, val| { - if prev > 0.0 && prev <= val { - prev - } else { - val - } + if prev > 0.0 && prev <= val { prev } else { val } })?; if score_values.is_none() { return Ok(Value::None); diff --git a/src/service/promql/aggregations/mod.rs b/src/service/promql/aggregations/mod.rs index 6a679a0e67..b4fb262a20 100644 --- a/src/service/promql/aggregations/mod.rs +++ b/src/service/promql/aggregations/mod.rs @@ -15,14 +15,14 @@ use std::{collections::HashMap, sync::Arc}; -use config::{meta::promql::NAME_LABEL, utils::sort::sort_float, FxIndexMap}; +use config::{FxIndexMap, meta::promql::NAME_LABEL, utils::sort::sort_float}; use datafusion::error::{DataFusionError, Result}; use promql_parser::parser::{Expr as PromExpr, LabelModifier}; use rayon::prelude::*; use crate::service::promql::{ - value::{InstantValue, Label, Labels, LabelsExt, Sample, Value}, Engine, + value::{InstantValue, Label, Labels, LabelsExt, Sample, Value}, }; mod avg; diff --git a/src/service/promql/aggregations/quantile.rs b/src/service/promql/aggregations/quantile.rs index 6c42a7afb7..ac2d04fd98 100644 --- a/src/service/promql/aggregations/quantile.rs +++ b/src/service/promql/aggregations/quantile.rs @@ -18,7 +18,7 @@ use promql_parser::parser::Expr as PromExpr; use rayon::prelude::*; use crate::service::promql::{ - aggregations::prepare_vector, common::quantile as calculate_quantile, value::Value, Engine, + Engine, aggregations::prepare_vector, common::quantile as calculate_quantile, value::Value, }; pub async fn quantile( diff --git a/src/service/promql/aggregations/topk.rs b/src/service/promql/aggregations/topk.rs index cd15b581cb..7f834532e6 100644 --- a/src/service/promql/aggregations/topk.rs +++ b/src/service/promql/aggregations/topk.rs @@ -16,7 +16,7 @@ use datafusion::error::Result; use promql_parser::parser::{Expr as PromExpr, LabelModifier}; -use crate::service::promql::{value::Value, Engine}; +use crate::service::promql::{Engine, value::Value}; pub async fn topk( ctx: &mut Engine, diff --git a/src/service/promql/binaries/vector_operations.rs b/src/service/promql/binaries/vector_operations.rs index 693588b8e8..85bf2451e4 100644 --- a/src/service/promql/binaries/vector_operations.rs +++ b/src/service/promql/binaries/vector_operations.rs @@ -20,12 +20,12 @@ use std::{ use config::meta::promql::NAME_LABEL; use datafusion::error::{DataFusionError, Result}; -use promql_parser::parser::{token, BinaryExpr, VectorMatchCardinality}; +use promql_parser::parser::{BinaryExpr, VectorMatchCardinality, token}; use rayon::prelude::*; use crate::service::promql::{ binaries::scalar_binary_operations, - value::{signature, InstantValue, Label, LabelsExt, Sample, Value}, + value::{InstantValue, Label, LabelsExt, Sample, Value, signature}, }; // DROP_METRIC_VECTOR_BIN_OP if the operation is one of these, drop the metric diff --git a/src/service/promql/engine.rs b/src/service/promql/engine.rs index 3f62c44f0c..1ac4e69df1 100644 --- a/src/service/promql/engine.rs +++ b/src/service/promql/engine.rs @@ -18,9 +18,9 @@ use std::{collections::HashSet, str::FromStr, sync::Arc, time::Duration}; use arrow::array::Array; use async_recursion::async_recursion; use config::{ - meta::promql::{HashLabelValue, EXEMPLARS_LABEL, HASH_LABEL, NAME_LABEL, VALUE_LABEL}, - utils::json, TIMESTAMP_COL_NAME, + meta::promql::{EXEMPLARS_LABEL, HASH_LABEL, HashLabelValue, NAME_LABEL, VALUE_LABEL}, + utils::json, }; use datafusion::{ arrow::{ @@ -29,26 +29,26 @@ use datafusion::{ }, error::{DataFusionError, Result}, functions_aggregate::min_max::max, - prelude::{col, lit, DataFrame, SessionContext}, + prelude::{DataFrame, SessionContext, col, lit}, }; -use futures::{future::try_join_all, TryStreamExt}; +use futures::{TryStreamExt, future::try_join_all}; use hashbrown::HashMap; use promql_parser::{ label::MatchOp, parser::{ - token, AggregateExpr, BinModifier, BinaryExpr, Call, Expr as PromExpr, Function, - FunctionArgs, LabelModifier, MatrixSelector, NumberLiteral, Offset, ParenExpr, - StringLiteral, UnaryExpr, VectorMatchCardinality, VectorSelector, + AggregateExpr, BinModifier, BinaryExpr, Call, Expr as PromExpr, Function, FunctionArgs, + LabelModifier, MatrixSelector, NumberLiteral, Offset, ParenExpr, StringLiteral, UnaryExpr, + VectorMatchCardinality, VectorSelector, token, }, }; use rayon::iter::{IntoParallelRefMutIterator, ParallelIterator}; use super::{ - utils::{apply_label_selector, apply_matchers}, PromqlContext, + utils::{apply_label_selector, apply_matchers}, }; use crate::service::promql::{ - aggregations, binaries, functions, micros, value::*, DEFAULT_MAX_SERIES_PER_QUERY, + DEFAULT_MAX_SERIES_PER_QUERY, aggregations, binaries, functions, micros, value::*, }; pub struct Engine { @@ -529,7 +529,10 @@ impl Engine { let metrics = match self.selector_load_data_inner(selector, range).await { Ok(v) => v, Err(e) => { - log::error!("[trace_id: {}] [PromQL] Failed to load data for stream: {table_name}, error: {e:?}", self.trace_id); + log::error!( + "[trace_id: {}] [PromQL] Failed to load data for stream: {table_name}, error: {e:?}", + self.trace_id + ); data_loaded.insert(table_name.to_string()); return Err(e); } diff --git a/src/service/promql/exec.rs b/src/service/promql/exec.rs index f17e5b31ae..5e3f068a39 100644 --- a/src/service/promql/exec.rs +++ b/src/service/promql/exec.rs @@ -26,8 +26,8 @@ use tokio::sync::{Mutex, RwLock, Semaphore}; use super::Engine; use crate::service::promql::{ - micros, micros_since_epoch, selector_visitor::MetricSelectorVisitor, value::*, TableProvider, - DEFAULT_LOOKBACK, + DEFAULT_LOOKBACK, TableProvider, micros, micros_since_epoch, + selector_visitor::MetricSelectorVisitor, value::*, }; #[derive(Clone)] diff --git a/src/service/promql/functions/delta.rs b/src/service/promql/functions/delta.rs index b6aa07903c..a7b6d34fbe 100644 --- a/src/service/promql/functions/delta.rs +++ b/src/service/promql/functions/delta.rs @@ -15,7 +15,7 @@ use datafusion::error::Result; -use crate::service::promql::value::{extrapolated_rate, ExtrapolationKind, RangeValue, Value}; +use crate::service::promql::value::{ExtrapolationKind, RangeValue, Value, extrapolated_rate}; pub(crate) fn delta(data: Value) -> Result { super::eval_idelta(data, "delta", exec, false) diff --git a/src/service/promql/functions/histogram.rs b/src/service/promql/functions/histogram.rs index ec3834153f..48ed9e1ddb 100644 --- a/src/service/promql/functions/histogram.rs +++ b/src/service/promql/functions/histogram.rs @@ -21,7 +21,7 @@ use datafusion::error::{DataFusionError, Result}; use hashbrown::HashMap; use crate::service::promql::value::{ - signature_without_labels, InstantValue, Labels, LabelsExt, Sample, Value, + InstantValue, Labels, LabelsExt, Sample, Value, signature_without_labels, }; // https://github.com/prometheus/prometheus/blob/cf1bea344a3c390a90c35ea8764c4a468b345d5e/promql/quantile.go#L33 diff --git a/src/service/promql/functions/increase.rs b/src/service/promql/functions/increase.rs index c8714f683c..8ba8b3ab45 100644 --- a/src/service/promql/functions/increase.rs +++ b/src/service/promql/functions/increase.rs @@ -15,7 +15,7 @@ use datafusion::error::Result; -use crate::service::promql::value::{extrapolated_rate, ExtrapolationKind, RangeValue, Value}; +use crate::service::promql::value::{ExtrapolationKind, RangeValue, Value, extrapolated_rate}; pub(crate) fn increase(data: Value) -> Result { super::eval_idelta(data, "increase", exec, false) diff --git a/src/service/promql/functions/rate.rs b/src/service/promql/functions/rate.rs index 256970e725..04b6746833 100644 --- a/src/service/promql/functions/rate.rs +++ b/src/service/promql/functions/rate.rs @@ -15,7 +15,7 @@ use datafusion::error::Result; -use crate::service::promql::value::{extrapolated_rate, ExtrapolationKind, RangeValue, Value}; +use crate::service::promql::value::{ExtrapolationKind, RangeValue, Value, extrapolated_rate}; pub(crate) fn rate(data: Value) -> Result { super::eval_idelta(data, "rate", exec, false) diff --git a/src/service/promql/search/cache/mod.rs b/src/service/promql/search/cache/mod.rs index a38ba7065c..6235898f0b 100644 --- a/src/service/promql/search/cache/mod.rs +++ b/src/service/promql/search/cache/mod.rs @@ -16,15 +16,15 @@ use std::{ collections::VecDeque, sync::{ - atomic::{AtomicI64, Ordering}, Arc, + atomic::{AtomicI64, Ordering}, }, }; use config::{ get_config, utils::{ - hash::{gxhash, Sum64}, + hash::{Sum64, gxhash}, time::{now, now_micros, second_micros}, }, }; @@ -408,7 +408,7 @@ fn parse_cache_item_key(key: &str) -> Option<(String, i64, i64)> { if !key.starts_with("metrics_results/") || !key.ends_with(".pb") { return None; } - let item_key = key.split('/').last().unwrap_or(""); + let item_key = key.split('/').next_back().unwrap_or(""); let parts = item_key.split('_').collect::>(); if parts.len() != 4 { return None; diff --git a/src/service/promql/search/grpc/mod.rs b/src/service/promql/search/grpc/mod.rs index 555e32eb4f..ef54dffc0b 100644 --- a/src/service/promql/search/grpc/mod.rs +++ b/src/service/promql/search/grpc/mod.rs @@ -35,7 +35,7 @@ use rayon::slice::ParallelSliceMut; use super::Value; use crate::service::{ - promql::{name_visitor, value, PromqlContext, TableProvider, DEFAULT_LOOKBACK}, + promql::{DEFAULT_LOOKBACK, PromqlContext, TableProvider, name_visitor, value}, search, }; @@ -161,7 +161,7 @@ pub async fn search( let resp = search_inner(&req).await?; log::info!( "[trace_id {trace_id}] promql->search->grpc: group[{start}, {end}] get resp, took: {} ms", - start_time.elapsed().as_millis() + start_time.elapsed().as_millis() ); results.push(resp); } diff --git a/src/service/promql/search/grpc/storage.rs b/src/service/promql/search/grpc/storage.rs index 2803c3f35d..49e7118db5 100644 --- a/src/service/promql/search/grpc/storage.rs +++ b/src/service/promql/search/grpc/storage.rs @@ -16,13 +16,12 @@ use std::sync::Arc; use config::{ - get_config, is_local_disk_storage, + TIMESTAMP_COL_NAME, get_config, is_local_disk_storage, meta::{ promql::VALUE_LABEL, search::{ScanStats, Session as SearchSession, StorageType}, stream::{FileKey, PartitionTimeLevel, StreamParams, StreamPartition, StreamType}, }, - TIMESTAMP_COL_NAME, }; use datafusion::{ arrow::datatypes::Schema, @@ -43,7 +42,7 @@ use crate::service::{ db, file_list, search::{ datafusion::exec::register_table, - grpc::{storage::filter_file_list_by_tantivy_index, QueryParams}, + grpc::{QueryParams, storage::filter_file_list_by_tantivy_index}, index::{Condition, IndexCondition}, match_source, }, @@ -184,7 +183,9 @@ pub(crate) async fn create_context( ); DataFusionError::Execution(e.to_string()) })?; - log::info!("[trace_id {trace_id}] promql->search->storage: filter file list by tantivy index took: {idx_took} ms",); + log::info!( + "[trace_id {trace_id}] promql->search->storage: filter file list by tantivy index took: {idx_took} ms", + ); } let session = SearchSession { @@ -298,7 +299,11 @@ async fn cache_parquet_files( _ => None, }; let ret = if let Some(e) = ret { - log::warn!("[trace_id {trace_id}] promql->search->storage: download file to cache err: {}, file: {}", e, file_name); + log::warn!( + "[trace_id {trace_id}] promql->search->storage: download file to cache err: {}, file: {}", + e, + file_name + ); Some(file_name) } else { None diff --git a/src/service/promql/search/grpc/wal.rs b/src/service/promql/search/grpc/wal.rs index 733482de47..81f95cc0b1 100644 --- a/src/service/promql/search/grpc/wal.rs +++ b/src/service/promql/search/grpc/wal.rs @@ -20,16 +20,15 @@ use std::{ use arrow::record_batch::RecordBatch; use config::{ - get_config, + TIMESTAMP_COL_NAME, get_config, meta::{cluster::IntoArcVec, search::ScanStats, stream::StreamType}, - TIMESTAMP_COL_NAME, }; use datafusion::{ arrow::datatypes::Schema, datasource::MemTable, error::{DataFusionError, Result}, physical_plan::visit_execution_plan, - prelude::{col, lit, SessionContext}, + prelude::{SessionContext, col, lit}, }; use promql_parser::label::Matchers; use proto::cluster_rpc::{self, IndexInfo, QueryIdentifier}; diff --git a/src/service/promql/search/mod.rs b/src/service/promql/search/mod.rs index c7f8f4f300..628b4a81f6 100644 --- a/src/service/promql/search/mod.rs +++ b/src/service/promql/search/mod.rs @@ -35,15 +35,15 @@ use futures::future::try_join_all; use hashbrown::HashMap; use infra::errors::{Error, ErrorCodes, Result}; use proto::cluster_rpc; -use tracing::{info_span, Instrument}; +use tracing::{Instrument, info_span}; use crate::{ common::infra::cluster, service::{ grpc::make_grpc_metrics_client, promql::{ - adjust_start_end, micros, value::*, MetricsQueryRequest, DEFAULT_LOOKBACK, - DEFAULT_MAX_POINTS_PER_SERIES, + DEFAULT_LOOKBACK, DEFAULT_MAX_POINTS_PER_SERIES, MetricsQueryRequest, adjust_start_end, + micros, value::*, }, search::server_internal_error, self_reporting::report_request_usage_stats, @@ -105,7 +105,10 @@ async fn search_in_cluster( "[trace_id {trace_id}] promql->search->start: org_id: {}, no_cache: {}, time_range: [{},{}), step: {}, query: {}", req.org_id, cache_disabled, - start,end,step,query, + start, + end, + step, + query, ); // get querier nodes from cluster diff --git a/src/service/promql/utils.rs b/src/service/promql/utils.rs index 80dbf440d4..1b23015776 100644 --- a/src/service/promql/utils.rs +++ b/src/service/promql/utils.rs @@ -16,13 +16,13 @@ use std::collections::HashSet; use config::{ - meta::promql::{BUCKET_LABEL, HASH_LABEL, VALUE_LABEL}, TIMESTAMP_COL_NAME, + meta::promql::{BUCKET_LABEL, HASH_LABEL, VALUE_LABEL}, }; use datafusion::{ arrow::datatypes::Schema, error::Result, - prelude::{col, lit, DataFrame}, + prelude::{DataFrame, col, lit}, }; use promql_parser::label::{MatchOp, Matchers}; diff --git a/src/service/promql/value.rs b/src/service/promql/value.rs index d9f739e5bc..c3a1679210 100644 --- a/src/service/promql/value.rs +++ b/src/service/promql/value.rs @@ -16,16 +16,16 @@ use std::{fmt, hash::Hasher, sync::Arc, time::Duration}; use config::{ - utils::{json, sort::sort_float}, FxIndexMap, + utils::{json, sort::sort_float}, }; use hashbrown::HashSet; use once_cell::sync::Lazy; use regex::Regex; use serde::{ + Deserialize, Serialize, de::{Deserializer, SeqAccess, Visitor}, ser::{SerializeSeq, SerializeStruct, Serializer}, - Deserialize, Serialize, }; // https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels diff --git a/src/service/schema.rs b/src/service/schema.rs index aa39a8430d..b7bfafb337 100644 --- a/src/service/schema.rs +++ b/src/service/schema.rs @@ -17,19 +17,19 @@ use std::{collections::HashMap, sync::Arc}; use anyhow::Result; use config::{ + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, SQL_FULL_TEXT_SEARCH_FIELDS, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE_ID, get_config, ider::SnowflakeIdGenerator, meta::{promql::METADATA_LABEL, stream::StreamType}, metrics, utils::{json, schema::infer_json_schema_from_map, schema_ext::SchemaExt}, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, SQL_FULL_TEXT_SEARCH_FIELDS, TIMESTAMP_COL_NAME, }; use datafusion::arrow::datatypes::{Field, Schema}; use hashbrown::HashSet; use infra::schema::{ - unwrap_stream_settings, SchemaCache, STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS_LATEST, - STREAM_SETTINGS, + STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, SchemaCache, + unwrap_stream_settings, }; use serde_json::{Map, Value}; diff --git a/src/service/search/cache/cacher.rs b/src/service/search/cache/cacher.rs index 7dee966b5d..f6819ec275 100644 --- a/src/service/search/cache/cacher.rs +++ b/src/service/search/cache/cacher.rs @@ -16,10 +16,9 @@ use bytes::Bytes; use chrono::Utc; use config::{ - get_config, + TIMESTAMP_COL_NAME, get_config, meta::{search::Response, sql::OrderBy, stream::StreamType}, utils::{file::scan_files, json}, - TIMESTAMP_COL_NAME, }; use infra::cache::{ file_data::disk::{self, QUERY_RESULT_CACHE}, @@ -31,10 +30,10 @@ use crate::{ common::meta::search::{CacheQueryRequest, CachedQueryResponse, QueryDelta}, service::search::{ cache::{ - result_utils::{get_ts_value, round_down_to_nearest_minute}, MultiCachedQueryResponse, + result_utils::{get_ts_value, round_down_to_nearest_minute}, }, - sql::{generate_histogram_interval, Sql, RE_HISTOGRAM, RE_SELECT_FROM}, + sql::{RE_HISTOGRAM, RE_SELECT_FROM, Sql, generate_histogram_interval}, }, }; @@ -743,9 +742,9 @@ fn calculate_deltas_multi( // Check if there is a gap at the end if current_end_time < end_time - && results.last().map_or(false, |last_meta| { - !last_meta.cached_response.hits.is_empty() - }) + && results + .last() + .is_some_and(|last_meta| !last_meta.cached_response.hits.is_empty()) { deltas.push(QueryDelta { // Adding histogram interval to the current end time to ensure the next query diff --git a/src/service/search/cache/mod.rs b/src/service/search/cache/mod.rs index c347c01f39..d8f691f1fa 100644 --- a/src/service/search/cache/mod.rs +++ b/src/service/search/cache/mod.rs @@ -17,7 +17,7 @@ use std::str::FromStr; use chrono::{TimeZone, Utc}; use config::{ - get_config, + TIMESTAMP_COL_NAME, get_config, meta::{ search::{self, ResponseTook}, self_reporting::usage::{RequestStats, UsageType}, @@ -26,7 +26,6 @@ use config::{ }, metrics, utils::{base64, hash::Sum64, json, sql::is_aggregate_query}, - TIMESTAMP_COL_NAME, }; use infra::{ cache::{file_data::disk::QUERY_RESULT_CACHE, meta::ResultCacheMeta}, @@ -446,10 +445,8 @@ pub fn merge_response( && !search_response.is_empty() && search_response .first() - .map_or(true, |res| res.hits.is_empty()) - && search_response - .last() - .map_or(true, |res| res.hits.is_empty()) + .is_none_or(|res| res.hits.is_empty()) + && search_response.last().is_none_or(|res| res.hits.is_empty()) { for res in search_response { cache_response.total += res.total; diff --git a/src/service/search/cache/multi.rs b/src/service/search/cache/multi.rs index d7a3e11558..b71b178711 100644 --- a/src/service/search/cache/multi.rs +++ b/src/service/search/cache/multi.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -24,8 +24,8 @@ use super::{cacher::get_results, sort_response}; use crate::{ common::meta::search::{CacheQueryRequest, ResultCacheSelectionStrategy}, service::search::cache::{ - result_utils::{get_ts_value, round_down_to_nearest_minute}, CachedQueryResponse, + result_utils::{get_ts_value, round_down_to_nearest_minute}, }, }; diff --git a/src/service/search/cache/result_utils.rs b/src/service/search/cache/result_utils.rs index de8210f75b..d9163d2c63 100644 --- a/src/service/search/cache/result_utils.rs +++ b/src/service/search/cache/result_utils.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/cluster/cache_multi.rs b/src/service/search/cluster/cache_multi.rs index ad35525dea..e9e9b900f1 100644 --- a/src/service/search/cluster/cache_multi.rs +++ b/src/service/search/cluster/cache_multi.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,8 +18,8 @@ use std::str::FromStr; use config::{cluster::LOCAL_NODE, get_config, meta::cluster::get_internal_grpc_token}; use infra::errors::{Error, ErrorCodes}; use proto::cluster_rpc::{self, QueryCacheRequest}; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request}; -use tracing::{info_span, Instrument}; +use tonic::{Request, codec::CompressionEncoding, metadata::MetadataValue}; +use tracing::{Instrument, info_span}; use crate::{ common::meta::search::{CacheQueryRequest, CachedQueryResponse, ResultCacheSelectionStrategy}, diff --git a/src/service/search/cluster/cacher.rs b/src/service/search/cluster/cacher.rs index 175cdd9825..0bb9f5f3e0 100644 --- a/src/service/search/cluster/cacher.rs +++ b/src/service/search/cluster/cacher.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,8 +16,8 @@ use config::{cluster::LOCAL_NODE, meta::cluster::get_internal_grpc_token}; use infra::errors::{Error, ErrorCodes}; use proto::cluster_rpc::{self, DeleteResultCacheRequest, QueryCacheRequest}; -use tonic::{codec::CompressionEncoding, metadata::MetadataValue, Request}; -use tracing::{info_span, Instrument}; +use tonic::{Request, codec::CompressionEncoding, metadata::MetadataValue}; +use tracing::{Instrument, info_span}; use crate::{ common::meta::search::{CacheQueryRequest, CachedQueryResponse}, diff --git a/src/service/search/cluster/flight.rs b/src/service/search/cluster/flight.rs index cd2d97010a..4259233daa 100644 --- a/src/service/search/cluster/flight.rs +++ b/src/service/search/cluster/flight.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use arrow::array::RecordBatch; use async_recursion::async_recursion; use config::{ - get_config, + INDEX_FIELD_NAME_FOR_ALL, QUERY_WITH_NO_LIMIT, get_config, meta::{ bitvec::BitVec, cluster::{IntoArcVec, Node, Role, RoleGroup}, @@ -28,12 +28,11 @@ use config::{ }, metrics, utils::{inverted_index::split_token, json, time::BASE_TIME}, - INDEX_FIELD_NAME_FOR_ALL, QUERY_WITH_NO_LIMIT, }; use datafusion::{ - common::{tree_node::TreeNode, TableReference}, + common::{TableReference, tree_node::TreeNode}, error::DataFusionError, - physical_plan::{displayable, visit_execution_plan, ExecutionPlan}, + physical_plan::{ExecutionPlan, displayable, visit_execution_plan}, prelude::SessionContext, }; use hashbrown::{HashMap, HashSet}; @@ -44,17 +43,18 @@ use infra::{ }; use itertools::Itertools; use proto::cluster_rpc::{self, SearchQuery}; -use tracing::{info_span, Instrument}; +use tracing::{Instrument, info_span}; use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::{ common::infra::cluster as infra_cluster, service::search::{ + DATAFUSION_RUNTIME, datafusion::{ distributed_plan::{ + EmptyExecVisitor, remote_scan::RemoteScanExec, rewrite::{RemoteScanRewriter, StreamingAggsRewriter}, - EmptyExecVisitor, }, exec::{prepare_datafusion_context, register_udf}, optimizer::generate_optimizer_rules, @@ -64,7 +64,6 @@ use crate::{ request::Request, sql::Sql, utils::{AsyncDefer, ScanStatsVisitor}, - DATAFUSION_RUNTIME, }, }; @@ -423,7 +422,9 @@ pub async fn run_datafusion( let mut visitor = EmptyExecVisitor::default(); if physical_plan.visit(&mut visitor).is_err() { - log::error!("[trace_id {trace_id}] flight->search: physical plan visit error: there is no EmptyTable"); + log::error!( + "[trace_id {trace_id}] flight->search: physical plan visit error: there is no EmptyTable" + ); return Err(Error::Message( "flight->search: physical plan visit error: there is no EmptyTable".to_string(), )); diff --git a/src/service/search/cluster/mod.rs b/src/service/search/cluster/mod.rs index a6e0c5bd29..11512082e7 100644 --- a/src/service/search/cluster/mod.rs +++ b/src/service/search/cluster/mod.rs @@ -16,7 +16,7 @@ use std::sync::Arc; use ::datafusion::arrow::datatypes::Schema; -use config::{utils::json, TIMESTAMP_COL_NAME}; +use config::{TIMESTAMP_COL_NAME, utils::json}; use hashbrown::HashMap; #[cfg(feature = "enterprise")] use { diff --git a/src/service/search/datafusion/distributed_plan/codec.rs b/src/service/search/datafusion/distributed_plan/codec.rs index c97ad9200e..ef763bc2d8 100644 --- a/src/service/search/datafusion/distributed_plan/codec.rs +++ b/src/service/search/datafusion/distributed_plan/codec.rs @@ -16,7 +16,7 @@ use std::sync::Arc; use datafusion::{ - common::{internal_err, Result}, + common::{Result, internal_err}, error::DataFusionError, execution::FunctionRegistry, logical_expr::ScalarUDF, @@ -25,7 +25,7 @@ use datafusion::{ use datafusion_proto::{ convert_required, logical_plan::{ - from_proto::parse_expr, to_proto::serialize_exprs, DefaultLogicalExtensionCodec, + DefaultLogicalExtensionCodec, from_proto::parse_expr, to_proto::serialize_exprs, }, physical_plan::PhysicalExtensionCodec, protobuf::proto_error, diff --git a/src/service/search/datafusion/distributed_plan/empty_exec.rs b/src/service/search/datafusion/distributed_plan/empty_exec.rs index b9dd6a9f0b..f75cdca914 100644 --- a/src/service/search/datafusion/distributed_plan/empty_exec.rs +++ b/src/service/search/datafusion/distributed_plan/empty_exec.rs @@ -19,12 +19,12 @@ use arrow_schema::SortOptions; use config::TIMESTAMP_COL_NAME; use datafusion::{ arrow::{array::RecordBatch, datatypes::SchemaRef}, - common::{internal_err, Result, Statistics}, + common::{Result, Statistics, internal_err}, execution::{SendableRecordBatchStream, TaskContext}, physical_expr::{EquivalenceProperties, LexOrdering, Partitioning, PhysicalSortExpr}, physical_plan::{ - common, expressions::Column, memory::MemoryStream, DisplayAs, DisplayFormatType, - ExecutionMode, ExecutionPlan, PlanProperties, + DisplayAs, DisplayFormatType, ExecutionMode, ExecutionPlan, PlanProperties, common, + expressions::Column, memory::MemoryStream, }, prelude::Expr, }; diff --git a/src/service/search/datafusion/distributed_plan/mod.rs b/src/service/search/datafusion/distributed_plan/mod.rs index 67268e66a0..8c252775a9 100644 --- a/src/service/search/datafusion/distributed_plan/mod.rs +++ b/src/service/search/datafusion/distributed_plan/mod.rs @@ -17,8 +17,8 @@ use std::sync::Arc; use datafusion::{ common::{ - tree_node::{Transformed, TreeNodeRecursion, TreeNodeRewriter, TreeNodeVisitor}, Result, + tree_node::{Transformed, TreeNodeRecursion, TreeNodeRewriter, TreeNodeVisitor}, }, physical_plan::ExecutionPlan, }; diff --git a/src/service/search/datafusion/distributed_plan/remote_scan.rs b/src/service/search/datafusion/distributed_plan/remote_scan.rs index 1cd08d91bb..d7aa7a699c 100644 --- a/src/service/search/datafusion/distributed_plan/remote_scan.rs +++ b/src/service/search/datafusion/distributed_plan/remote_scan.rs @@ -22,8 +22,8 @@ use std::{ use arrow::record_batch::RecordBatch; use arrow_flight::{ - flight_service_client::FlightServiceClient, utils::flight_data_to_arrow_batch, FlightData, - Ticket, + FlightData, Ticket, flight_service_client::FlightServiceClient, + utils::flight_data_to_arrow_batch, }; use arrow_schema::{Schema, SchemaRef}; use config::{ @@ -35,8 +35,8 @@ use datafusion::{ execution::{RecordBatchStream, SendableRecordBatchStream, TaskContext}, physical_expr::{EquivalenceProperties, Partitioning}, physical_plan::{ - stream::RecordBatchStreamAdapter, DisplayAs, DisplayFormatType, ExecutionMode, - ExecutionPlan, PlanProperties, + DisplayAs, DisplayFormatType, ExecutionMode, ExecutionPlan, PlanProperties, + stream::RecordBatchStreamAdapter, }, }; use datafusion_proto::bytes::physical_plan_to_bytes_with_extension_codec; @@ -45,9 +45,9 @@ use parking_lot::Mutex; use prost::Message; use proto::cluster_rpc; use tonic::{ + Streaming, codec::CompressionEncoding, metadata::{MetadataKey, MetadataValue}, - Streaming, }; use super::{ diff --git a/src/service/search/datafusion/distributed_plan/rewrite.rs b/src/service/search/datafusion/distributed_plan/rewrite.rs index 5769e08c69..91f6b60470 100644 --- a/src/service/search/datafusion/distributed_plan/rewrite.rs +++ b/src/service/search/datafusion/distributed_plan/rewrite.rs @@ -18,14 +18,14 @@ use std::sync::Arc; use config::meta::{cluster::NodeInfo, inverted_index::InvertedIndexOptimizeMode, stream::FileKey}; use datafusion::{ common::{ - tree_node::{Transformed, TreeNode, TreeNodeRecursion, TreeNodeRewriter, TreeNodeVisitor}, Result, TableReference, + tree_node::{Transformed, TreeNode, TreeNodeRecursion, TreeNodeRewriter, TreeNodeVisitor}, }, physical_expr::LexOrdering, physical_plan::{ + ExecutionPlan, ExecutionPlanProperties, Partitioning, repartition::RepartitionExec, sorts::{sort::SortExec, sort_preserving_merge::SortPreservingMergeExec}, - ExecutionPlan, ExecutionPlanProperties, Partitioning, }, }; use hashbrown::HashMap; diff --git a/src/service/search/datafusion/distributed_plan/streaming_aggs_exec.rs b/src/service/search/datafusion/distributed_plan/streaming_aggs_exec.rs index 4ccad320ca..4eaa1c6531 100644 --- a/src/service/search/datafusion/distributed_plan/streaming_aggs_exec.rs +++ b/src/service/search/datafusion/distributed_plan/streaming_aggs_exec.rs @@ -28,8 +28,8 @@ use datafusion::{ execution::{RecordBatchStream, SendableRecordBatchStream, TaskContext}, physical_expr::EquivalenceProperties, physical_plan::{ - memory::MemoryStream, DisplayAs, DisplayFormatType, ExecutionMode, ExecutionPlan, - ExecutionPlanProperties, Partitioning, PlanProperties, + DisplayAs, DisplayFormatType, ExecutionMode, ExecutionPlan, ExecutionPlanProperties, + Partitioning, PlanProperties, memory::MemoryStream, }, }; use futures::{Stream, StreamExt}; diff --git a/src/service/search/datafusion/exec.rs b/src/service/search/datafusion/exec.rs index 3c991622d3..2fa97e5b00 100644 --- a/src/service/search/datafusion/exec.rs +++ b/src/service/search/datafusion/exec.rs @@ -17,13 +17,12 @@ use std::{str::FromStr, sync::Arc}; use arrow_schema::Field; use config::{ - get_config, + PARQUET_BATCH_SIZE, TIMESTAMP_COL_NAME, get_config, meta::{ search::{Session as SearchSession, StorageType}, stream::{FileKey, FileMeta, StreamType}, }, utils::{parquet::new_parquet_writer, schema_ext::SchemaExt}, - PARQUET_BATCH_SIZE, TIMESTAMP_COL_NAME, }; use datafusion::{ arrow::datatypes::{DataType, Schema}, @@ -65,7 +64,7 @@ use super::{ optimizer::join_reorder::JoinReorderRule, planner::extension_planner::OpenobserveQueryPlanner, storage::file_list, - table_provider::{uniontable::NewUnionTable, NewListingTable}, + table_provider::{NewListingTable, uniontable::NewUnionTable}, udf::transform_udf::get_all_transform, }; use crate::service::{ diff --git a/src/service/search/datafusion/mod.rs b/src/service/search/datafusion/mod.rs index 64f7d1f201..fc5ee6b155 100644 --- a/src/service/search/datafusion/mod.rs +++ b/src/service/search/datafusion/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/optimizer/add_sort_and_limit.rs b/src/service/search/datafusion/optimizer/add_sort_and_limit.rs index 3f585d6c50..bc5c7ce786 100644 --- a/src/service/search/datafusion/optimizer/add_sort_and_limit.rs +++ b/src/service/search/datafusion/optimizer/add_sort_and_limit.rs @@ -15,11 +15,11 @@ use datafusion::{ common::{ - tree_node::{Transformed, TreeNode, TreeNodeRecursion}, Result, + tree_node::{Transformed, TreeNode, TreeNodeRecursion}, }, logical_expr::LogicalPlan, - optimizer::{optimizer::ApplyOrder, OptimizerConfig, OptimizerRule}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder}, }; use super::utils::AddSortAndLimit; diff --git a/src/service/search/datafusion/optimizer/add_timestamp.rs b/src/service/search/datafusion/optimizer/add_timestamp.rs index fd3215eb8f..c6c536798e 100644 --- a/src/service/search/datafusion/optimizer/add_timestamp.rs +++ b/src/service/search/datafusion/optimizer/add_timestamp.rs @@ -17,9 +17,9 @@ use std::sync::Arc; use config::TIMESTAMP_COL_NAME; use datafusion::{ - common::{tree_node::Transformed, Result}, - logical_expr::{and, col, lit, Expr, Filter, LogicalPlan}, - optimizer::{optimizer::ApplyOrder, OptimizerConfig, OptimizerRule}, + common::{Result, tree_node::Transformed}, + logical_expr::{Expr, Filter, LogicalPlan, and, col, lit}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder}, }; /// Optimization rule that add _timestamp constraint to table scan @@ -94,10 +94,10 @@ mod tests { session_state::SessionStateBuilder, }, logical_expr::{ - and, binary_expr, col, in_subquery, lit, table_scan, JoinType, LogicalPlan, - LogicalPlanBuilder, Operator, + JoinType, LogicalPlan, LogicalPlanBuilder, Operator, and, binary_expr, col, + in_subquery, lit, table_scan, }, - optimizer::{push_down_filter::PushDownFilter, Optimizer, OptimizerContext, OptimizerRule}, + optimizer::{Optimizer, OptimizerContext, OptimizerRule, push_down_filter::PushDownFilter}, prelude::{SessionConfig, SessionContext}, }; @@ -269,21 +269,27 @@ mod tests { #[tokio::test] async fn test_real_sql_for_timestamp() { let sqls = [ - ("select * from t order by _timestamp", vec![ - "+------------+-------------+", - "| _timestamp | name |", - "+------------+-------------+", - "| 2 | observe |", - "| 3 | openobserve |", - "+------------+-------------+", - ]), - ("select name from t where name = 'openobserve'", vec![ - "+-------------+", - "| name |", - "+-------------+", - "| openobserve |", - "+-------------+", - ]), + ( + "select * from t order by _timestamp", + vec![ + "+------------+-------------+", + "| _timestamp | name |", + "+------------+-------------+", + "| 2 | observe |", + "| 3 | openobserve |", + "+------------+-------------+", + ], + ), + ( + "select name from t where name = 'openobserve'", + vec![ + "+-------------+", + "| name |", + "+-------------+", + "| openobserve |", + "+-------------+", + ], + ), ( "select t1._timestamp, t1.name from t as t1 join t as t2 on t1.name = t2.name order by t1._timestamp", vec![ diff --git a/src/service/search/datafusion/optimizer/cipher.rs b/src/service/search/datafusion/optimizer/cipher.rs index c9eb176db6..d1903a3055 100644 --- a/src/service/search/datafusion/optimizer/cipher.rs +++ b/src/service/search/datafusion/optimizer/cipher.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,12 +17,12 @@ use std::sync::Arc; use datafusion::{ common::{ - tree_node::{Transformed, TreeNode, TreeNodeRewriter}, Result, + tree_node::{Transformed, TreeNode, TreeNodeRewriter}, }, error::DataFusionError, - logical_expr::{expr::ScalarFunction, BinaryExpr, Expr, LogicalPlan, Operator}, - optimizer::{optimizer::ApplyOrder, utils::NamePreserver, OptimizerConfig, OptimizerRule}, + logical_expr::{BinaryExpr, Expr, LogicalPlan, Operator, expr::ScalarFunction}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder, utils::NamePreserver}, scalar::ScalarValue, }; @@ -345,54 +345,54 @@ mod tests { // equal to operator gets re-written ( "SELECT _timestamp FROM t where decrypt(name, 'test_key') = 'test_val'", - "Projection: t._timestamp\n Filter: t.name = encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name = encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), // not equal operator gets rewritten ( "SELECT _timestamp FROM t where decrypt(name, 'test_key') != 'test_val'", - "Projection: t._timestamp\n Filter: t.name != encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name != encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), // like operator does not get rewritten ( "SELECT _timestamp FROM t where decrypt(name, 'test_key') LIKE '%test%'", - "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"test_key\")) LIKE Utf8(\"%test%\")\n TableScan: t" + "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"test_key\")) LIKE Utf8(\"%test%\")\n TableScan: t", ), // match all does not get re-written ( "SELECT _timestamp FROM t where match_all(decrypt(name, 'test_key'), 'test')", - "Projection: t._timestamp\n Filter: match_all(decrypt(t.name, Utf8(\"test_key\")), Utf8(\"test\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: match_all(decrypt(t.name, Utf8(\"test_key\")), Utf8(\"test\"))\n TableScan: t", ), // if comparison is to non-literal, it does not get re-written ( "SELECT _timestamp FROM t where decrypt(name, 'test_key') = other_col", - "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"test_key\")) = t.other_col\n TableScan: t" + "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"test_key\")) = t.other_col\n TableScan: t", ), // similar checks for encrypt ( "SELECT _timestamp FROM t where encrypt(name, 'test_key') = 'test_val'", - "Projection: t._timestamp\n Filter: t.name = decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name = decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), ( "SELECT _timestamp FROM t where encrypt(name, 'test_key') != 'test_val'", - "Projection: t._timestamp\n Filter: t.name != decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name != decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), ( "SELECT _timestamp FROM t where encrypt(name, 'test_key') = other_col", - "Projection: t._timestamp\n Filter: encrypt(t.name, Utf8(\"test_key\")) = t.other_col\n TableScan: t" + "Projection: t._timestamp\n Filter: encrypt(t.name, Utf8(\"test_key\")) = t.other_col\n TableScan: t", ), // checks for revered order in query ( "SELECT _timestamp FROM t where 'test_val' = decrypt(name, 'test_key')", - "Projection: t._timestamp\n Filter: t.name = encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name = encrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), ( "SELECT _timestamp FROM t where 'test_val' != encrypt(name, 'test_key')", - "Projection: t._timestamp\n Filter: t.name != decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: t.name != decrypt(Utf8(\"test_val\"), Utf8(\"test_key\"))\n TableScan: t", ), // no op sanity check ( "SELECT _timestamp FROM t where match_all(name, 'test')", - "Projection: t._timestamp\n Filter: match_all(t.name, Utf8(\"test\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: match_all(t.name, Utf8(\"test\"))\n TableScan: t", ), ]; @@ -453,11 +453,11 @@ mod tests { // check key is re-written ( "SELECT _timestamp FROM t where decrypt(name, 'test_key') = 'test_val'", - "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"org1:test_key\")) = Utf8(\"test_val\")\n TableScan: t" + "Projection: t._timestamp\n Filter: decrypt(t.name, Utf8(\"org1:test_key\")) = Utf8(\"test_val\")\n TableScan: t", ), ( "SELECT _timestamp FROM t where 'test_val' = encrypt(name, 'test_key')", - "Projection: t._timestamp\n Filter: Utf8(\"test_val\") = encrypt(t.name, Utf8(\"org1:test_key\"))\n TableScan: t" + "Projection: t._timestamp\n Filter: Utf8(\"test_val\") = encrypt(t.name, Utf8(\"org1:test_key\"))\n TableScan: t", ), ]; diff --git a/src/service/search/datafusion/optimizer/join_reorder.rs b/src/service/search/datafusion/optimizer/join_reorder.rs index d174f98773..90f9fc0e12 100644 --- a/src/service/search/datafusion/optimizer/join_reorder.rs +++ b/src/service/search/datafusion/optimizer/join_reorder.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,14 +17,14 @@ use std::sync::Arc; use datafusion::{ common::{ - tree_node::{Transformed, TransformedResult, TreeNode}, Result, + tree_node::{Transformed, TransformedResult, TreeNode}, }, config::ConfigOptions, - physical_optimizer::{join_selection::swap_hash_join, PhysicalOptimizerRule}, + physical_optimizer::{PhysicalOptimizerRule, join_selection::swap_hash_join}, physical_plan::{ - aggregates::AggregateExec, joins::HashJoinExec, visit_execution_plan, ExecutionPlan, - ExecutionPlanVisitor, + ExecutionPlan, ExecutionPlanVisitor, aggregates::AggregateExec, joins::HashJoinExec, + visit_execution_plan, }, }; @@ -108,8 +108,8 @@ mod tests { common::Result, datasource::MemTable, execution::{ - runtime_env::{RuntimeConfig, RuntimeEnv}, SessionStateBuilder, + runtime_env::{RuntimeConfig, RuntimeEnv}, }, physical_plan::get_plan_string, prelude::{SessionConfig, SessionContext}, diff --git a/src/service/search/datafusion/optimizer/limit_join_right_side.rs b/src/service/search/datafusion/optimizer/limit_join_right_side.rs index 95902a0932..089eef7572 100644 --- a/src/service/search/datafusion/optimizer/limit_join_right_side.rs +++ b/src/service/search/datafusion/optimizer/limit_join_right_side.rs @@ -17,11 +17,11 @@ use std::sync::Arc; use datafusion::{ common::{ - tree_node::{Transformed, TreeNode}, Result, + tree_node::{Transformed, TreeNode}, }, logical_expr::LogicalPlan, - optimizer::{optimizer::ApplyOrder, OptimizerConfig, OptimizerRule}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder}, prelude::Expr, }; use itertools::Itertools; @@ -106,8 +106,8 @@ mod tests { common::Result, datasource::MemTable, execution::{ - runtime_env::{RuntimeConfig, RuntimeEnv}, SessionStateBuilder, + runtime_env::{RuntimeConfig, RuntimeEnv}, }, physical_plan::get_plan_string, prelude::{SessionConfig, SessionContext}, @@ -164,27 +164,27 @@ mod tests { // ); let expected = vec![ - "AggregateExec: mode=Final, gby=[], aggr=[count(*)]", - " CoalescePartitionsExec", - " AggregateExec: mode=Partial, gby=[], aggr=[count(*)]", - " ProjectionExec: expr=[]", - " CoalesceBatchesExec: target_batch_size=8192", - " HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(name@0, name@0)]", - " CoalesceBatchesExec: target_batch_size=8192", - " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=1", - " MemoryExec: partitions=1, partition_sizes=[1]", - " CoalesceBatchesExec: target_batch_size=8192", - " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=12", - " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", - " DeduplicationExec: columns: [Column { name: \"name\", index: 0 }]", - " SortExec: TopK(fetch=50000), expr=[name@0 DESC NULLS LAST], preserve_partitioning=[false]", - " CoalescePartitionsExec", - " AggregateExec: mode=FinalPartitioned, gby=[name@0 as name], aggr=[], lim=[50000]", - " CoalesceBatchesExec: target_batch_size=8192", - " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=12", - " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", - " AggregateExec: mode=Partial, gby=[name@0 as name], aggr=[], lim=[50000]", - " MemoryExec: partitions=1, partition_sizes=[1]" + "AggregateExec: mode=Final, gby=[], aggr=[count(*)]", + " CoalescePartitionsExec", + " AggregateExec: mode=Partial, gby=[], aggr=[count(*)]", + " ProjectionExec: expr=[]", + " CoalesceBatchesExec: target_batch_size=8192", + " HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(name@0, name@0)]", + " CoalesceBatchesExec: target_batch_size=8192", + " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=1", + " MemoryExec: partitions=1, partition_sizes=[1]", + " CoalesceBatchesExec: target_batch_size=8192", + " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=12", + " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", + " DeduplicationExec: columns: [Column { name: \"name\", index: 0 }]", + " SortExec: TopK(fetch=50000), expr=[name@0 DESC NULLS LAST], preserve_partitioning=[false]", + " CoalescePartitionsExec", + " AggregateExec: mode=FinalPartitioned, gby=[name@0 as name], aggr=[], lim=[50000]", + " CoalesceBatchesExec: target_batch_size=8192", + " RepartitionExec: partitioning=Hash([name@0], 12), input_partitions=12", + " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", + " AggregateExec: mode=Partial, gby=[name@0 as name], aggr=[], lim=[50000]", + " MemoryExec: partitions=1, partition_sizes=[1]", ]; assert_eq!(expected, get_plan_string(&physical_plan)); @@ -240,15 +240,15 @@ mod tests { // ); let expected = vec![ - "CoalesceBatchesExec: target_batch_size=8192", - " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(id@0, id@0)], projection=[id@1]", - " ProjectionExec: expr=[id@0 as id]", - " DeduplicationExec: columns: [Column { name: \"id\", index: 0 }]", - " SortExec: expr=[id@0 DESC NULLS LAST, _timestamp@1 DESC NULLS LAST], preserve_partitioning=[false]", - " SortPreservingMergeExec: [_timestamp@1 DESC NULLS LAST], fetch=50000", - " SortExec: TopK(fetch=50000), expr=[_timestamp@1 DESC NULLS LAST], preserve_partitioning=[true]", - " MemoryExec: partitions=2, partition_sizes=[1, 1]", - " MemoryExec: partitions=1, partition_sizes=[1]" + "CoalesceBatchesExec: target_batch_size=8192", + " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(id@0, id@0)], projection=[id@1]", + " ProjectionExec: expr=[id@0 as id]", + " DeduplicationExec: columns: [Column { name: \"id\", index: 0 }]", + " SortExec: expr=[id@0 DESC NULLS LAST, _timestamp@1 DESC NULLS LAST], preserve_partitioning=[false]", + " SortPreservingMergeExec: [_timestamp@1 DESC NULLS LAST], fetch=50000", + " SortExec: TopK(fetch=50000), expr=[_timestamp@1 DESC NULLS LAST], preserve_partitioning=[true]", + " MemoryExec: partitions=2, partition_sizes=[1, 1]", + " MemoryExec: partitions=1, partition_sizes=[1]", ]; assert_eq!(expected, get_plan_string(&physical_plan)); @@ -316,29 +316,29 @@ mod tests { // ); let expected = vec![ - "CoalesceBatchesExec: target_batch_size=8192", - " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(prod_id@1, prod_id@0)], projection=[usr_id@0, prod_id@1]", - " CoalesceBatchesExec: target_batch_size=8192", - " RepartitionExec: partitioning=Hash([prod_id@1], 12), input_partitions=12", - " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", - " ProjectionExec: expr=[usr_id@1 as usr_id, prod_id@0 as prod_id]", - " CoalesceBatchesExec: target_batch_size=8192", - " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(usr_id@0, usr_id@0)], projection=[prod_id@1, usr_id@2]", - " ProjectionExec: expr=[usr_id@0 as usr_id, prod_id@1 as prod_id]", - " DeduplicationExec: columns: [Column { name: \"usr_id\", index: 0 }]", - " SortExec: expr=[usr_id@0 DESC NULLS LAST, _timestamp@2 DESC NULLS LAST], preserve_partitioning=[false]", - " SortPreservingMergeExec: [_timestamp@2 DESC NULLS LAST], fetch=50000", - " SortExec: TopK(fetch=50000), expr=[_timestamp@2 DESC NULLS LAST], preserve_partitioning=[true]", - " MemoryExec: partitions=2, partition_sizes=[1, 1]", - " MemoryExec: partitions=1, partition_sizes=[1]", - " CoalesceBatchesExec: target_batch_size=8192", - " RepartitionExec: partitioning=Hash([prod_id@0], 12), input_partitions=1", - " ProjectionExec: expr=[prod_id@0 as prod_id]", - " DeduplicationExec: columns: [Column { name: \"prod_id\", index: 0 }]", - " SortExec: expr=[prod_id@0 DESC NULLS LAST, _timestamp@1 DESC NULLS LAST], preserve_partitioning=[false]", - " SortPreservingMergeExec: [_timestamp@1 DESC NULLS LAST], fetch=50000", - " SortExec: TopK(fetch=50000), expr=[_timestamp@1 DESC NULLS LAST], preserve_partitioning=[true]", - " MemoryExec: partitions=3, partition_sizes=[1, 1, 1]" + "CoalesceBatchesExec: target_batch_size=8192", + " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(prod_id@1, prod_id@0)], projection=[usr_id@0, prod_id@1]", + " CoalesceBatchesExec: target_batch_size=8192", + " RepartitionExec: partitioning=Hash([prod_id@1], 12), input_partitions=12", + " RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1", + " ProjectionExec: expr=[usr_id@1 as usr_id, prod_id@0 as prod_id]", + " CoalesceBatchesExec: target_batch_size=8192", + " HashJoinExec: mode=Partitioned, join_type=Inner, on=[(usr_id@0, usr_id@0)], projection=[prod_id@1, usr_id@2]", + " ProjectionExec: expr=[usr_id@0 as usr_id, prod_id@1 as prod_id]", + " DeduplicationExec: columns: [Column { name: \"usr_id\", index: 0 }]", + " SortExec: expr=[usr_id@0 DESC NULLS LAST, _timestamp@2 DESC NULLS LAST], preserve_partitioning=[false]", + " SortPreservingMergeExec: [_timestamp@2 DESC NULLS LAST], fetch=50000", + " SortExec: TopK(fetch=50000), expr=[_timestamp@2 DESC NULLS LAST], preserve_partitioning=[true]", + " MemoryExec: partitions=2, partition_sizes=[1, 1]", + " MemoryExec: partitions=1, partition_sizes=[1]", + " CoalesceBatchesExec: target_batch_size=8192", + " RepartitionExec: partitioning=Hash([prod_id@0], 12), input_partitions=1", + " ProjectionExec: expr=[prod_id@0 as prod_id]", + " DeduplicationExec: columns: [Column { name: \"prod_id\", index: 0 }]", + " SortExec: expr=[prod_id@0 DESC NULLS LAST, _timestamp@1 DESC NULLS LAST], preserve_partitioning=[false]", + " SortPreservingMergeExec: [_timestamp@1 DESC NULLS LAST], fetch=50000", + " SortExec: TopK(fetch=50000), expr=[_timestamp@1 DESC NULLS LAST], preserve_partitioning=[true]", + " MemoryExec: partitions=3, partition_sizes=[1, 1, 1]", ]; assert_eq!(expected, get_plan_string(&physical_plan)); diff --git a/src/service/search/datafusion/optimizer/mod.rs b/src/service/search/datafusion/optimizer/mod.rs index 8a17a79a64..ff9f6dae11 100644 --- a/src/service/search/datafusion/optimizer/mod.rs +++ b/src/service/search/datafusion/optimizer/mod.rs @@ -20,7 +20,7 @@ use add_timestamp::AddTimestampRule; #[cfg(feature = "enterprise")] use cipher::{RewriteCipherCall, RewriteCipherKey}; use datafusion::optimizer::{ - common_subexpr_eliminate::CommonSubexprEliminate, + OptimizerRule, common_subexpr_eliminate::CommonSubexprEliminate, decorrelate_predicate_subquery::DecorrelatePredicateSubquery, eliminate_cross_join::EliminateCrossJoin, eliminate_duplicated_expr::EliminateDuplicatedExpr, eliminate_filter::EliminateFilter, eliminate_group_by_constant::EliminateGroupByConstant, @@ -32,7 +32,7 @@ use datafusion::optimizer::{ push_down_limit::PushDownLimit, replace_distinct_aggregate::ReplaceDistinctWithAggregate, scalar_subquery_to_join::ScalarSubqueryToJoin, simplify_expressions::SimplifyExpressions, single_distinct_to_groupby::SingleDistinctToGroupBy, - unwrap_cast_in_comparison::UnwrapCastInComparison, OptimizerRule, + unwrap_cast_in_comparison::UnwrapCastInComparison, }; use infra::schema::get_stream_setting_fts_fields; use limit_join_right_side::LimitJoinRightSide; diff --git a/src/service/search/datafusion/optimizer/rewrite_histogram.rs b/src/service/search/datafusion/optimizer/rewrite_histogram.rs index f5da66d899..19c42a62e6 100644 --- a/src/service/search/datafusion/optimizer/rewrite_histogram.rs +++ b/src/service/search/datafusion/optimizer/rewrite_histogram.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,16 +18,16 @@ use std::sync::Arc; use arrow_schema::{DataType, IntervalUnit}; use datafusion::{ common::{ - tree_node::{Transformed, TreeNode, TreeNodeRewriter}, Result, + tree_node::{Transformed, TreeNode, TreeNodeRewriter}, }, error::DataFusionError, functions::datetime::{ date_bin::DateBinFunc, to_timestamp::{ToTimestampFunc, ToTimestampMicrosFunc}, }, - logical_expr::{cast, expr::ScalarFunction, Expr, LogicalPlan, ScalarUDF}, - optimizer::{optimizer::ApplyOrder, utils::NamePreserver, OptimizerConfig, OptimizerRule}, + logical_expr::{Expr, LogicalPlan, ScalarUDF, cast, expr::ScalarFunction}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder, utils::NamePreserver}, scalar::ScalarValue, }; @@ -73,8 +73,7 @@ impl OptimizerRule for RewriteHistogram { if plan .expressions() .iter() - .map(|expr| expr.exists(|expr| Ok(is_histogram(expr))).unwrap()) - .any(|x| x) + .any(|expr| expr.exists(|expr| Ok(is_histogram(expr))).unwrap()) { let mut expr_rewriter = HistogramToDatebin::new(self.start_time, self.end_time); diff --git a/src/service/search/datafusion/optimizer/rewrite_match.rs b/src/service/search/datafusion/optimizer/rewrite_match.rs index 1eaa72183d..246b2d3a50 100644 --- a/src/service/search/datafusion/optimizer/rewrite_match.rs +++ b/src/service/search/datafusion/optimizer/rewrite_match.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,12 +16,12 @@ use datafusion::{ self, common::{ - tree_node::{Transformed, TreeNode, TreeNodeRewriter}, Column, Result, + tree_node::{Transformed, TreeNode, TreeNodeRewriter}, }, error::DataFusionError, - logical_expr::{expr::ScalarFunction, utils::disjunction, Expr, Like, LogicalPlan}, - optimizer::{optimizer::ApplyOrder, utils::NamePreserver, OptimizerConfig, OptimizerRule}, + logical_expr::{Expr, Like, LogicalPlan, expr::ScalarFunction, utils::disjunction}, + optimizer::{OptimizerConfig, OptimizerRule, optimizer::ApplyOrder, utils::NamePreserver}, scalar::ScalarValue, }; @@ -69,8 +69,7 @@ impl OptimizerRule for RewriteMatch { if plan .expressions() .iter() - .map(|expr| expr.exists(|expr| Ok(is_match_all(expr))).unwrap()) - .any(|x| x) + .any(|expr| expr.exists(|expr| Ok(is_match_all(expr))).unwrap()) { let mut expr_rewriter = MatchToFullTextMatch::new(self.fields.clone()); let name_preserver = NamePreserver::new(&plan); @@ -217,22 +216,28 @@ mod tests { #[tokio::test] async fn test_rewrite_match() { let sqls = [ - ("select * from t where match_all('open')", vec![ - "+------------+-------------+-------------+", - "| _timestamp | name | log |", - "+------------+-------------+-------------+", - "| 1 | open | o2 |", - "| 3 | openobserve | openobserve |", - "+------------+-------------+-------------+", - ]), - ("select _timestamp from t where match_all('open')", vec![ - "+------------+", - "| _timestamp |", - "+------------+", - "| 1 |", - "| 3 |", - "+------------+", - ]), + ( + "select * from t where match_all('open')", + vec![ + "+------------+-------------+-------------+", + "| _timestamp | name | log |", + "+------------+-------------+-------------+", + "| 1 | open | o2 |", + "| 3 | openobserve | openobserve |", + "+------------+-------------+-------------+", + ], + ), + ( + "select _timestamp from t where match_all('open')", + vec![ + "+------------+", + "| _timestamp |", + "+------------+", + "| 1 |", + "| 3 |", + "+------------+", + ], + ), ( "select _timestamp from t where match_all_raw_ignore_case('observe')", vec![ diff --git a/src/service/search/datafusion/optimizer/utils.rs b/src/service/search/datafusion/optimizer/utils.rs index d417078736..bbd5538acd 100644 --- a/src/service/search/datafusion/optimizer/utils.rs +++ b/src/service/search/datafusion/optimizer/utils.rs @@ -18,14 +18,14 @@ use std::sync::Arc; use config::TIMESTAMP_COL_NAME; use datafusion::{ common::{ + Column, DFSchema, Result, tree_node::{ Transformed, TransformedResult, TreeNode, TreeNodeRecursion, TreeNodeRewriter, }, - Column, DFSchema, Result, }, datasource::DefaultTableSource, logical_expr::{ - col, Extension, Limit, LogicalPlan, Projection, Sort, SortExpr, TableScan, TableSource, + Extension, Limit, LogicalPlan, Projection, Sort, SortExpr, TableScan, TableSource, col, }, prelude::Expr, scalar::ScalarValue, diff --git a/src/service/search/datafusion/plan/deduplication.rs b/src/service/search/datafusion/plan/deduplication.rs index 5b8545c1e3..a3067d7864 100644 --- a/src/service/search/datafusion/plan/deduplication.rs +++ b/src/service/search/datafusion/plan/deduplication.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/plan/deduplication_exec.rs b/src/service/search/datafusion/plan/deduplication_exec.rs index e930001e48..845db7e907 100644 --- a/src/service/search/datafusion/plan/deduplication_exec.rs +++ b/src/service/search/datafusion/plan/deduplication_exec.rs @@ -24,12 +24,12 @@ use arrow_schema::{DataType, SortOptions}; use config::TIMESTAMP_COL_NAME; use datafusion::{ arrow::datatypes::SchemaRef, - common::{internal_err, Result, Statistics}, + common::{Result, Statistics, internal_err}, execution::{RecordBatchStream, SendableRecordBatchStream, TaskContext}, physical_expr::{EquivalenceProperties, LexRequirement, Partitioning, PhysicalSortRequirement}, physical_plan::{ - expressions::Column, DisplayAs, DisplayFormatType, Distribution, ExecutionMode, - ExecutionPlan, PlanProperties, + DisplayAs, DisplayFormatType, Distribution, ExecutionMode, ExecutionPlan, PlanProperties, + expressions::Column, }, }; use futures::{Stream, StreamExt}; diff --git a/src/service/search/datafusion/plan/mod.rs b/src/service/search/datafusion/plan/mod.rs index 8a6e3ce301..54498a341f 100644 --- a/src/service/search/datafusion/plan/mod.rs +++ b/src/service/search/datafusion/plan/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/plan/tantivy_count_exec.rs b/src/service/search/datafusion/plan/tantivy_count_exec.rs index 75f3334f57..3d443d0968 100644 --- a/src/service/search/datafusion/plan/tantivy_count_exec.rs +++ b/src/service/search/datafusion/plan/tantivy_count_exec.rs @@ -19,18 +19,18 @@ use arrow::array::{Array, Int64Array}; use config::meta::{inverted_index::InvertedIndexOptimizeMode, stream::FileKey}; use datafusion::{ arrow::{array::RecordBatch, datatypes::SchemaRef}, - common::{internal_err, Result, Statistics}, + common::{Result, Statistics, internal_err}, error::DataFusionError, execution::{SendableRecordBatchStream, TaskContext}, physical_expr::{EquivalenceProperties, Partitioning}, physical_plan::{ - stream::RecordBatchStreamAdapter, DisplayAs, DisplayFormatType, ExecutionMode, - ExecutionPlan, PlanProperties, + DisplayAs, DisplayFormatType, ExecutionMode, ExecutionPlan, PlanProperties, + stream::RecordBatchStreamAdapter, }, }; use crate::service::search::{ - grpc::{storage::filter_file_list_by_tantivy_index, QueryParams}, + grpc::{QueryParams, storage::filter_file_list_by_tantivy_index}, index::IndexCondition, }; diff --git a/src/service/search/datafusion/planner/extension_planner.rs b/src/service/search/datafusion/planner/extension_planner.rs index 3050a81111..fc78e77b14 100644 --- a/src/service/search/datafusion/planner/extension_planner.rs +++ b/src/service/search/datafusion/planner/extension_planner.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,9 +19,9 @@ use async_trait::async_trait; use datafusion::{ common::Result as DataFusionResult, error::DataFusionError, - execution::{context::QueryPlanner, SessionState}, + execution::{SessionState, context::QueryPlanner}, logical_expr::{LogicalPlan, UserDefinedLogicalNode}, - physical_plan::{expressions::Column, ExecutionPlan}, + physical_plan::{ExecutionPlan, expressions::Column}, physical_planner::{DefaultPhysicalPlanner, ExtensionPlanner, PhysicalPlanner}, }; diff --git a/src/service/search/datafusion/planner/mod.rs b/src/service/search/datafusion/planner/mod.rs index 1fbf5e73a9..c9f36ae106 100644 --- a/src/service/search/datafusion/planner/mod.rs +++ b/src/service/search/datafusion/planner/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/storage/file_list.rs b/src/service/search/datafusion/storage/file_list.rs index df4566825f..26173eb5a2 100644 --- a/src/service/search/datafusion/storage/file_list.rs +++ b/src/service/search/datafusion/storage/file_list.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/storage/file_statistics_cache.rs b/src/service/search/datafusion/storage/file_statistics_cache.rs index b03c1d6b5e..74b7654e2d 100644 --- a/src/service/search/datafusion/storage/file_statistics_cache.rs +++ b/src/service/search/datafusion/storage/file_statistics_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,7 +17,7 @@ use std::{collections::VecDeque, sync::Arc}; use dashmap::DashMap; use datafusion::{common::Statistics, execution::cache::CacheAccessor}; -use object_store::{path::Path, ObjectMeta}; +use object_store::{ObjectMeta, path::Path}; use once_cell::sync::Lazy; pub static GLOBAL_CACHE: Lazy> = @@ -126,7 +126,7 @@ impl CacheAccessor> for FileStatisticsCache { fn remove(&mut self, k: &Path) -> Option> { let k = self.format_key(k); - self.statistics.remove(&k).map(|x| x.1 .1) + self.statistics.remove(&k).map(|x| x.1.1) } fn contains_key(&self, k: &Path) -> bool { diff --git a/src/service/search/datafusion/storage/memory.rs b/src/service/search/datafusion/storage/memory.rs index b2c4b59b91..de44ba21f5 100644 --- a/src/service/search/datafusion/storage/memory.rs +++ b/src/service/search/datafusion/storage/memory.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,10 +17,10 @@ use std::ops::Range; use async_trait::async_trait; use bytes::Bytes; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use object_store::{ - path::Path, GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, - PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, + GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, PutMultipartOpts, + PutOptions, PutPayload, PutResult, Result, path::Path, }; /// File system with memory cache diff --git a/src/service/search/datafusion/storage/mod.rs b/src/service/search/datafusion/storage/mod.rs index 5af06a7a4f..da357258cf 100644 --- a/src/service/search/datafusion/storage/mod.rs +++ b/src/service/search/datafusion/storage/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/storage/tmpfs.rs b/src/service/search/datafusion/storage/tmpfs.rs index 64d3a514b9..59a6b6d4ba 100644 --- a/src/service/search/datafusion/storage/tmpfs.rs +++ b/src/service/search/datafusion/storage/tmpfs.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,11 +19,11 @@ use async_trait::async_trait; use bytes::Bytes; use chrono::Utc; use config::utils::time::BASE_TIME; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use infra::{cache::tmpfs, storage::GetRangeExt}; use object_store::{ - path::Path, Attributes, GetOptions, GetResult, GetResultPayload, ListResult, MultipartUpload, - ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, + Attributes, GetOptions, GetResult, GetResultPayload, ListResult, MultipartUpload, ObjectMeta, + ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, path::Path, }; /// Tmpfs storage suitable for testing or for opting out of using a cloud diff --git a/src/service/search/datafusion/storage/wal.rs b/src/service/search/datafusion/storage/wal.rs index e59e95ba80..bf9456b88d 100644 --- a/src/service/search/datafusion/storage/wal.rs +++ b/src/service/search/datafusion/storage/wal.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -17,11 +17,11 @@ use std::ops::Range; use async_trait::async_trait; use bytes::Bytes; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use infra::storage; use object_store::{ - path::Path, GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, - PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, + GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta, ObjectStore, PutMultipartOpts, + PutOptions, PutPayload, PutResult, Result, path::Path, }; /// File system for local wal diff --git a/src/service/search/datafusion/table_provider/catalog.rs b/src/service/search/datafusion/table_provider/catalog.rs index ac7dac3a24..a20eec44bd 100644 --- a/src/service/search/datafusion/table_provider/catalog.rs +++ b/src/service/search/datafusion/table_provider/catalog.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/table_provider/empty_table.rs b/src/service/search/datafusion/table_provider/empty_table.rs index 5f948d3d45..01ec5e3b18 100644 --- a/src/service/search/datafusion/table_provider/empty_table.rs +++ b/src/service/search/datafusion/table_provider/empty_table.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use async_trait::async_trait; use datafusion::{ arrow::datatypes::SchemaRef, catalog::Session, - common::{project_schema, Result}, + common::{Result, project_schema}, datasource::{TableProvider, TableType}, logical_expr::TableProviderFilterPushDown, physical_plan::ExecutionPlan, diff --git a/src/service/search/datafusion/table_provider/helpers.rs b/src/service/search/datafusion/table_provider/helpers.rs index 31acdd72ec..7c8080e1d0 100644 --- a/src/service/search/datafusion/table_provider/helpers.rs +++ b/src/service/search/datafusion/table_provider/helpers.rs @@ -38,10 +38,9 @@ use arrow_schema::{DataType, Schema, SchemaRef}; use config::{INDEX_SEGMENT_LENGTH, PARQUET_MAX_ROW_GROUP_SIZE}; use datafusion::{ common::{ - project_schema, + Column, DataFusionError, Result, project_schema, stats::Precision, tree_node::{TreeNode, TreeNodeRecursion}, - Column, DataFusionError, Result, }, datasource::{ listing::{ListingTableUrl, PartitionedFile}, @@ -50,11 +49,11 @@ use datafusion::{ logical_expr::{Expr, Volatility}, parquet::arrow::arrow_reader::{RowSelection, RowSelector}, physical_plan::{ - expressions::CastExpr, filter::FilterExec, projection::ProjectionExec, ExecutionPlan, - PhysicalExpr, + ExecutionPlan, PhysicalExpr, expressions::CastExpr, filter::FilterExec, + projection::ProjectionExec, }, }; -use futures::{stream::BoxStream, TryStreamExt}; +use futures::{TryStreamExt, stream::BoxStream}; use hashbrown::HashMap; use object_store::ObjectStore; @@ -69,7 +68,7 @@ pub fn expr_applicable_for_cols(col_names: &[String], expr: &Expr) -> bool { let mut is_applicable = true; expr.apply(|expr| { match expr { - Expr::Column(Column { ref name, .. }) => { + Expr::Column(Column { name, .. }) => { is_applicable &= col_names.contains(name); if is_applicable { Ok(TreeNodeRecursion::Jump) diff --git a/src/service/search/datafusion/table_provider/memtable.rs b/src/service/search/datafusion/table_provider/memtable.rs index a4059e34c6..ad5957dbd4 100644 --- a/src/service/search/datafusion/table_provider/memtable.rs +++ b/src/service/search/datafusion/table_provider/memtable.rs @@ -24,7 +24,7 @@ use datafusion::{ datasource::{MemTable, TableProvider}, logical_expr::{Expr, TableType}, physical_expr::{LexOrdering, PhysicalSortExpr}, - physical_plan::{expressions::Column, sorts::sort::SortExec, ExecutionPlan}, + physical_plan::{ExecutionPlan, expressions::Column, sorts::sort::SortExec}, }; use hashbrown::HashMap; diff --git a/src/service/search/datafusion/table_provider/mod.rs b/src/service/search/datafusion/table_provider/mod.rs index a45bbf332b..e24edc835e 100644 --- a/src/service/search/datafusion/table_provider/mod.rs +++ b/src/service/search/datafusion/table_provider/mod.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -37,25 +37,25 @@ use async_trait::async_trait; use config::get_config; use datafusion::{ catalog::Session, - common::{plan_err, project_schema, Result, Statistics, ToDFSchema}, + common::{Result, Statistics, ToDFSchema, plan_err, project_schema}, datasource::{ - get_statistics_with_limit, + TableProvider, get_statistics_with_limit, listing::{ListingOptions, ListingTableConfig, ListingTableUrl, PartitionedFile}, physical_plan::FileScanConfig, - TableProvider, }, error::DataFusionError, execution::{ cache::{cache_manager::FileStatisticsCache, cache_unit::DefaultFileStatisticsCache}, context::SessionState, }, - logical_expr::{utils::conjunction, Expr, SortExpr, TableProviderFilterPushDown, TableType}, - physical_expr::{create_physical_expr, expressions, LexOrdering, PhysicalSortExpr}, - physical_plan::{empty::EmptyExec, ExecutionPlan}, + logical_expr::{Expr, SortExpr, TableProviderFilterPushDown, TableType, utils::conjunction}, + physical_expr::{LexOrdering, PhysicalSortExpr, create_physical_expr, expressions}, + physical_plan::{ExecutionPlan, empty::EmptyExec}, }; use futures::{ + StreamExt, future::{self, try_join_all}, - stream, StreamExt, + stream, }; use hashbrown::HashMap; use helpers::*; @@ -218,8 +218,8 @@ impl NewListingTable { /// This method first checks if the statistics for the given file are already cached. /// If they are, it returns the cached statistics. /// If they are not, it infers the statistics from the file and stores them in the cache. - async fn do_collect_statistics<'a>( - &'a self, + async fn do_collect_statistics( + &self, ctx: &SessionState, store: &Arc, part_file: &PartitionedFile, @@ -449,7 +449,7 @@ fn repartition_sorted_groups( } // split max_group into odd and even groups - let group_cap = (max_group.len() + 1) / 2; + let group_cap = max_group.len().div_ceil(2); let mut odd_group = Vec::with_capacity(group_cap); let mut even_group = Vec::with_capacity(group_cap); diff --git a/src/service/search/datafusion/table_provider/uniontable.rs b/src/service/search/datafusion/table_provider/uniontable.rs index a077708614..54a2feb9dd 100644 --- a/src/service/search/datafusion/table_provider/uniontable.rs +++ b/src/service/search/datafusion/table_provider/uniontable.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,7 +22,7 @@ use datafusion::{ common::Result, datasource::TableProvider, logical_expr::{Expr, TableProviderFilterPushDown, TableType}, - physical_plan::{empty::EmptyExec, union::UnionExec, ExecutionPlan}, + physical_plan::{ExecutionPlan, empty::EmptyExec, union::UnionExec}, }; #[derive(Debug)] diff --git a/src/service/search/datafusion/udaf/mod.rs b/src/service/search/datafusion/udaf/mod.rs index 249c1b080e..f81e47e345 100644 --- a/src/service/search/datafusion/udaf/mod.rs +++ b/src/service/search/datafusion/udaf/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udaf/percentile_cont.rs b/src/service/search/datafusion/udaf/percentile_cont.rs index 305034700f..b647596992 100644 --- a/src/service/search/datafusion/udaf/percentile_cont.rs +++ b/src/service/search/datafusion/udaf/percentile_cont.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -16,8 +16,8 @@ use std::{fmt::Formatter, sync::Arc}; use arrow::array::{ - Array, AsArray, Float32Array, Int16Array, Int32Array, Int64Array, Int8Array, RecordBatch, - UInt16Array, UInt32Array, UInt64Array, UInt8Array, + Array, AsArray, Float32Array, Int8Array, Int16Array, Int32Array, Int64Array, RecordBatch, + UInt8Array, UInt16Array, UInt32Array, UInt64Array, }; use arrow_schema::{Field, Schema}; use datafusion::{ @@ -25,12 +25,12 @@ use datafusion::{ array::{ArrayRef, Float64Array}, datatypes::DataType, }, - common::{downcast_value, internal_err, not_impl_err, plan_err, DataFusionError}, + common::{DataFusionError, downcast_value, internal_err, not_impl_err, plan_err}, error::Result, logical_expr::{ + Accumulator, AggregateUDFImpl, ColumnarValue, Signature, TypeSignature, Volatility, function::{AccumulatorArgs, StateFieldsArgs}, utils::format_state_name, - Accumulator, AggregateUDFImpl, ColumnarValue, Signature, TypeSignature, Volatility, }, physical_plan::PhysicalExpr, scalar::ScalarValue, diff --git a/src/service/search/datafusion/udf/arr_descending_udf.rs b/src/service/search/datafusion/udf/arr_descending_udf.rs index 987aa5cc0f..f0efc178b6 100644 --- a/src/service/search/datafusion/udf/arr_descending_udf.rs +++ b/src/service/search/datafusion/udf/arr_descending_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/arrcount_udf.rs b/src/service/search/datafusion/udf/arrcount_udf.rs index 96e8c79943..8e92656c96 100644 --- a/src/service/search/datafusion/udf/arrcount_udf.rs +++ b/src/service/search/datafusion/udf/arrcount_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/arrindex_udf.rs b/src/service/search/datafusion/udf/arrindex_udf.rs index 9cfd83823f..b71d216170 100644 --- a/src/service/search/datafusion/udf/arrindex_udf.rs +++ b/src/service/search/datafusion/udf/arrindex_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/arrjoin_udf.rs b/src/service/search/datafusion/udf/arrjoin_udf.rs index e3332a5be7..d4e340c500 100644 --- a/src/service/search/datafusion/udf/arrjoin_udf.rs +++ b/src/service/search/datafusion/udf/arrjoin_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/arrsort_udf.rs b/src/service/search/datafusion/udf/arrsort_udf.rs index 2086136b8b..ef754fea54 100644 --- a/src/service/search/datafusion/udf/arrsort_udf.rs +++ b/src/service/search/datafusion/udf/arrsort_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/arrzip_udf.rs b/src/service/search/datafusion/udf/arrzip_udf.rs index 480b56f924..b66e03e4f5 100644 --- a/src/service/search/datafusion/udf/arrzip_udf.rs +++ b/src/service/search/datafusion/udf/arrzip_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/cast_to_arr_udf.rs b/src/service/search/datafusion/udf/cast_to_arr_udf.rs index 132e151b54..4a3222964f 100644 --- a/src/service/search/datafusion/udf/cast_to_arr_udf.rs +++ b/src/service/search/datafusion/udf/cast_to_arr_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/cipher_udf.rs b/src/service/search/datafusion/udf/cipher_udf.rs index 15550ffc1f..fcaa0dabbe 100644 --- a/src/service/search/datafusion/udf/cipher_udf.rs +++ b/src/service/search/datafusion/udf/cipher_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -81,7 +81,7 @@ fn decrypt() -> ScalarFunctionImplementation { "second argument to decrypt must be a key-name string".to_string(), ), None, - )) + )); } }; @@ -131,7 +131,9 @@ fn decrypt() -> ScalarFunctionImplementation { .collect::(); if let Some(e) = last_error { - log::info!("encountered some errors while decrypting, total count {err_count}, last error : {e}"); + log::info!( + "encountered some errors while decrypting, total count {err_count}, last error : {e}" + ); } Ok(ColumnarValue::from(Arc::new(ret) as ArrayRef)) @@ -158,7 +160,7 @@ fn encrypt() -> ScalarFunctionImplementation { "second argument to encrypt must be a key-name string".to_string(), ), None, - )) + )); } }; @@ -208,7 +210,9 @@ fn encrypt() -> ScalarFunctionImplementation { .collect::(); if let Some(e) = last_error { - log::info!("encountered some errors while decrypting, total count {err_count}, last error : {e}"); + log::info!( + "encountered some errors while decrypting, total count {err_count}, last error : {e}" + ); } Ok(ColumnarValue::from(Arc::new(ret) as ArrayRef)) diff --git a/src/service/search/datafusion/udf/date_format_udf.rs b/src/service/search/datafusion/udf/date_format_udf.rs index 213beca10e..449919c4e6 100644 --- a/src/service/search/datafusion/udf/date_format_udf.rs +++ b/src/service/search/datafusion/udf/date_format_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/fuzzy_match_udf.rs b/src/service/search/datafusion/udf/fuzzy_match_udf.rs index 6a1f1c4c5f..2f23489a2e 100644 --- a/src/service/search/datafusion/udf/fuzzy_match_udf.rs +++ b/src/service/search/datafusion/udf/fuzzy_match_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/histogram_udf.rs b/src/service/search/datafusion/udf/histogram_udf.rs index a508907d4c..6aacc74f47 100644 --- a/src/service/search/datafusion/udf/histogram_udf.rs +++ b/src/service/search/datafusion/udf/histogram_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/match_all_udf.rs b/src/service/search/datafusion/udf/match_all_udf.rs index e99e425569..1b6a5cc089 100644 --- a/src/service/search/datafusion/udf/match_all_udf.rs +++ b/src/service/search/datafusion/udf/match_all_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/regexp_matches_udf.rs b/src/service/search/datafusion/udf/regexp_matches_udf.rs index 16d6526b8d..9fab70d497 100644 --- a/src/service/search/datafusion/udf/regexp_matches_udf.rs +++ b/src/service/search/datafusion/udf/regexp_matches_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use arrow::array::{Array, ArrayRef, GenericStringBuilder, ListBuilder, OffsetSiz use arrow_schema::Field; use datafusion::{ arrow::datatypes::DataType::{self, *}, - common::{cast::as_generic_string_array, exec_err, ScalarValue}, + common::{ScalarValue, cast::as_generic_string_array, exec_err}, error::{DataFusionError, Result}, logical_expr::{ColumnarValue, ScalarUDF, ScalarUDFImpl, Signature, TypeSignature, Volatility}, }; diff --git a/src/service/search/datafusion/udf/regexp_udf.rs b/src/service/search/datafusion/udf/regexp_udf.rs index 213ebc3235..e6c4dd9ad1 100644 --- a/src/service/search/datafusion/udf/regexp_udf.rs +++ b/src/service/search/datafusion/udf/regexp_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,8 +19,8 @@ use arrow_schema::{Field, Fields}; use datafusion::{ arrow::{ array::{ - as_large_list_array, as_list_array, as_string_array, Array, ArrayData, ArrayRef, - BooleanArray, StringArray, StructArray, + Array, ArrayData, ArrayRef, BooleanArray, StringArray, StructArray, + as_large_list_array, as_list_array, as_string_array, }, datatypes::DataType, }, @@ -32,7 +32,7 @@ use datafusion::{ TypeSignature::Exact, Volatility, }, physical_plan::ColumnarValue, - prelude::{create_udf, Expr}, + prelude::{Expr, create_udf}, scalar::ScalarValue, }; use once_cell::sync::Lazy; diff --git a/src/service/search/datafusion/udf/spath_udf.rs b/src/service/search/datafusion/udf/spath_udf.rs index 258d9cc632..dce5f6ebaf 100644 --- a/src/service/search/datafusion/udf/spath_udf.rs +++ b/src/service/search/datafusion/udf/spath_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/str_match_udf.rs b/src/service/search/datafusion/udf/str_match_udf.rs index 7c1471edd3..8e5c0dbd8a 100644 --- a/src/service/search/datafusion/udf/str_match_udf.rs +++ b/src/service/search/datafusion/udf/str_match_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -93,7 +93,7 @@ pub fn str_match_expr_impl(case_insensitive: bool) -> ScalarFunctionImplementati "Invalid argument types[needle] to str_match function".to_string(), ), None, - )) + )); } }; if needle.is_none() || needle.as_ref().unwrap().is_empty() { diff --git a/src/service/search/datafusion/udf/string_to_array_v2_udf.rs b/src/service/search/datafusion/udf/string_to_array_v2_udf.rs index abad2e8b45..3ac9d72e12 100644 --- a/src/service/search/datafusion/udf/string_to_array_v2_udf.rs +++ b/src/service/search/datafusion/udf/string_to_array_v2_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/time_range_udf.rs b/src/service/search/datafusion/udf/time_range_udf.rs index 2f88635a8b..164b78161e 100644 --- a/src/service/search/datafusion/udf/time_range_udf.rs +++ b/src/service/search/datafusion/udf/time_range_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/to_arr_string_udf.rs b/src/service/search/datafusion/udf/to_arr_string_udf.rs index 6215d1bb65..7ad51c806a 100644 --- a/src/service/search/datafusion/udf/to_arr_string_udf.rs +++ b/src/service/search/datafusion/udf/to_arr_string_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/datafusion/udf/transform_udf.rs b/src/service/search/datafusion/udf/transform_udf.rs index 1ef1cdcb4a..57ce007fbf 100644 --- a/src/service/search/datafusion/udf/transform_udf.rs +++ b/src/service/search/datafusion/udf/transform_udf.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -27,7 +27,7 @@ use datafusion::{ prelude::create_udf, }; use vector_enrichment::TableRegistry; -use vrl::compiler::{runtime::Runtime, TargetValueRef, VrlRuntime}; +use vrl::compiler::{TargetValueRef, VrlRuntime, runtime::Runtime}; use crate::{common::infra::config::QUERY_FUNCTIONS, service::ingestion::compile_vrl_function}; diff --git a/src/service/search/grpc/flight.rs b/src/service/search/grpc/flight.rs index 237c241c17..8a3381ea73 100644 --- a/src/service/search/grpc/flight.rs +++ b/src/service/search/grpc/flight.rs @@ -50,9 +50,9 @@ use crate::service::{ search::{ datafusion::{ distributed_plan::{ + NewEmptyExecVisitor, ReplaceTableScanExec, codec::{ComposedPhysicalExtensionCodec, EmptyExecPhysicalExtensionCodec}, empty_exec::NewEmptyExec, - NewEmptyExecVisitor, ReplaceTableScanExec, }, exec::{prepare_datafusion_context, register_udf}, plan::tantivy_count_exec::TantivyCountExec, diff --git a/src/service/search/grpc/storage.rs b/src/service/search/grpc/storage.rs index ea238c148c..5a4db239b5 100644 --- a/src/service/search/grpc/storage.rs +++ b/src/service/search/grpc/storage.rs @@ -18,7 +18,8 @@ use std::{collections::HashSet, sync::Arc}; use anyhow::Context; use arrow_schema::Schema; use config::{ - get_config, is_local_disk_storage, + FILE_EXT_TANTIVY, FILE_EXT_TANTIVY_FOLDER, INDEX_FIELD_NAME_FOR_ALL, get_config, + is_local_disk_storage, meta::{ bitvec::BitVec, inverted_index::{InvertedIndexOptimizeMode, InvertedIndexTantivyMode}, @@ -28,10 +29,9 @@ use config::{ utils::{ file::is_exists, inverted_index::convert_parquet_idx_file_name_to_tantivy_file, - tantivy::tokenizer::{o2_tokenizer_build, O2_TOKENIZER}, + tantivy::tokenizer::{O2_TOKENIZER, o2_tokenizer_build}, time::BASE_TIME, }, - FILE_EXT_TANTIVY, FILE_EXT_TANTIVY_FOLDER, INDEX_FIELD_NAME_FOR_ALL, }; use datafusion::execution::cache::cache_manager::FileStatisticsCache; use futures::future::try_join_all; @@ -55,7 +55,7 @@ use crate::service::{ caching_directory::CachingDirectory, convert_puffin_file_to_tantivy_dir, footer_cache::FooterCache, - reader::{warm_up_terms, PuffinDirReader}, + reader::{PuffinDirReader, warm_up_terms}, reader_cache, }, }, @@ -431,10 +431,10 @@ async fn cache_files_inner( // return file_name if download failed if let Some(e) = ret { log::warn!( - "[trace_id {trace_id}] search->storage: download file to cache err: {}, file: {}", - e, - file_name - ); + "[trace_id {trace_id}] search->storage: download file to cache err: {}, file: {}", + e, + file_name + ); } drop(permit); }); @@ -942,7 +942,7 @@ fn repartition_sorted_groups( } // split max_group into odd and even groups - let group_cap = (max_group.len() + 1) / 2; + let group_cap = max_group.len().div_ceil(2); let mut odd_group = Vec::with_capacity(group_cap); let mut even_group = Vec::with_capacity(group_cap); diff --git a/src/service/search/grpc/wal.rs b/src/service/search/grpc/wal.rs index ed709346da..86a29c7774 100644 --- a/src/service/search/grpc/wal.rs +++ b/src/service/search/grpc/wal.rs @@ -15,7 +15,7 @@ use std::{path::Path, sync::Arc}; -use arrow::array::{new_null_array, ArrayRef}; +use arrow::array::{ArrayRef, new_null_array}; use config::{ get_config, meta::{ diff --git a/src/service/search/grpc_search.rs b/src/service/search/grpc_search.rs index 0f6232cc6c..7d56464ae1 100644 --- a/src/service/search/grpc_search.rs +++ b/src/service/search/grpc_search.rs @@ -20,8 +20,8 @@ use config::{ utils::json, }; use infra::errors::{Error, ErrorCodes}; -use rand::{rngs::StdRng, seq::SliceRandom, SeedableRng}; -use tracing::{info_span, Instrument}; +use rand::{SeedableRng, rngs::StdRng, seq::SliceRandom}; +use tracing::{Instrument, info_span}; use crate::{ common::infra::cluster as infra_cluster, diff --git a/src/service/search/index.rs b/src/service/search/index.rs index 5db2d37a01..86e2c4e391 100644 --- a/src/service/search/index.rs +++ b/src/service/search/index.rs @@ -18,14 +18,14 @@ use std::{ sync::Arc, }; -use config::{utils::tantivy::tokenizer::o2_collect_tokens, INDEX_FIELD_NAME_FOR_ALL}; +use config::{INDEX_FIELD_NAME_FOR_ALL, utils::tantivy::tokenizer::o2_collect_tokens}; use datafusion::{ arrow::datatypes::{DataType, SchemaRef}, logical_expr::Operator, physical_expr::ScalarFunctionExpr, physical_plan::{ - expressions::{BinaryExpr, Column, InListExpr, LikeExpr, Literal}, PhysicalExpr, + expressions::{BinaryExpr, Column, InListExpr, LikeExpr, Literal}, }, scalar::ScalarValue, }; @@ -33,9 +33,9 @@ use hashbrown::HashSet; use serde::{Deserialize, Serialize}; use sqlparser::ast::{BinaryOperator, Expr, FunctionArguments}; use tantivy::{ + Term, query::{BooleanQuery, FuzzyTermQuery, Occur, PhrasePrefixQuery, Query, RegexQuery, TermQuery}, schema::{Field, IndexRecordOption, Schema}, - Term, }; use super::{ diff --git a/src/service/search/mod.rs b/src/service/search/mod.rs index 41cb8ad02a..970a0ab52d 100644 --- a/src/service/search/mod.rs +++ b/src/service/search/mod.rs @@ -19,7 +19,7 @@ use arrow_schema::{DataType, Field, Schema}; use cache::cacher::get_ts_col_order_by; use chrono::{Duration, Utc}; use config::{ - get_config, ider, + TIMESTAMP_COL_NAME, get_config, ider, meta::{ cluster::RoleGroup, search, @@ -33,7 +33,6 @@ use config::{ schema::filter_source_by_partition_key, sql::{is_aggregate_query, is_simple_aggregate_query}, }, - TIMESTAMP_COL_NAME, }; use datafusion::distributed_plan::streaming_aggs_exec; use hashbrown::HashMap; diff --git a/src/service/search/sql.rs b/src/service/search/sql.rs index e18b2a1cb4..5c77577c16 100644 --- a/src/service/search/sql.rs +++ b/src/service/search/sql.rs @@ -18,22 +18,21 @@ use std::{ops::ControlFlow, sync::Arc}; use arrow_schema::FieldRef; use chrono::Duration; use config::{ - get_config, + ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, get_config, meta::{ inverted_index::InvertedIndexOptimizeMode, - sql::{resolve_stream_names_with_type, OrderBy, Sql as MetaSql, TableReferenceExt}, + sql::{OrderBy, Sql as MetaSql, TableReferenceExt, resolve_stream_names_with_type}, stream::StreamType, }, utils::sql::AGGREGATE_UDF_LIST, - ID_COL_NAME, ORIGINAL_DATA_COL_NAME, TIMESTAMP_COL_NAME, }; use datafusion::{arrow::datatypes::Schema, common::TableReference}; use hashbrown::{HashMap, HashSet}; use infra::{ errors::{Error, ErrorCodes}, schema::{ - get_stream_setting_defined_schema_fields, get_stream_setting_fts_fields, - get_stream_setting_index_fields, unwrap_stream_settings, SchemaCache, + SchemaCache, get_stream_setting_defined_schema_fields, get_stream_setting_fts_fields, + get_stream_setting_index_fields, unwrap_stream_settings, }, }; use once_cell::sync::Lazy; @@ -57,7 +56,7 @@ use super::{ FUZZY_MATCH_ALL_UDF_NAME, MATCH_ALL_RAW_IGNORE_CASE_UDF_NAME, MATCH_ALL_RAW_UDF_NAME, MATCH_ALL_UDF_NAME, }, - index::{get_index_condition_from_expr, IndexCondition}, + index::{IndexCondition, get_index_condition_from_expr}, request::Request, utils::{is_field, is_value, split_conjunction, trim_quotes}, }; @@ -1574,7 +1573,7 @@ pub fn pickup_where(sql: &str, meta: Option) -> Result, fn o2_id_is_needed(schemas: &HashMap>) -> bool { schemas.values().any(|schema| { let stream_setting = unwrap_stream_settings(schema.schema()); - stream_setting.map_or(false, |setting| setting.store_original_data) + stream_setting.is_some_and(|setting| setting.store_original_data) }) } @@ -2048,7 +2047,7 @@ mod tests { assert!(convert_histogram_interval_to_seconds("1 months").is_err()); // months is not supported assert!(convert_histogram_interval_to_seconds("1 year").is_err()); // year is not supported assert!(convert_histogram_interval_to_seconds("1 years").is_err()); // years is not - // supported + // supported } #[test] diff --git a/src/service/search/super_cluster/follower.rs b/src/service/search/super_cluster/follower.rs index 2b79569a01..9bc5fc212d 100644 --- a/src/service/search/super_cluster/follower.rs +++ b/src/service/search/super_cluster/follower.rs @@ -25,7 +25,7 @@ use config::{ utils::time::BASE_TIME, }; use datafusion::{ - common::{tree_node::TreeNode, TableReference}, + common::{TableReference, tree_node::TreeNode}, physical_plan::ExecutionPlan, prelude::SessionContext, }; @@ -45,11 +45,11 @@ use crate::service::search::{ }, datafusion::{ distributed_plan::{ + NewEmptyExecVisitor, codec::{ComposedPhysicalExtensionCodec, EmptyExecPhysicalExtensionCodec}, empty_exec::NewEmptyExec, node::{RemoteScanNode, SearchInfos}, remote_scan::RemoteScanExec, - NewEmptyExecVisitor, }, exec::{prepare_datafusion_context, register_udf}, }, diff --git a/src/service/search/super_cluster/leader.rs b/src/service/search/super_cluster/leader.rs index e4f3287309..24dc2309ad 100644 --- a/src/service/search/super_cluster/leader.rs +++ b/src/service/search/super_cluster/leader.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -23,7 +23,7 @@ use config::{ utils::json, }; use datafusion::{ - common::{tree_node::TreeNode, DataFusionError}, + common::{DataFusionError, tree_node::TreeNode}, physical_plan::{displayable, visit_execution_plan}, }; use hashbrown::HashMap; @@ -31,10 +31,11 @@ use infra::errors::{Error, ErrorCodes, Result}; use itertools::Itertools; use o2_enterprise::enterprise::super_cluster::search::get_cluster_nodes; use proto::cluster_rpc; -use tracing::{info_span, Instrument}; +use tracing::{Instrument, info_span}; use tracing_opentelemetry::OpenTelemetrySpanExt; use crate::service::search::{ + DATAFUSION_RUNTIME, cluster::flight::{generate_context, register_table}, datafusion::distributed_plan::{ remote_scan::RemoteScanExec, @@ -43,7 +44,6 @@ use crate::service::search::{ request::Request, sql::Sql, utils::ScanStatsVisitor, - DATAFUSION_RUNTIME, }; #[async_recursion] diff --git a/src/service/search/super_cluster/mod.rs b/src/service/search/super_cluster/mod.rs index 8544e5d3f6..768096dd6f 100644 --- a/src/service/search/super_cluster/mod.rs +++ b/src/service/search/super_cluster/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/tantivy/mod.rs b/src/service/search/tantivy/mod.rs index 6046df0a76..8ec02ce3d1 100644 --- a/src/service/search/tantivy/mod.rs +++ b/src/service/search/tantivy/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/tantivy/puffin/mod.rs b/src/service/search/tantivy/puffin/mod.rs index a8e4230cf3..05e6f216ee 100644 --- a/src/service/search/tantivy/puffin/mod.rs +++ b/src/service/search/tantivy/puffin/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/tantivy/puffin/reader.rs b/src/service/search/tantivy/puffin/reader.rs index 878bd58395..ce0b8375e1 100644 --- a/src/service/search/tantivy/puffin/reader.rs +++ b/src/service/search/tantivy/puffin/reader.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -15,7 +15,7 @@ use std::sync::Arc; -use anyhow::{anyhow, ensure, Result}; +use anyhow::{Result, anyhow, ensure}; use bytes::Buf; use super::*; diff --git a/src/service/search/tantivy/puffin/writer.rs b/src/service/search/tantivy/puffin/writer.rs index bee75ab4b6..14fa02fcdc 100644 --- a/src/service/search/tantivy/puffin/writer.rs +++ b/src/service/search/tantivy/puffin/writer.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -18,8 +18,8 @@ use std::{collections::HashMap, io, mem}; use anyhow::{Context, Result}; use super::{ - BlobMetadata, BlobMetadataBuilder, BlobTypes, PuffinFooterFlags, PuffinMeta, MAGIC, MAGIC_SIZE, - MIN_FOOTER_SIZE, + BlobMetadata, BlobMetadataBuilder, BlobTypes, MAGIC, MAGIC_SIZE, MIN_FOOTER_SIZE, + PuffinFooterFlags, PuffinMeta, }; pub struct PuffinBytesWriter { diff --git a/src/service/search/tantivy/puffin_directory/caching_directory.rs b/src/service/search/tantivy/puffin_directory/caching_directory.rs index 51c57597c2..a0199e95b2 100644 --- a/src/service/search/tantivy/puffin_directory/caching_directory.rs +++ b/src/service/search/tantivy/puffin_directory/caching_directory.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,8 +22,8 @@ use std::{ use async_trait::async_trait; use tantivy::{ - directory::{error::OpenReadError, FileHandle, OwnedBytes}, Directory, HasLen, + directory::{FileHandle, OwnedBytes, error::OpenReadError}, }; use super::footer_cache::FooterCache; @@ -176,7 +176,7 @@ mod tests { use std::{path::Path, sync::Arc}; - use tantivy::{directory::RamDirectory, Directory}; + use tantivy::{Directory, directory::RamDirectory}; use super::CachingDirectory; diff --git a/src/service/search/tantivy/puffin_directory/footer_cache.rs b/src/service/search/tantivy/puffin_directory/footer_cache.rs index b4b35f2243..140a47a776 100644 --- a/src/service/search/tantivy/puffin_directory/footer_cache.rs +++ b/src/service/search/tantivy/puffin_directory/footer_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -24,9 +24,9 @@ use byteorder::ByteOrder; use bytes::Bytes; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; -use tantivy::{directory::OwnedBytes, Directory, ReloadPolicy}; +use tantivy::{Directory, ReloadPolicy, directory::OwnedBytes}; -use super::{caching_directory::CachingDirectory, EMPTY_FILE_EXT, FOOTER_CACHE}; +use super::{EMPTY_FILE_EXT, FOOTER_CACHE, caching_directory::CachingDirectory}; const FOOTER_CACHE_VERSION: u32 = 1; const FOOTER_VERSION_LEN: usize = 4; diff --git a/src/service/search/tantivy/puffin_directory/mod.rs b/src/service/search/tantivy/puffin_directory/mod.rs index 42aa2bda6b..92dfae9265 100644 --- a/src/service/search/tantivy/puffin_directory/mod.rs +++ b/src/service/search/tantivy/puffin_directory/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/tantivy/puffin_directory/reader.rs b/src/service/search/tantivy/puffin_directory/reader.rs index f5a277bc44..dd1e84ecdb 100644 --- a/src/service/search/tantivy/puffin_directory/reader.rs +++ b/src/service/search/tantivy/puffin_directory/reader.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -23,14 +23,14 @@ use std::{ use futures::future::try_join_all; use hashbrown::HashMap; use tantivy::{ - directory::{error::OpenReadError, Directory, FileHandle, OwnedBytes}, HasLen, + directory::{Directory, FileHandle, OwnedBytes, error::OpenReadError}, }; use crate::service::search::tantivy::{ - puffin::{reader::PuffinBytesReader, BlobMetadata}, + puffin::{BlobMetadata, reader::PuffinBytesReader}, puffin_directory::{ - get_file_from_empty_puffin_dir_with_ext, EMPTY_PUFFIN_DIRECTORY, EMPTY_PUFFIN_SEG_ID, + EMPTY_PUFFIN_DIRECTORY, EMPTY_PUFFIN_SEG_ID, get_file_from_empty_puffin_dir_with_ext, }, }; diff --git a/src/service/search/tantivy/puffin_directory/reader_cache.rs b/src/service/search/tantivy/puffin_directory/reader_cache.rs index 472d4e7ec2..869b804938 100644 --- a/src/service/search/tantivy/puffin_directory/reader_cache.rs +++ b/src/service/search/tantivy/puffin_directory/reader_cache.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/search/tantivy/puffin_directory/writer.rs b/src/service/search/tantivy/puffin_directory/writer.rs index 063b5c45e9..0bf3bcfbab 100644 --- a/src/service/search/tantivy/puffin_directory/writer.rs +++ b/src/service/search/tantivy/puffin_directory/writer.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,13 +22,13 @@ use std::{ use anyhow::{Context, Result}; use hashbrown::HashSet; use tantivy::{ - directory::{error::OpenReadError, Directory, RamDirectory, WatchCallback, WatchHandle}, HasLen, + directory::{Directory, RamDirectory, WatchCallback, WatchHandle, error::OpenReadError}, }; -use super::{footer_cache::build_footer_cache, FOOTER_CACHE}; +use super::{FOOTER_CACHE, footer_cache::build_footer_cache}; use crate::service::search::tantivy::{ - puffin::{writer::PuffinBytesWriter, BlobTypes}, + puffin::{BlobTypes, writer::PuffinBytesWriter}, puffin_directory::{ALLOWED_FILE_EXT, META_JSON}, }; /// Puffin directory is a puffin file which contains all the tantivy files. diff --git a/src/service/search/utils.rs b/src/service/search/utils.rs index 39768e936d..dd4c146f7d 100644 --- a/src/service/search/utils.rs +++ b/src/service/search/utils.rs @@ -20,7 +20,7 @@ use datafusion::physical_plan::{ExecutionPlan, ExecutionPlanVisitor}; use sqlparser::ast::{BinaryOperator, Expr}; use tokio::sync::Mutex; -use super::{datafusion::distributed_plan::remote_scan::RemoteScanExec, DATAFUSION_RUNTIME}; +use super::{DATAFUSION_RUNTIME, datafusion::distributed_plan::remote_scan::RemoteScanExec}; type Cleanup = Pin + Send>>; diff --git a/src/service/self_reporting/ingestion.rs b/src/service/self_reporting/ingestion.rs index 944a7ef339..a6d7836fab 100644 --- a/src/service/self_reporting/ingestion.rs +++ b/src/service/self_reporting/ingestion.rs @@ -13,20 +13,20 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use config::{ + META_ORG_ID, cluster::LOCAL_NODE, get_config, meta::{ search::SearchEventType, self_reporting::{ - usage::{AggregatedData, GroupKey, UsageData, UsageEvent, USAGE_STREAM}, ReportingData, + usage::{AggregatedData, GroupKey, USAGE_STREAM, UsageData, UsageEvent}, }, stream::{StreamParams, StreamType}, }, utils::json, - META_ORG_ID, }; use hashbrown::HashMap; use proto::cluster_rpc; diff --git a/src/service/self_reporting/mod.rs b/src/service/self_reporting/mod.rs index 5ba3a6569d..ec361a627e 100644 --- a/src/service/self_reporting/mod.rs +++ b/src/service/self_reporting/mod.rs @@ -17,17 +17,18 @@ use chrono::{DateTime, Datelike, Timelike}; #[cfg(feature = "enterprise")] use config::META_ORG_ID; use config::{ + SIZE_IN_MB, cluster::LOCAL_NODE, get_config, meta::{ self_reporting::{ + ReportingData, error::ErrorData, usage::{RequestStats, TriggerData, UsageData, UsageEvent, UsageType}, - ReportingData, }, stream::StreamType, }, - metrics, SIZE_IN_MB, + metrics, }; #[cfg(feature = "enterprise")] use o2_enterprise::enterprise::common::auditor; diff --git a/src/service/self_reporting/queues.rs b/src/service/self_reporting/queues.rs index a86b5e955f..00755f6eb1 100644 --- a/src/service/self_reporting/queues.rs +++ b/src/service/self_reporting/queues.rs @@ -16,21 +16,20 @@ use std::sync::Arc; use config::{ - get_config, + META_ORG_ID, get_config, meta::{ self_reporting::{ - error::ErrorData, - usage::{TriggerData, ERROR_STREAM, TRIGGERS_USAGE_STREAM}, ReportingData, ReportingMessage, ReportingQueue, ReportingRunner, + error::ErrorData, + usage::{ERROR_STREAM, TRIGGERS_USAGE_STREAM, TriggerData}, }, stream::{StreamParams, StreamType}, }, utils::json, - META_ORG_ID, }; use once_cell::sync::Lazy; use tokio::{ - sync::{mpsc, Mutex}, + sync::{Mutex, mpsc}, time, }; @@ -192,7 +191,9 @@ async fn ingest_buffered_data(thread_id: usize, buffered: Vec) { .enqueue(ReportingData::Trigger(Box::new(trigger))) .await { - log::error!("[SELF-REPORTING] Error in pushing back un-ingested TriggerData to UsageQueue: {e}"); + log::error!( + "[SELF-REPORTING] Error in pushing back un-ingested TriggerData to UsageQueue: {e}" + ); } } } diff --git a/src/service/stream.rs b/src/service/stream.rs index 4944272698..c78747cd0e 100644 --- a/src/service/stream.rs +++ b/src/service/stream.rs @@ -15,10 +15,10 @@ use std::io::Error; -use actix_web::{http, http::StatusCode, HttpResponse}; +use actix_web::{HttpResponse, http, http::StatusCode}; use arrow_schema::DataType; use config::{ - is_local_disk_storage, + SIZE_IN_MB, SQL_FULL_TEXT_SEARCH_FIELDS, is_local_disk_storage, meta::{ promql, stream::{ @@ -27,17 +27,17 @@ use config::{ }, }, utils::{json, time::now_micros}, - SIZE_IN_MB, SQL_FULL_TEXT_SEARCH_FIELDS, }; use datafusion::arrow::datatypes::Schema; use hashbrown::HashMap; use infra::{ cache::stats, schema::{ - unwrap_partition_time_level, unwrap_stream_settings, STREAM_RECORD_ID_GENERATOR, - STREAM_SCHEMAS, STREAM_SCHEMAS_COMPRESSED, STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, + STREAM_RECORD_ID_GENERATOR, STREAM_SCHEMAS, STREAM_SCHEMAS_COMPRESSED, + STREAM_SCHEMAS_LATEST, STREAM_SETTINGS, unwrap_partition_time_level, + unwrap_stream_settings, }, - table::distinct_values::{check_field_use, DistinctFieldRecord, OriginType}, + table::distinct_values::{DistinctFieldRecord, OriginType, check_field_use}, }; use crate::{ diff --git a/src/service/syslogs_route.rs b/src/service/syslogs_route.rs index 97669baff7..9baa42b978 100644 --- a/src/service/syslogs_route.rs +++ b/src/service/syslogs_route.rs @@ -15,7 +15,7 @@ use std::io; -use actix_web::{http::StatusCode, HttpResponse}; +use actix_web::{HttpResponse, http::StatusCode}; use config::ider; use ipnetwork::IpNetwork; diff --git a/src/service/tls/mod.rs b/src/service/tls/mod.rs index 1e258929b1..7334675459 100644 --- a/src/service/tls/mod.rs +++ b/src/service/tls/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/service/traces/mod.rs b/src/service/traces/mod.rs index d5b851cdab..a6768e09f8 100644 --- a/src/service/traces/mod.rs +++ b/src/service/traces/mod.rs @@ -15,10 +15,11 @@ use std::{collections::HashMap, io::Error, sync::Arc, time::Instant}; -use actix_web::{http, web, HttpResponse}; +use actix_web::{HttpResponse, http, web}; use bytes::BytesMut; use chrono::{Duration, Utc}; use config::{ + DISTINCT_FIELDS, TIMESTAMP_COL_NAME, cluster::LOCAL_NODE, get_config, meta::{ @@ -29,16 +30,15 @@ use config::{ }, metrics, utils::{flatten, json, schema_ext::SchemaExt}, - DISTINCT_FIELDS, TIMESTAMP_COL_NAME, }; use hashbrown::HashSet; -use infra::schema::{unwrap_partition_time_level, SchemaCache}; +use infra::schema::{SchemaCache, unwrap_partition_time_level}; use opentelemetry::trace::{SpanId, TraceId}; use opentelemetry_proto::tonic::{ collector::trace::v1::{ ExportTracePartialSuccess, ExportTraceServiceRequest, ExportTraceServiceResponse, }, - trace::v1::{status::StatusCode, Status}, + trace::v1::{Status, status::StatusCode}, }; use prost::Message; use serde_json::Map; @@ -56,10 +56,10 @@ use crate::{ service::{ alerts::alert::AlertExt, db, format_stream_name, - ingestion::{evaluate_trigger, grpc::get_val, write_file, TriggerAlertData}, + ingestion::{TriggerAlertData, evaluate_trigger, grpc::get_val, write_file}, metadata::{ - distinct_values::DvItem, trace_list_index::TraceListItem, write, MetadataItem, - MetadataType, + MetadataItem, MetadataType, distinct_values::DvItem, trace_list_index::TraceListItem, + write, }, schema::{check_for_schema, stream_schema_exists}, self_reporting::report_request_usage_stats, @@ -628,9 +628,9 @@ pub async fn ingest_json( let trace_id = value["trace_id"].to_string(); if timestamp < min_ts { log::error!( - "[TRACES:JSON] skipping span with timestamp older than allowed retention period, trace_id: {}", - &trace_id - ); + "[TRACES:JSON] skipping span with timestamp older than allowed retention period, trace_id: {}", + &trace_id + ); partial_success.rejected_spans += 1; continue; } diff --git a/src/service/users.rs b/src/service/users.rs index 1293e6a983..3c354a0b21 100644 --- a/src/service/users.rs +++ b/src/service/users.rs @@ -15,7 +15,7 @@ use std::io::Error; -use actix_web::{http, HttpResponse}; +use actix_web::{HttpResponse, http}; use config::{get_config, ider, utils::rand::generate_random_string}; #[cfg(feature = "enterprise")] use o2_openfga::{ diff --git a/src/super_cluster_queue/alerts.rs b/src/super_cluster_queue/alerts.rs index 4c10531c68..a6ad92812c 100644 --- a/src/super_cluster_queue/alerts.rs +++ b/src/super_cluster_queue/alerts.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use infra::{ - db::{connect_to_orm, ORM_CLIENT}, + db::{ORM_CLIENT, connect_to_orm}, errors::Result, table, }; diff --git a/src/super_cluster_queue/mod.rs b/src/super_cluster_queue/mod.rs index 7ae7827055..8b3ae7c1e2 100644 --- a/src/super_cluster_queue/mod.rs +++ b/src/super_cluster_queue/mod.rs @@ -28,7 +28,7 @@ mod search_job; mod short_urls; mod templates; -use config::cluster::{is_offline, LOCAL_NODE}; +use config::cluster::{LOCAL_NODE, is_offline}; use o2_enterprise::enterprise::super_cluster::queue::{ ActionScriptsQueue, AlertsQueue, DashboardsQueue, DestinationsQueue, FoldersQueue, MetaQueue, PipelinesQueue, SchedulerQueue, SchemasQueue, SearchJobsQueue, SuperClusterQueueTrait, diff --git a/src/wal/benches/write.rs b/src/wal/benches/write.rs index bf53c74d31..2b45309df4 100644 --- a/src/wal/benches/write.rs +++ b/src/wal/benches/write.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{BenchmarkId, Criterion, black_box, criterion_group, criterion_main}; use tempfile::tempdir; use wal::Writer; diff --git a/src/wal/src/lib.rs b/src/wal/src/lib.rs index fbc71cd41f..48c7558a0a 100644 --- a/src/wal/src/lib.rs +++ b/src/wal/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by diff --git a/src/wal/src/reader.rs b/src/wal/src/reader.rs index 6a9dcc85f5..d7d32f3f92 100644 --- a/src/wal/src/reader.rs +++ b/src/wal/src/reader.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -22,9 +22,9 @@ use std::{ use byteorder::{BigEndian, ReadBytesExt}; use crc32fast::Hasher; -use snafu::{ensure, ResultExt}; +use snafu::{ResultExt, ensure}; -use crate::{errors::*, FileHeader, ReadFrom}; +use crate::{FileHeader, ReadFrom, errors::*}; pub struct Reader { path: PathBuf, diff --git a/src/wal/src/writer.rs b/src/wal/src/writer.rs index 5f62422edf..ae73773104 100644 --- a/src/wal/src/writer.rs +++ b/src/wal/src/writer.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -14,7 +14,7 @@ // along with this program. If not, see . use std::{ - fs::{create_dir_all, remove_file, File, Metadata, OpenOptions}, + fs::{File, Metadata, OpenOptions, create_dir_all, remove_file}, io, io::{BufWriter, Seek, SeekFrom, Write}, path::PathBuf, @@ -24,7 +24,7 @@ use byteorder::{BigEndian, WriteBytesExt}; use crc32fast::Hasher; use snafu::ResultExt; -use crate::{errors::*, FileHeader}; +use crate::{FileHeader, errors::*}; pub struct Writer { path: PathBuf, diff --git a/src/wal/tests/wal.rs b/src/wal/tests/wal.rs index 8baedb8e89..03d14e5818 100644 --- a/src/wal/tests/wal.rs +++ b/src/wal/tests/wal.rs @@ -1,4 +1,4 @@ -// Copyright 2024 OpenObserve Inc. +// Copyright 2025 OpenObserve Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -19,7 +19,7 @@ use std::{ }; use tempfile::tempdir; -use wal::{build_file_path, Reader, Writer}; +use wal::{Reader, Writer, build_file_path}; #[test] fn test_wal_new() { diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 23a475062f..e1f67276a3 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -18,15 +18,15 @@ mod tests { use core::time; use std::{env, fs, net::SocketAddr, str, sync::Once, thread}; - use actix_web::{http::header::ContentType, test, web, App}; + use actix_web::{App, http::header::ContentType, test, web}; use arrow_flight::flight_service_server::FlightServiceServer; use bytes::{Bytes, BytesMut}; use chrono::{Duration, Utc}; use config::{ get_config, meta::{ - alerts::{alert::Alert, Operator, QueryCondition, TriggerCondition}, - dashboards::{v1, Dashboard}, + alerts::{Operator, QueryCondition, TriggerCondition, alert::Alert}, + dashboards::{Dashboard, v1}, triggers::Trigger, }, utils::json, @@ -48,7 +48,7 @@ mod tests { static START: Once = Once::new(); fn setup() -> (&'static str, &'static str) { - START.call_once(|| { + START.call_once(|| unsafe { env::set_var("ZO_ROOT_USER_EMAIL", "root@example.com"); env::set_var("ZO_ROOT_USER_PASSWORD", "Complexpass#123"); env::set_var("ZO_LOCAL_MODE", "true"); @@ -1558,9 +1558,11 @@ mod tests { // Optionally, deserialize and check the response body let body = test::read_body(resp).await; let destinations: Vec = serde_json::from_slice(&body).unwrap(); - assert!(destinations - .iter() - .any(|d| d.destination_type == DestinationType::Sns)); + assert!( + destinations + .iter() + .any(|d| d.destination_type == DestinationType::Sns) + ); } async fn e2e_update_sns_alert_destination() { diff --git a/web/src/components/ingestion/metrics/CloudWatchMetrics.vue b/web/src/components/ingestion/metrics/CloudWatchMetrics.vue index 56e81d912b..ee88a92935 100644 --- a/web/src/components/ingestion/metrics/CloudWatchMetrics.vue +++ b/web/src/components/ingestion/metrics/CloudWatchMetrics.vue @@ -1,4 +1,4 @@ -