Skip to content

Commit 4b6209b

Browse files
committed
Merge remote-tracking branch 'origin/main' into schema-detect
2 parents 637f33c + 1afa318 commit 4b6209b

20 files changed

+397
-50
lines changed

.github/workflows/build-push-edge-debug.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ jobs:
4545
push: true
4646
tags: parseable/parseable:edge-debug
4747
platforms: linux/amd64,linux/arm64
48-
cache-from: type=gha
49-
cache-to: type=gha,mode=max

.github/workflows/build-push-edge.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ jobs:
4545
push: true
4646
tags: parseable/parseable:edge
4747
platforms: linux/amd64,linux/arm64
48-
cache-from: type=gha
49-
cache-to: type=gha,mode=max

Cargo.lock

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "parseable"
3-
version = "1.7.3"
3+
version = "1.7.5"
44
authors = ["Parseable Team <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.83.0"
@@ -128,9 +128,8 @@ sha1_smol = { version = "1.0", features = ["std"] }
128128
static-files = "0.2"
129129
ureq = "2.12"
130130
url = "2.5"
131-
vergen = { version = "9.0", features = ["build", "cargo", "rustc", "si"] }
132131
vergen-gitcl = { version = "1.0", features = ["build", "cargo", "rustc", "si"] }
133-
zip = { version = "2.2", default-features = false, features = ["deflate"] }
132+
zip = { version = "2.3", default-features = false, features = ["deflate"] }
134133
anyhow = "1.0"
135134

136135
[dev-dependencies]
@@ -139,8 +138,8 @@ arrow = "54.0.0"
139138
temp-dir = "0.1.14"
140139

141140
[package.metadata.parseable_ui]
142-
assets-url = "https://github.com/parseablehq/console/releases/download/v0.9.18/build.zip"
143-
assets-sha1 = "4516db38c8e556707b29b33569f9b1e53d5165f2"
141+
assets-url = "https://github.com/parseablehq/console/releases/download/v0.9.20/build.zip"
142+
assets-sha1 = "58eb74bdb6727b5df04d6f9f339cf370c0bf4eec"
144143

145144
[features]
146145
debug = []

Dockerfile

+3-11
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,23 @@
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
# build stage
17-
FROM rust:1.84.0-bookworm AS builder
18-
17+
FROM rust:1.84.0-bookworm AS builder
1918

2019
LABEL org.opencontainers.image.title="Parseable"
2120
LABEL maintainer="Parseable Team <[email protected]>"
2221
LABEL org.opencontainers.image.vendor="Parseable Inc"
2322
LABEL org.opencontainers.image.licenses="AGPL-3.0"
2423

2524
WORKDIR /parseable
26-
27-
# Cache dependencies
28-
COPY Cargo.toml Cargo.lock build.rs ./
29-
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src
30-
31-
# Build the actual binary
32-
COPY src ./src
33-
COPY resources ./resources
25+
COPY . .
3426
RUN cargo build --release
3527

3628
# final stage
3729
FROM gcr.io/distroless/cc-debian12:latest
3830

3931
WORKDIR /parseable
4032

41-
# Copy the static binary into the final image
33+
# Copy the static shell into base image.
4234
COPY --from=builder /parseable/target/release/parseable /usr/bin/parseable
4335

4436
CMD ["/usr/bin/parseable"]

src/alerts/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ pub struct AlertsInfo {
886886
low: u64,
887887
medium: u64,
888888
high: u64,
889+
critical: u64,
889890
}
890891

891892
// TODO: add RBAC
@@ -898,6 +899,7 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
898899
let mut low = 0;
899900
let mut medium = 0;
900901
let mut high = 0;
902+
let mut critical = 0;
901903

902904
for (_, alert) in alerts.iter() {
903905
total += 1;
@@ -911,7 +913,7 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
911913
Severity::Low => low += 1,
912914
Severity::Medium => medium += 1,
913915
Severity::High => high += 1,
914-
_ => {}
916+
Severity::Critical => critical += 1,
915917
}
916918
}
917919

@@ -923,5 +925,6 @@ pub async fn get_alerts_info() -> Result<AlertsInfo, AlertError> {
923925
low,
924926
medium,
925927
high,
928+
critical,
926929
})
927930
}

src/cli.rs

+8
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ pub struct Options {
270270
)]
271271
pub row_group_size: usize,
272272

273+
#[arg(
274+
long,
275+
env = "P_EXECUTION_BATCH_SIZE",
276+
default_value = "20000",
277+
help = "batch size for query execution"
278+
)]
279+
pub execution_batch_size: usize,
280+
273281
#[arg(
274282
long = "compression-algo",
275283
env = "P_PARQUET_COMPRESSION_ALGO",

src/event/format/mod.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,19 @@ use super::{Event, DEFAULT_TIMESTAMP_KEY};
4141
pub mod json;
4242
pub mod known_schema;
4343

44-
static TIME_FIELD_NAME_PARTS: [&str; 2] = ["time", "date"];
44+
static TIME_FIELD_NAME_PARTS: [&str; 11] = [
45+
"time",
46+
"date",
47+
"timestamp",
48+
"created",
49+
"received",
50+
"ingested",
51+
"collected",
52+
"start",
53+
"end",
54+
"ts",
55+
"dt",
56+
];
4557
type EventSchema = Vec<Arc<Field>>;
4658

4759
/// Source of the logs, used to perform special processing for certain sources

src/handlers/http/modal/query_server.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ impl ParseableServer for QueryServer {
7676
.service(
7777
web::scope(&prism_base_path())
7878
.service(Server::get_prism_home())
79-
.service(Server::get_prism_logstream()),
79+
.service(Server::get_prism_logstream())
80+
.service(Server::get_prism_datasets()),
8081
)
8182
.service(Server::get_generated());
8283
}

src/handlers/http/modal/server.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ impl ParseableServer for Server {
9595
.service(
9696
web::scope(&prism_base_path())
9797
.service(Server::get_prism_home())
98-
.service(Server::get_prism_logstream()),
98+
.service(Server::get_prism_logstream())
99+
.service(Server::get_prism_datasets()),
99100
)
100101
.service(Self::get_ingest_otel_factory())
101102
.service(Self::get_generated());
@@ -180,6 +181,17 @@ impl Server {
180181
)
181182
}
182183

184+
pub fn get_prism_datasets() -> Scope {
185+
web::scope("/datasets").route(
186+
"",
187+
web::post()
188+
.to(http::prism_logstream::post_datasets)
189+
.authorize_for_stream(Action::GetStreamInfo)
190+
.authorize_for_stream(Action::GetStats)
191+
.authorize_for_stream(Action::GetRetention),
192+
)
193+
}
194+
183195
pub fn get_metrics_webscope() -> Scope {
184196
web::scope("/metrics").service(
185197
web::resource("").route(web::get().to(metrics::get).authorize(Action::Metrics)),

src/handlers/http/prism_logstream.rs

+21-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,33 @@
1717
*/
1818

1919
use actix_web::{
20-
web::{self, Path},
21-
Responder,
20+
web::{self, Json, Path},
21+
HttpRequest, Responder,
2222
};
2323

24-
use crate::prism::logstream::{get_prism_logstream_info, PrismLogstreamError};
24+
use crate::{
25+
prism::logstream::{get_prism_logstream_info, PrismDatasetRequest, PrismLogstreamError},
26+
utils::actix::extract_session_key_from_req,
27+
};
2528

2629
/// This API is essentially just combining the responses of /info and /schema together
2730
pub async fn get_info(stream_name: Path<String>) -> Result<impl Responder, PrismLogstreamError> {
2831
let prism_logstream_info = get_prism_logstream_info(&stream_name).await?;
2932

3033
Ok(web::Json(prism_logstream_info))
3134
}
35+
36+
/// A combination of /stats, /retention, /hottier, /info, /counts and /query
37+
pub async fn post_datasets(
38+
dataset_req: Option<Json<PrismDatasetRequest>>,
39+
req: HttpRequest,
40+
) -> Result<impl Responder, PrismLogstreamError> {
41+
let session_key = extract_session_key_from_req(&req)?;
42+
let dataset = dataset_req
43+
.map(|Json(r)| r)
44+
.unwrap_or_default()
45+
.get_datasets(session_key)
46+
.await?;
47+
48+
Ok(web::Json(dataset))
49+
}

src/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub enum SchemaVersion {
7474
V1,
7575
}
7676

77-
#[derive(Debug, Default)]
77+
#[derive(Debug, Default, Clone)]
7878
pub struct LogStreamMetadata {
7979
pub schema_version: SchemaVersion,
8080
pub schema: HashMap<String, Arc<Field>>,

src/parseable/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl Parseable {
171171
}
172172

173173
// Gets write privileges only for creating the stream when it doesn't already exist.
174-
self.streams.create(
174+
self.streams.get_or_create(
175175
self.options.clone(),
176176
stream_name.to_owned(),
177177
LogStreamMetadata::default(),
@@ -342,7 +342,7 @@ impl Parseable {
342342
schema_version,
343343
log_source,
344344
);
345-
self.streams.create(
345+
self.streams.get_or_create(
346346
self.options.clone(),
347347
stream_name.to_string(),
348348
metadata,
@@ -652,7 +652,7 @@ impl Parseable {
652652
SchemaVersion::V1, // New stream
653653
log_source,
654654
);
655-
self.streams.create(
655+
self.streams.get_or_create(
656656
self.options.clone(),
657657
stream_name.to_string(),
658658
metadata,

0 commit comments

Comments
 (0)