Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions codex-rs/analytics/src/analytics_client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use crate::facts::PluginInstallRequestSource;
use crate::facts::PluginInstallRequested;
use crate::facts::PluginInstallRequestedInput;
use crate::facts::PluginInstallRequestedPlugin;
use crate::facts::PluginInstallSource;
use crate::facts::PluginState;
use crate::facts::PluginStateChangedInput;
use crate::facts::PluginUsedInput;
Expand Down Expand Up @@ -3242,6 +3243,7 @@ fn plugin_install_failed_event_serializes_expected_shape() {
event_type: "codex_plugin_install_failed",
event_params: CodexPluginInstallFailedMetadata {
plugin: codex_plugin_metadata(sample_plugin_metadata()),
source: PluginInstallSource::Manual,
error_type: "store_io".to_string(),
},
});
Expand All @@ -3261,6 +3263,7 @@ fn plugin_install_failed_event_serializes_expected_shape() {
"mcp_server_count": 2,
"connector_ids": ["calendar", "drive"],
"product_client_id": originator().value,
"source": "manual",
"error_type": "store_io"
}
})
Expand Down Expand Up @@ -3692,6 +3695,7 @@ async fn reducer_ingests_plugin_install_failed_fact() {
AnalyticsFact::Custom(CustomAnalyticsFact::PluginInstallFailed(
PluginInstallFailedInput {
plugin: sample_plugin_metadata(),
source: PluginInstallSource::ExternalAgentMigration,
error_type: "invalid_plugin".to_string(),
},
)),
Expand All @@ -3713,6 +3717,7 @@ async fn reducer_ingests_plugin_install_failed_fact() {
"mcp_server_count": 2,
"connector_ids": ["calendar", "drive"],
"product_client_id": originator().value,
"source": "external_agent_migration",
"error_type": "invalid_plugin"
}
}])
Expand All @@ -3734,6 +3739,7 @@ async fn reducer_ingests_plugin_install_failed_fact_without_detail() {
AnalyticsFact::Custom(CustomAnalyticsFact::PluginInstallFailed(
PluginInstallFailedInput {
plugin,
source: PluginInstallSource::Manual,
error_type: "remote_catalog_unexpected_status".to_string(),
},
)),
Expand All @@ -3755,6 +3761,7 @@ async fn reducer_ingests_plugin_install_failed_fact_without_detail() {
"mcp_server_count": null,
"connector_ids": null,
"product_client_id": originator().value,
"source": "manual",
"error_type": "remote_catalog_unexpected_status"
}
}])
Expand Down
9 changes: 8 additions & 1 deletion codex-rs/analytics/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::facts::HookRunInput;
use crate::facts::PluginInstallFailedInput;
use crate::facts::PluginInstallRequested;
use crate::facts::PluginInstallRequestedInput;
use crate::facts::PluginInstallSource;
use crate::facts::PluginState;
use crate::facts::PluginStateChangedInput;
use crate::facts::SkillInvocation;
Expand Down Expand Up @@ -370,10 +371,16 @@ impl AnalyticsEventsClient {
));
}

pub fn track_plugin_install_failed(&self, plugin: PluginTelemetryMetadata, error_type: String) {
pub fn track_plugin_install_failed(
&self,
plugin: PluginTelemetryMetadata,
source: PluginInstallSource,
error_type: String,
) {
self.record_fact(AnalyticsFact::Custom(
CustomAnalyticsFact::PluginInstallFailed(PluginInstallFailedInput {
plugin,
source,
error_type,
}),
));
Expand Down
1 change: 1 addition & 0 deletions codex-rs/analytics/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ pub(crate) struct CodexPluginEventRequest {
pub(crate) struct CodexPluginInstallFailedMetadata {
#[serde(flatten)]
pub(crate) plugin: CodexPluginMetadata,
pub(crate) source: crate::facts::PluginInstallSource,
pub(crate) error_type: String,
}

Expand Down
8 changes: 8 additions & 0 deletions codex-rs/analytics/src/facts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,16 @@ pub(crate) struct PluginStateChangedInput {
pub state: PluginState,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum PluginInstallSource {
Manual,
ExternalAgentMigration,
}

pub(crate) struct PluginInstallFailedInput {
pub plugin: PluginTelemetryMetadata,
pub source: PluginInstallSource,
pub error_type: String,
}

Expand Down
1 change: 1 addition & 0 deletions codex-rs/analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub use facts::InvocationType;
pub use facts::PluginInstallRequestSource;
pub use facts::PluginInstallRequested;
pub use facts::PluginInstallRequestedPlugin;
pub use facts::PluginInstallSource;
pub use facts::SkillInvocation;
pub use facts::SubAgentThreadStartedInput;
pub use facts::ThreadInitializationMode;
Expand Down
7 changes: 6 additions & 1 deletion codex-rs/analytics/src/reducer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,17 @@ impl AnalyticsReducer {
input: PluginInstallFailedInput,
out: &mut Vec<TrackEventRequest>,
) {
let PluginInstallFailedInput { plugin, error_type } = input;
let PluginInstallFailedInput {
plugin,
source,
error_type,
} = input;
out.push(TrackEventRequest::PluginInstallFailed(
CodexPluginInstallFailedEventRequest {
event_type: "codex_plugin_install_failed",
event_params: CodexPluginInstallFailedMetadata {
plugin: codex_plugin_metadata(plugin),
source,
error_type,
},
},
Expand Down
Loading
Loading