mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
feat: instrument sandbox isolation, data tables and in-flow script edits (#10981)
* feat: instrument sandbox isolation, data tables and in-flow script edits Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLnp4v49BozkDd3KeWn5Q3 * fix: address review findings on the new telemetry counters Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLnp4v49BozkDd3KeWn5Q3 * refactor: inline single-site telemetry helpers and trim what is collected Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLnp4v49BozkDd3KeWn5Q3 * docs: tighten the telemetry disclosure copy Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLnp4v49BozkDd3KeWn5Q3 * chore: update ee-repo-ref to 5921c03c8e28642efd1c390f590c0dab9834fa99 This commit updates the EE repository reference after PR #780 was merged in windmill-ee-private. Previous ee-repo-ref: 548b5e0421a04a2d9a76cce6efc6c91b1d8560ee New ee-repo-ref: 5921c03c8e28642efd1c390f590c0dab9834fa99 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
This commit is contained in:
co-authored by
Claude Opus 5
windmill-internal-app[bot]
Ruben Fiszel
parent
8aab5034a6
commit
130a2f7408
@@ -416,6 +416,16 @@ async fn run_datatable_migrations(
|
||||
|
||||
let applied_versions = read_applied_versions_on_client(&client, &datatable_name).await?;
|
||||
|
||||
// How the user scoped the run, for the counter emitted on the first migration
|
||||
// that lands below.
|
||||
let scope = if query.only.is_some() {
|
||||
"only"
|
||||
} else if query.up_to.is_some() {
|
||||
"up_to"
|
||||
} else {
|
||||
"all"
|
||||
};
|
||||
|
||||
let mut applied = Vec::new();
|
||||
for m in migrations {
|
||||
if let Some(only) = query.only {
|
||||
@@ -453,6 +463,14 @@ async fn run_datatable_migrations(
|
||||
))
|
||||
})?;
|
||||
applied.push(AppliedMigration { version: m.timestamp, name: m.name });
|
||||
// One event per run that moved the data table forward, emitted on the
|
||||
// first migration that lands rather than after the loop: a later one
|
||||
// failing returns early, and that run still advanced the data table. A
|
||||
// run with nothing pending stays uncounted — it is the common outcome of
|
||||
// opening the list and would drown out the runs that did something.
|
||||
if applied.len() == 1 {
|
||||
windmill_common::feature_usage::log_feature_usage("datatable", "migration_run", scope);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Json(RunDatatableMigrationsResult { applied }))
|
||||
@@ -594,6 +612,12 @@ async fn rollback_datatable_migrations(
|
||||
))
|
||||
})?;
|
||||
|
||||
windmill_common::feature_usage::log_feature_usage(
|
||||
"datatable",
|
||||
"migration_rollback",
|
||||
if query.only.is_some() { "only" } else { "last" },
|
||||
);
|
||||
|
||||
Ok(Json(RollbackDatatableMigrationsResult {
|
||||
rolled_back: vec![RolledBackMigration { version, name: definition.name }],
|
||||
}))
|
||||
@@ -824,6 +848,8 @@ async fn enable_datatable_migrations(
|
||||
)
|
||||
.await?;
|
||||
|
||||
windmill_common::feature_usage::log_feature_usage("datatable", "migrations_toggled", "on");
|
||||
|
||||
Ok(format!(
|
||||
"Enabled migrations for data table {datatable_name}"
|
||||
))
|
||||
@@ -892,6 +918,8 @@ async fn disable_datatable_migrations(
|
||||
.await?;
|
||||
}
|
||||
|
||||
windmill_common::feature_usage::log_feature_usage("datatable", "migrations_toggled", "off");
|
||||
|
||||
Ok(format!(
|
||||
"Disabled migrations for data table {datatable_name} and deleted its migrations"
|
||||
))
|
||||
@@ -1134,6 +1162,8 @@ async fn create_datatable_migration(
|
||||
)
|
||||
.await?;
|
||||
|
||||
windmill_common::feature_usage::log_feature_usage("datatable", "migration_created", "manual");
|
||||
|
||||
Ok(Json(DatatableMigration {
|
||||
datatable: datatable_name,
|
||||
timestamp,
|
||||
@@ -1371,6 +1401,20 @@ async fn upsert_datatable_migration(
|
||||
)
|
||||
.await?;
|
||||
|
||||
// An unchanged re-push is not counted: `wmill sync push` sends every migration
|
||||
// on every sync, so counting those would swamp the definitions people write.
|
||||
if !unchanged {
|
||||
windmill_common::feature_usage::log_feature_usage(
|
||||
"datatable",
|
||||
"migration_created",
|
||||
if existing.is_none() {
|
||||
"synced"
|
||||
} else {
|
||||
"edited"
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Ok(format!(
|
||||
"Upserted migration {} in {}",
|
||||
payload.timestamp, datatable_name
|
||||
@@ -1477,6 +1521,12 @@ async fn generate_initial_datatable_migration(
|
||||
)
|
||||
.await?;
|
||||
|
||||
windmill_common::feature_usage::log_feature_usage(
|
||||
"datatable",
|
||||
"migration_created",
|
||||
"initial_snapshot",
|
||||
);
|
||||
|
||||
Ok(Json(DatatableMigration {
|
||||
datatable: datatable_name,
|
||||
timestamp,
|
||||
|
||||
@@ -3524,6 +3524,9 @@ async fn edit_datatable_config(
|
||||
// Migrations opt-in is owned by the enable/disable endpoints, not this config
|
||||
// form: preserve each existing data table's flag, and default brand-new data
|
||||
// tables to enabled.
|
||||
// Counted here rather than after the write because this is where a rename is
|
||||
// still distinguishable from a creation; emitted once the commit lands.
|
||||
let mut created_substrates: Vec<&'static str> = Vec::new();
|
||||
for (name, dt) in new_config.settings.datatables.iter_mut() {
|
||||
let lookup = rename_src
|
||||
.get(name.as_str())
|
||||
@@ -3531,7 +3534,15 @@ async fn edit_datatable_config(
|
||||
.unwrap_or(name.as_str());
|
||||
dt.migrations_enabled = match old_datatables.get(lookup) {
|
||||
Some(old) => old.migrations_enabled,
|
||||
None => Some(true),
|
||||
None => {
|
||||
// Keyed by how the substrate is serialized into `workspace_settings`,
|
||||
// so these line up with the `datatable_configured` adoption counts.
|
||||
created_substrates.push(match dt.database.resource_type {
|
||||
DataTableCatalogResourceType::Instance => "instance",
|
||||
DataTableCatalogResourceType::Postgresql => "postgresql",
|
||||
});
|
||||
Some(true)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3589,6 +3600,10 @@ async fn edit_datatable_config(
|
||||
|
||||
tx.commit().await?;
|
||||
|
||||
for substrate in created_substrates {
|
||||
windmill_common::feature_usage::log_feature_usage("datatable", "created", substrate);
|
||||
}
|
||||
|
||||
crate::datatable_migrations::record_datatable_cascade_deployments(
|
||||
&authed,
|
||||
&db,
|
||||
|
||||
Reference in New Issue
Block a user