@utdk/posthog 1.0.0-20260712.5-dev.e2949a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +172 -0
- package/docs/account_relationship_definitions.md +194 -0
- package/docs/accounts.md +380 -0
- package/docs/actions.md +274 -0
- package/docs/activity_logs.md +144 -0
- package/docs/advanced_activity_logs.md +101 -0
- package/docs/agent_platform.md +2525 -0
- package/docs/ai-observability.md +514 -0
- package/docs/alerts.md +444 -0
- package/docs/annotations.md +200 -0
- package/docs/batch_exports.md +2118 -0
- package/docs/business_knowledge.md +468 -0
- package/docs/code-invites.md +72 -0
- package/docs/cohorts.md +412 -0
- package/docs/comments.md +321 -0
- package/docs/conversations.md +695 -0
- package/docs/custom_property_definitions.md +442 -0
- package/docs/custom_property_sources.md +194 -0
- package/docs/customer_analytics.md +442 -0
- package/docs/customer_journeys.md +380 -0
- package/docs/customer_profile_configs.md +380 -0
- package/docs/dashboard_templates.md +258 -0
- package/docs/dashboards.md +1896 -0
- package/docs/data_color_themes.md +380 -0
- package/docs/data_modeling_jobs.md +264 -0
- package/docs/data_warehouse.md +928 -0
- package/docs/dataset_items.md +382 -0
- package/docs/datasets.md +382 -0
- package/docs/desktop_file_system.md +753 -0
- package/docs/desktop_file_system_shortcut.md +244 -0
- package/docs/docs.md +72 -0
- package/docs/early_access_feature.md +194 -0
- package/docs/elements.md +510 -0
- package/docs/endpoints.md +1030 -0
- package/docs/engineering_analytics.md +712 -0
- package/docs/environments.md +881 -0
- package/docs/error_tracking.md +5108 -0
- package/docs/evaluation_runs.md +78 -0
- package/docs/evaluations.md +446 -0
- package/docs/event_definitions.md +425 -0
- package/docs/event_filter.md +280 -0
- package/docs/event_schemas.md +163 -0
- package/docs/events.md +208 -0
- package/docs/experiment_holdouts.md +194 -0
- package/docs/experiment_saved_metrics.md +194 -0
- package/docs/experiments.md +1088 -0
- package/docs/exports.md +256 -0
- package/docs/external_data_schemas.md +752 -0
- package/docs/external_data_sources.md +2296 -0
- package/docs/feature_flags.md +808 -0
- package/docs/field_notes.md +206 -0
- package/docs/file_system.md +880 -0
- package/docs/file_system_shortcut.md +444 -0
- package/docs/flag_value.md +46 -0
- package/docs/groups.md +514 -0
- package/docs/groups_types.md +349 -0
- package/docs/health_issues.md +386 -0
- package/docs/heatmap_screenshots.md +72 -0
- package/docs/heatmaps.md +136 -0
- package/docs/hog_flows.md +1576 -0
- package/docs/hog_function_templates.md +101 -0
- package/docs/hog_functions.md +974 -0
- package/docs/ingestion_warnings_v2.md +40 -0
- package/docs/insight_variables.md +380 -0
- package/docs/insights.md +1722 -0
- package/docs/integrations.md +1954 -0
- package/docs/js-snippet.md +104 -0
- package/docs/live_debugger_breakpoints.md +264 -0
- package/docs/llm_analytics.md +3373 -0
- package/docs/llm_prompts.md +442 -0
- package/docs/llm_skills.md +952 -0
- package/docs/logs.md +2446 -0
- package/docs/managed_viewsets.md +140 -0
- package/docs/marketing_analytics.md +518 -0
- package/docs/max.md +772 -0
- package/docs/max_tools.md +70 -0
- package/docs/mcp_analytics.md +712 -0
- package/docs/mcp_server_installations.md +970 -0
- package/docs/mcp_servers.md +78 -0
- package/docs/mcp_tools.md +82 -0
- package/docs/messaging_templates.md +444 -0
- package/docs/metrics.md +462 -0
- package/docs/notebooks.md +838 -0
- package/docs/object_media_previews.md +228 -0
- package/docs/organizations.md +2958 -0
- package/docs/persons.md +1514 -0
- package/docs/platform_features.md +700 -0
- package/docs/plugin_configs.md +70 -0
- package/docs/product_enablement.md +39 -0
- package/docs/product_tours.md +357 -0
- package/docs/project_secret_api_keys.md +444 -0
- package/docs/property_access_controls.md +200 -0
- package/docs/property_definitions.md +244 -0
- package/docs/query.md +560 -0
- package/docs/quota_limits.md +40 -0
- package/docs/reminders.md +194 -0
- package/docs/replay.md +1020 -0
- package/docs/reverse_proxy.md +200 -0
- package/docs/sandbox-custom-images.md +209 -0
- package/docs/sandbox-environments.md +168 -0
- package/docs/saved.md +392 -0
- package/docs/saved_query_column_annotations.md +224 -0
- package/docs/scheduled_changes.md +200 -0
- package/docs/schema_property_groups.md +194 -0
- package/docs/sdk_health.md +40 -0
- package/docs/session_group_summaries.md +200 -0
- package/docs/session_recordings.md +260 -0
- package/docs/session_summaries.md +200 -0
- package/docs/sessions.md +132 -0
- package/docs/signals.md +1428 -0
- package/docs/single_session_summaries.md +72 -0
- package/docs/streamlit_apps.md +456 -0
- package/docs/subscriptions.md +634 -0
- package/docs/surveys.md +731 -0
- package/docs/taggers.md +446 -0
- package/docs/task-automations.md +200 -0
- package/docs/task-runs.md +654 -0
- package/docs/task_channels.md +136 -0
- package/docs/task_mentions.md +40 -0
- package/docs/tasks.md +776 -0
- package/docs/tracing.md +1186 -0
- package/docs/uploaded_media.md +44 -0
- package/docs/user_home_settings.md +72 -0
- package/docs/user_interview_topics.md +1288 -0
- package/docs/user_interviews.md +444 -0
- package/docs/users.md +1267 -0
- package/docs/vision.md +2022 -0
- package/docs/visual_review.md +816 -0
- package/docs/warehouse_column_annotations.md +224 -0
- package/docs/warehouse_column_statistics.md +80 -0
- package/docs/warehouse_dag.md +40 -0
- package/docs/warehouse_model_paths.md +70 -0
- package/docs/warehouse_saved_queries.md +1056 -0
- package/docs/warehouse_saved_query_folders.md +318 -0
- package/docs/warehouse_tables.md +584 -0
- package/docs/warehouse_view_link.md +456 -0
- package/docs/warehouse_view_links.md +456 -0
- package/docs/web_analytics.md +136 -0
- package/docs/web_analytics_achievements.md +200 -0
- package/docs/web_experiments.md +194 -0
- package/docs/web_vitals.md +74 -0
- package/docs/wizard.md +170 -0
- package/index.ts +22 -0
- package/metadata.ts +41419 -0
- package/openapi.json +297382 -0
- package/overlay.yaml +23 -0
- package/package.json +34 -0
- package/provenance.json +24 -0
- package/research.json +80 -0
- package/types/index.ts +17547 -0
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
# Engineering Analytics
|
|
2
|
+
|
|
3
|
+
## Operations
|
|
4
|
+
|
|
5
|
+
### `posthog.engineeringAnalyticsAuthorWorkflowCosts`
|
|
6
|
+
|
|
7
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/author_workflow_costs/`
|
|
8
|
+
- **What it does**: One author's estimated CI cost split by workflow over a window (date_from default -30d), highest spend first. Runs are attributed to the author through their pull requests (attribution is by PR number). Returns an empty list when the job-level source isn't synced.
|
|
9
|
+
- **OpenAPI operationId**: `engineering_analytics_author_workflow_costs`
|
|
10
|
+
- **Path params**: None
|
|
11
|
+
- **Query params**: `author`, `date_from`, `date_to`, `source_id`
|
|
12
|
+
- **Response codes**: `200`, `400`
|
|
13
|
+
- **Transport options**: None
|
|
14
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
15
|
+
|
|
16
|
+
**Inputs**
|
|
17
|
+
|
|
18
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
19
|
+
- Client transport options: None
|
|
20
|
+
|
|
21
|
+
**Outputs**
|
|
22
|
+
|
|
23
|
+
- Client return type: `({ workflow_name: string; billable_minutes: number; estimated_cost_usd: number | null; costed_jobs: number; unsettled_jobs: number; excluded_jobs: number })[]`
|
|
24
|
+
- OpenAPI response codes: `200`, `400`
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import posthog from "@utdk/posthog";
|
|
28
|
+
|
|
29
|
+
type EngineeringAnalyticsAuthorWorkflowCostsInput = Parameters<typeof posthog.engineeringAnalyticsAuthorWorkflowCosts> extends [infer T, ...unknown[]] ? T : undefined;
|
|
30
|
+
type EngineeringAnalyticsAuthorWorkflowCostsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsAuthorWorkflowCosts>>;
|
|
31
|
+
|
|
32
|
+
const result: EngineeringAnalyticsAuthorWorkflowCostsOutput = await posthog.engineeringAnalyticsAuthorWorkflowCosts();
|
|
33
|
+
|
|
34
|
+
// Result shape (from schema): ({ workflow_name: string; billable_minutes: number; estimated_cost_usd: number | null; costed_jobs: number; unsettled_jobs: number; excluded_jobs: number })[]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `posthog.engineeringAnalyticsCiCards`
|
|
38
|
+
|
|
39
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/ci_cards/`
|
|
40
|
+
- **What it does**: Headline counts for the open-PR backlog: open PRs, distinct repos, stuck PRs (open, non-draft, non-bot, older than 7 days), and PRs with failing CI. The failing-CI count rests on the head-SHA join and can lag until late CI completions settle.
|
|
41
|
+
- **OpenAPI operationId**: `engineering_analytics_ci_cards`
|
|
42
|
+
- **Path params**: None
|
|
43
|
+
- **Query params**: `source_id`
|
|
44
|
+
- **Response codes**: `200`, `400`
|
|
45
|
+
- **Transport options**: None
|
|
46
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
47
|
+
|
|
48
|
+
**Inputs**
|
|
49
|
+
|
|
50
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
51
|
+
- Client transport options: None
|
|
52
|
+
|
|
53
|
+
**Outputs**
|
|
54
|
+
|
|
55
|
+
- Client return type: `{ open_prs: number; repos: number; stuck: number; failing_ci: number }`
|
|
56
|
+
- OpenAPI response codes: `200`, `400`
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import posthog from "@utdk/posthog";
|
|
60
|
+
|
|
61
|
+
type EngineeringAnalyticsCiCardsInput = Parameters<typeof posthog.engineeringAnalyticsCiCards> extends [infer T, ...unknown[]] ? T : undefined;
|
|
62
|
+
type EngineeringAnalyticsCiCardsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsCiCards>>;
|
|
63
|
+
|
|
64
|
+
const result: EngineeringAnalyticsCiCardsOutput = await posthog.engineeringAnalyticsCiCards();
|
|
65
|
+
|
|
66
|
+
// Result shape (from schema): { open_prs: number; repos: number; stuck: number; failing_ci: number }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `posthog.engineeringAnalyticsCiFailureLogs`
|
|
70
|
+
|
|
71
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/ci_failure_logs/`
|
|
72
|
+
- **What it does**: The thinned CI failure logs for a pull request, grouped by failed job. Resolves the PR to its workflow runs via the pull_requests association (all of the PR's pushes, not just the latest commit), then reads the Logs product joined on run_id. Returns failed jobs only (the worker fetches logs for failures); logs_available is false when CI hasn't failed, the logs aged out of the short Logs retention, or a fork PR has no run association. Each line carries its original 1-based line number in the full pre-thinning log; lines are the failure region (errors plus surrounding context, with omission markers), capped per job and overall.
|
|
73
|
+
- **OpenAPI operationId**: `engineering_analytics_ci_failure_logs`
|
|
74
|
+
- **Path params**: None
|
|
75
|
+
- **Query params**: `pr_number`, `repo`, `source_id`
|
|
76
|
+
- **Response codes**: `200`, `400`
|
|
77
|
+
- **Transport options**: None
|
|
78
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
79
|
+
|
|
80
|
+
**Inputs**
|
|
81
|
+
|
|
82
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
83
|
+
- Client transport options: None
|
|
84
|
+
|
|
85
|
+
**Outputs**
|
|
86
|
+
|
|
87
|
+
- Client return type: `{ repo: { provider: string; owner: string; name: string }; jobs: ({ lines: ({ original_line: number | null; text: string })[]; job_id: number; run_id: number; conclusion: string; branch: string; original_total_lines: nu...`
|
|
88
|
+
- OpenAPI response codes: `200`, `400`
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import posthog from "@utdk/posthog";
|
|
92
|
+
|
|
93
|
+
type EngineeringAnalyticsCiFailureLogsInput = Parameters<typeof posthog.engineeringAnalyticsCiFailureLogs> extends [infer T, ...unknown[]] ? T : undefined;
|
|
94
|
+
type EngineeringAnalyticsCiFailureLogsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsCiFailureLogs>>;
|
|
95
|
+
|
|
96
|
+
const result: EngineeringAnalyticsCiFailureLogsOutput = await posthog.engineeringAnalyticsCiFailureLogs();
|
|
97
|
+
|
|
98
|
+
// Result shape (from schema): { repo: { provider: string; owner: string; name: string }; jobs: ({ lines: ({ original_line: number | null; text: string })[]; job_id: number; run_id: number; conclusion: string; branch: string; original_total_lines: nu...
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### `posthog.engineeringAnalyticsFlakyTests`
|
|
102
|
+
|
|
103
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/flaky_tests/`
|
|
104
|
+
- **What it does**: The flaky-test leaderboard: backend tests ranked by flakiness signal from the per-test CI spans, over a window (default -7d, maximum 30 days). A test qualifies by passing on retry at least min_rerun_passes times OR failing on at least min_failed_prs distinct PRs. All figures are absolute counts, never rates: fast passing runs are not emitted, so denominators are biased. Pass-on-retry counts only flow from CI lanes running with reruns enabled; in other lanes a flake surfaces as a plain failure, which the distinct-PR count catches.
|
|
105
|
+
- **OpenAPI operationId**: `engineering_analytics_flaky_tests`
|
|
106
|
+
- **Path params**: None
|
|
107
|
+
- **Query params**: `date_from`, `date_to`, `limit`, `min_failed_prs`, `min_rerun_passes`, `source_id`
|
|
108
|
+
- **Response codes**: `200`, `400`
|
|
109
|
+
- **Transport options**: None
|
|
110
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
111
|
+
|
|
112
|
+
**Inputs**
|
|
113
|
+
|
|
114
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
115
|
+
- Client transport options: None
|
|
116
|
+
|
|
117
|
+
**Outputs**
|
|
118
|
+
|
|
119
|
+
- Client return type: `{ items: ({ nodeid: string; selector: string; rerun_passed_count: number; failed_count: number; failed_pr_count: number; branch_count: number; xfailed_count: number; last_seen_at: string })[]; truncated: boolean; limit:...`
|
|
120
|
+
- OpenAPI response codes: `200`, `400`
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import posthog from "@utdk/posthog";
|
|
124
|
+
|
|
125
|
+
type EngineeringAnalyticsFlakyTestsInput = Parameters<typeof posthog.engineeringAnalyticsFlakyTests> extends [infer T, ...unknown[]] ? T : undefined;
|
|
126
|
+
type EngineeringAnalyticsFlakyTestsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsFlakyTests>>;
|
|
127
|
+
|
|
128
|
+
const result: EngineeringAnalyticsFlakyTestsOutput = await posthog.engineeringAnalyticsFlakyTests();
|
|
129
|
+
|
|
130
|
+
// Result shape (from schema): { items: ({ nodeid: string; selector: string; rerun_passed_count: number; failed_count: number; failed_pr_count: number; branch_count: number; xfailed_count: number; last_seen_at: string })[]; truncated: boolean; limit:...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `posthog.engineeringAnalyticsJobAggregates`
|
|
134
|
+
|
|
135
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/job_aggregates/`
|
|
136
|
+
- **What it does**: Per-job aggregates for one workflow over a window (default -30d), one row per de-sharded job name (matrix shards aggregate together), busiest first: queue p50, duration p50/p95, failure rate, retry pressure, run share (below 1.0 = conditional job), and billable cost. Jobs always need their run as context — this is the aggregate view; use workflow_jobs for one run's jobs. Empty when the job-level source isn't synced.
|
|
137
|
+
- **OpenAPI operationId**: `engineering_analytics_job_aggregates`
|
|
138
|
+
- **Path params**: None
|
|
139
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `source_id`, `workflow_name`
|
|
140
|
+
- **Response codes**: `200`, `400`
|
|
141
|
+
- **Transport options**: None
|
|
142
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
143
|
+
|
|
144
|
+
**Inputs**
|
|
145
|
+
|
|
146
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
147
|
+
- Client transport options: None
|
|
148
|
+
|
|
149
|
+
**Outputs**
|
|
150
|
+
|
|
151
|
+
- Client return type: `({ job_name: string; job_count: number; shard_count: number; runs_in: number; run_share: number | null; queue_p50_seconds: number | null; p50_seconds: number | null; p95_seconds: number | null; failure_rate: number | nu...`
|
|
152
|
+
- OpenAPI response codes: `200`, `400`
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import posthog from "@utdk/posthog";
|
|
156
|
+
|
|
157
|
+
type EngineeringAnalyticsJobAggregatesInput = Parameters<typeof posthog.engineeringAnalyticsJobAggregates> extends [infer T, ...unknown[]] ? T : undefined;
|
|
158
|
+
type EngineeringAnalyticsJobAggregatesOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsJobAggregates>>;
|
|
159
|
+
|
|
160
|
+
const result: EngineeringAnalyticsJobAggregatesOutput = await posthog.engineeringAnalyticsJobAggregates();
|
|
161
|
+
|
|
162
|
+
// Result shape (from schema): ({ job_name: string; job_count: number; shard_count: number; runs_in: number; run_share: number | null; queue_p50_seconds: number | null; p50_seconds: number | null; p95_seconds: number | null; failure_rate: number | nu...
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `posthog.engineeringAnalyticsMasterFailures`
|
|
166
|
+
|
|
167
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/master_failures/`
|
|
168
|
+
- **What it does**: Default-branch failures over a window (default -24h), grouped error-tracking style by (workflow, de-sharded failing job) with a run count and first/last seen, newest group first. `branch` overrides the detected default branch. PR-branch failures are deliberately excluded — at monorepo volume a flat feed is a firehose; those surface per PR. Groups degrade to workflow level (failed_job '') when the job-level source isn't synced.
|
|
169
|
+
- **OpenAPI operationId**: `engineering_analytics_master_failures`
|
|
170
|
+
- **Path params**: None
|
|
171
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `source_id`
|
|
172
|
+
- **Response codes**: `200`, `400`
|
|
173
|
+
- **Transport options**: None
|
|
174
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
175
|
+
|
|
176
|
+
**Inputs**
|
|
177
|
+
|
|
178
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
179
|
+
- Client transport options: None
|
|
180
|
+
|
|
181
|
+
**Outputs**
|
|
182
|
+
|
|
183
|
+
- Client return type: `({ repo: { provider: string; owner: string; name: string }; workflow_name: string; failed_job: string; run_count: number; first_seen: string; last_seen: string; latest_run_id: number })[]`
|
|
184
|
+
- OpenAPI response codes: `200`, `400`
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import posthog from "@utdk/posthog";
|
|
188
|
+
|
|
189
|
+
type EngineeringAnalyticsMasterFailuresInput = Parameters<typeof posthog.engineeringAnalyticsMasterFailures> extends [infer T, ...unknown[]] ? T : undefined;
|
|
190
|
+
type EngineeringAnalyticsMasterFailuresOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsMasterFailures>>;
|
|
191
|
+
|
|
192
|
+
const result: EngineeringAnalyticsMasterFailuresOutput = await posthog.engineeringAnalyticsMasterFailures();
|
|
193
|
+
|
|
194
|
+
// Result shape (from schema): ({ repo: { provider: string; owner: string; name: string }; workflow_name: string; failed_job: string; run_count: number; first_seen: string; last_seen: string; latest_run_id: number })[]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### `posthog.engineeringAnalyticsPrCost`
|
|
198
|
+
|
|
199
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/pr_cost/`
|
|
200
|
+
- **What it does**: Estimated CI cost for a pull request, summed over the jobs of all its workflow runs. Billable self-hosted Linux runners only — provider-hosted (free GitHub-hosted) and non-Linux jobs are excluded. Every figure is zero/null with `jobs_available` false when the job-level source isn't synced yet.
|
|
201
|
+
- **OpenAPI operationId**: `engineering_analytics_pr_cost`
|
|
202
|
+
- **Path params**: None
|
|
203
|
+
- **Query params**: `pr_number`, `repo`, `source_id`
|
|
204
|
+
- **Response codes**: `200`, `400`
|
|
205
|
+
- **Transport options**: None
|
|
206
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
207
|
+
|
|
208
|
+
**Inputs**
|
|
209
|
+
|
|
210
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
211
|
+
- Client transport options: None
|
|
212
|
+
|
|
213
|
+
**Outputs**
|
|
214
|
+
|
|
215
|
+
- Client return type: `{ by_workflow: ({ workflow_name: string; billable_minutes: number; estimated_cost_usd: number | null; costed_jobs: number; unsettled_jobs: number; excluded_jobs: number })[]; by_run: ({ run_id: number; run_attempt: numb...`
|
|
216
|
+
- OpenAPI response codes: `200`, `400`
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
import posthog from "@utdk/posthog";
|
|
220
|
+
|
|
221
|
+
type EngineeringAnalyticsPrCostInput = Parameters<typeof posthog.engineeringAnalyticsPrCost> extends [infer T, ...unknown[]] ? T : undefined;
|
|
222
|
+
type EngineeringAnalyticsPrCostOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsPrCost>>;
|
|
223
|
+
|
|
224
|
+
const result: EngineeringAnalyticsPrCostOutput = await posthog.engineeringAnalyticsPrCost();
|
|
225
|
+
|
|
226
|
+
// Result shape (from schema): { by_workflow: ({ workflow_name: string; billable_minutes: number; estimated_cost_usd: number | null; costed_jobs: number; unsettled_jobs: number; excluded_jobs: number })[]; by_run: ({ run_id: number; run_attempt: numb...
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### `posthog.engineeringAnalyticsPrLifecycle`
|
|
230
|
+
|
|
231
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/pr_lifecycle/`
|
|
232
|
+
- **What it does**: The timeline of a single pull request: header plus ordered events (opened, CI started/finished, merged or closed). Use this to answer 'where is this PR stuck and what happened to it'. This is a partial view: review and comment events are not yet available.
|
|
233
|
+
- **OpenAPI operationId**: `engineering_analytics_pr_lifecycle`
|
|
234
|
+
- **Path params**: None
|
|
235
|
+
- **Query params**: `pr_number`, `repo`, `source_id`
|
|
236
|
+
- **Response codes**: `200`, `400`, `404`
|
|
237
|
+
- **Transport options**: None
|
|
238
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
239
|
+
|
|
240
|
+
**Inputs**
|
|
241
|
+
|
|
242
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
243
|
+
- Client transport options: None
|
|
244
|
+
|
|
245
|
+
**Outputs**
|
|
246
|
+
|
|
247
|
+
- Client return type: `{ pull_request: { author: { handle: string; display_name: string; avatar_url: string; is_bot: boolean }; repo: { provider: string; owner: string; name: string }; id: number; number: number; title: string; state: "open" ...`
|
|
248
|
+
- OpenAPI response codes: `200`, `400`, `404`
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
import posthog from "@utdk/posthog";
|
|
252
|
+
|
|
253
|
+
type EngineeringAnalyticsPrLifecycleInput = Parameters<typeof posthog.engineeringAnalyticsPrLifecycle> extends [infer T, ...unknown[]] ? T : undefined;
|
|
254
|
+
type EngineeringAnalyticsPrLifecycleOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsPrLifecycle>>;
|
|
255
|
+
|
|
256
|
+
const result: EngineeringAnalyticsPrLifecycleOutput = await posthog.engineeringAnalyticsPrLifecycle();
|
|
257
|
+
|
|
258
|
+
// Result shape (from schema): { pull_request: { author: { handle: string; display_name: string; avatar_url: string; is_bot: boolean }; repo: { provider: string; owner: string; name: string }; id: number; number: number; title: string; state: "open" ...
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `posthog.engineeringAnalyticsPrRuns`
|
|
262
|
+
|
|
263
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/pr_runs/`
|
|
264
|
+
- **What it does**: Every workflow run attributed to a pull request, across all its commits (grouped by head SHA client-side), newest first. Run-level only.
|
|
265
|
+
- **OpenAPI operationId**: `engineering_analytics_pr_runs`
|
|
266
|
+
- **Path params**: None
|
|
267
|
+
- **Query params**: `pr_number`, `repo`, `source_id`
|
|
268
|
+
- **Response codes**: `200`, `400`
|
|
269
|
+
- **Transport options**: None
|
|
270
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
271
|
+
|
|
272
|
+
**Inputs**
|
|
273
|
+
|
|
274
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
275
|
+
- Client transport options: None
|
|
276
|
+
|
|
277
|
+
**Outputs**
|
|
278
|
+
|
|
279
|
+
- Client return type: `({ repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at:...`
|
|
280
|
+
- OpenAPI response codes: `200`, `400`
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
import posthog from "@utdk/posthog";
|
|
284
|
+
|
|
285
|
+
type EngineeringAnalyticsPrRunsInput = Parameters<typeof posthog.engineeringAnalyticsPrRuns> extends [infer T, ...unknown[]] ? T : undefined;
|
|
286
|
+
type EngineeringAnalyticsPrRunsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsPrRuns>>;
|
|
287
|
+
|
|
288
|
+
const result: EngineeringAnalyticsPrRunsOutput = await posthog.engineeringAnalyticsPrRuns();
|
|
289
|
+
|
|
290
|
+
// Result shape (from schema): ({ repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at:...
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### `posthog.engineeringAnalyticsPullRequests`
|
|
294
|
+
|
|
295
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/pull_requests/`
|
|
296
|
+
- **What it does**: Open pull requests plus any merged or closed since date_from (default -30d), newest first, each with its head-SHA CI rollup. The list is capped; when more match, `truncated` is true and the ci_cards counts can exceed it. open_to_merge_seconds is coarse — it fuses draft and ready-for-review time; CI counts can lag until late completions settle.
|
|
297
|
+
- **OpenAPI operationId**: `engineering_analytics_pull_requests`
|
|
298
|
+
- **Path params**: None
|
|
299
|
+
- **Query params**: `author`, `date_from`, `source_id`
|
|
300
|
+
- **Response codes**: `200`, `400`
|
|
301
|
+
- **Transport options**: None
|
|
302
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
303
|
+
|
|
304
|
+
**Inputs**
|
|
305
|
+
|
|
306
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
307
|
+
- Client transport options: None
|
|
308
|
+
|
|
309
|
+
**Outputs**
|
|
310
|
+
|
|
311
|
+
- Client return type: `{ items: ({ author: { handle: string; display_name: string; avatar_url: string; is_bot: boolean }; repo: { provider: string; owner: string; name: string }; ci: { runs: number; passing: number; failing: number; pending: ...`
|
|
312
|
+
- OpenAPI response codes: `200`, `400`
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
import posthog from "@utdk/posthog";
|
|
316
|
+
|
|
317
|
+
type EngineeringAnalyticsPullRequestsInput = Parameters<typeof posthog.engineeringAnalyticsPullRequests> extends [infer T, ...unknown[]] ? T : undefined;
|
|
318
|
+
type EngineeringAnalyticsPullRequestsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsPullRequests>>;
|
|
319
|
+
|
|
320
|
+
const result: EngineeringAnalyticsPullRequestsOutput = await posthog.engineeringAnalyticsPullRequests();
|
|
321
|
+
|
|
322
|
+
// Result shape (from schema): { items: ({ author: { handle: string; display_name: string; avatar_url: string; is_bot: boolean }; repo: { provider: string; owner: string; name: string }; ci: { runs: number; passing: number; failing: number; pending: ...
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### `posthog.engineeringAnalyticsQuarantine`
|
|
326
|
+
|
|
327
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/quarantine/`
|
|
328
|
+
- **What it does**: Flaky-test quarantine file
|
|
329
|
+
- **OpenAPI operationId**: `engineering_analytics_quarantine`
|
|
330
|
+
- **Path params**: None
|
|
331
|
+
- **Query params**: `repo`, `source_id`
|
|
332
|
+
- **Response codes**: `200`, `400`
|
|
333
|
+
- **Transport options**: None
|
|
334
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
335
|
+
|
|
336
|
+
**Inputs**
|
|
337
|
+
|
|
338
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
339
|
+
- Client transport options: None
|
|
340
|
+
|
|
341
|
+
**Outputs**
|
|
342
|
+
|
|
343
|
+
- Client return type: `{ entries: ({ id: string; runner: string; reason: string; owner: string; issue: string; added: string; expires: string; mode: "run" | "skip"; lifecycle: "active" | "expiring_soon" | "in_grace" | "overdue"; days_until_ex...`
|
|
344
|
+
- OpenAPI response codes: `200`, `400`
|
|
345
|
+
|
|
346
|
+
```ts
|
|
347
|
+
import posthog from "@utdk/posthog";
|
|
348
|
+
|
|
349
|
+
type EngineeringAnalyticsQuarantineInput = Parameters<typeof posthog.engineeringAnalyticsQuarantine> extends [infer T, ...unknown[]] ? T : undefined;
|
|
350
|
+
type EngineeringAnalyticsQuarantineOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsQuarantine>>;
|
|
351
|
+
|
|
352
|
+
const result: EngineeringAnalyticsQuarantineOutput = await posthog.engineeringAnalyticsQuarantine();
|
|
353
|
+
|
|
354
|
+
// Result shape (from schema): { entries: ({ id: string; runner: string; reason: string; owner: string; issue: string; added: string; expires: string; mode: "run" | "skip"; lifecycle: "active" | "expiring_soon" | "in_grace" | "overdue"; days_until_ex...
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### `posthog.engineeringAnalyticsQuarantineRequest`
|
|
358
|
+
|
|
359
|
+
- **HTTP**: `POST /api/projects/{project_id}/engineering_analytics/quarantine/request/`
|
|
360
|
+
- **What it does**: Quarantine, extend, or unquarantine a flaky test
|
|
361
|
+
- **OpenAPI operationId**: `engineering_analytics_quarantine_request`
|
|
362
|
+
- **Path params**: None
|
|
363
|
+
- **Query params**: None
|
|
364
|
+
- **Response codes**: `201`, `400`
|
|
365
|
+
- **Transport options**: None
|
|
366
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
367
|
+
|
|
368
|
+
**Inputs**
|
|
369
|
+
|
|
370
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
371
|
+
- Client transport options: None
|
|
372
|
+
|
|
373
|
+
**Outputs**
|
|
374
|
+
|
|
375
|
+
- Client return type: `{ pr_url: string; issue_url: string; branch: string }`
|
|
376
|
+
- OpenAPI response codes: `201`, `400`
|
|
377
|
+
|
|
378
|
+
```ts
|
|
379
|
+
import posthog from "@utdk/posthog";
|
|
380
|
+
|
|
381
|
+
type EngineeringAnalyticsQuarantineRequestInput = Parameters<typeof posthog.engineeringAnalyticsQuarantineRequest> extends [infer T, ...unknown[]] ? T : undefined;
|
|
382
|
+
type EngineeringAnalyticsQuarantineRequestOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsQuarantineRequest>>;
|
|
383
|
+
|
|
384
|
+
const result: EngineeringAnalyticsQuarantineRequestOutput = await posthog.engineeringAnalyticsQuarantineRequest();
|
|
385
|
+
|
|
386
|
+
// Result shape (from schema): { pr_url: string; issue_url: string; branch: string }
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### `posthog.engineeringAnalyticsRepoOverview`
|
|
390
|
+
|
|
391
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/repo_overview/`
|
|
392
|
+
- **What it does**: Repo-level headline aggregates over a window (default -30d): run count, success rate, re-run cycles, median PR open-to-merge (bots and drafts excluded; coarse — draft and ready time fused), and billable minutes + estimated cost — each with its equal-length previous-window twin so a caller can render honest deltas. Also carries the detected default branch and its completed-run history series. Cost figures are null until the job-level source is synced.
|
|
393
|
+
- **OpenAPI operationId**: `engineering_analytics_repo_overview`
|
|
394
|
+
- **Path params**: None
|
|
395
|
+
- **Query params**: `date_from`, `date_to`, `source_id`
|
|
396
|
+
- **Response codes**: `200`, `400`
|
|
397
|
+
- **Transport options**: None
|
|
398
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
399
|
+
|
|
400
|
+
**Inputs**
|
|
401
|
+
|
|
402
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
403
|
+
- Client transport options: None
|
|
404
|
+
|
|
405
|
+
**Outputs**
|
|
406
|
+
|
|
407
|
+
- Client return type: `{ cost_series: ({ bucket_start: string; estimated_cost_usd: number | null; merges: number; cost_per_merge_usd: number | null })[]; time_to_green_series: ({ bucket_start: string; p50_seconds: number | null })[]; success_...`
|
|
408
|
+
- OpenAPI response codes: `200`, `400`
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
import posthog from "@utdk/posthog";
|
|
412
|
+
|
|
413
|
+
type EngineeringAnalyticsRepoOverviewInput = Parameters<typeof posthog.engineeringAnalyticsRepoOverview> extends [infer T, ...unknown[]] ? T : undefined;
|
|
414
|
+
type EngineeringAnalyticsRepoOverviewOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsRepoOverview>>;
|
|
415
|
+
|
|
416
|
+
const result: EngineeringAnalyticsRepoOverviewOutput = await posthog.engineeringAnalyticsRepoOverview();
|
|
417
|
+
|
|
418
|
+
// Result shape (from schema): { cost_series: ({ bucket_start: string; estimated_cost_usd: number | null; merges: number; cost_per_merge_usd: number | null })[]; time_to_green_series: ({ bucket_start: string; p50_seconds: number | null })[]; success_...
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### `posthog.engineeringAnalyticsRepoRunActivity`
|
|
422
|
+
|
|
423
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/repo_run_activity/`
|
|
424
|
+
- **What it does**: Default-branch health as compact chart points over a window (default -30d), newest first, for the repo-hub run-activity chart. All of a commit's workflow runs are collapsed into ONE point per commit (head SHA): its earliest workflow start, wall-clock duration until the last workflow settled (null while any is still running), and an overall conclusion that is 'failure' if any workflow decisively failed, else 'success' when at least one passed, else 'neutral'. `branch` overrides the detected default branch. `truncated` is true when more commits matched than the cap, so the chart covers only the most recent commits.
|
|
425
|
+
- **OpenAPI operationId**: `engineering_analytics_repo_run_activity`
|
|
426
|
+
- **Path params**: None
|
|
427
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `source_id`
|
|
428
|
+
- **Response codes**: `200`, `400`
|
|
429
|
+
- **Transport options**: None
|
|
430
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
431
|
+
|
|
432
|
+
**Inputs**
|
|
433
|
+
|
|
434
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
435
|
+
- Client transport options: None
|
|
436
|
+
|
|
437
|
+
**Outputs**
|
|
438
|
+
|
|
439
|
+
- Client return type: `{ points: ({ run_id: number; conclusion: string | null; run_started_at: string; duration_seconds: number | null; head_branch: string; pr_number: number; head_sha: string })[]; truncated: boolean; limit: number }`
|
|
440
|
+
- OpenAPI response codes: `200`, `400`
|
|
441
|
+
|
|
442
|
+
```ts
|
|
443
|
+
import posthog from "@utdk/posthog";
|
|
444
|
+
|
|
445
|
+
type EngineeringAnalyticsRepoRunActivityInput = Parameters<typeof posthog.engineeringAnalyticsRepoRunActivity> extends [infer T, ...unknown[]] ? T : undefined;
|
|
446
|
+
type EngineeringAnalyticsRepoRunActivityOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsRepoRunActivity>>;
|
|
447
|
+
|
|
448
|
+
const result: EngineeringAnalyticsRepoRunActivityOutput = await posthog.engineeringAnalyticsRepoRunActivity();
|
|
449
|
+
|
|
450
|
+
// Result shape (from schema): { points: ({ run_id: number; conclusion: string | null; run_started_at: string; duration_seconds: number | null; head_branch: string; pr_number: number; head_sha: string })[]; truncated: boolean; limit: number }
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### `posthog.engineeringAnalyticsRunFailureLogs`
|
|
454
|
+
|
|
455
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/run_failure_logs/`
|
|
456
|
+
- **What it does**: The thinned CI failure logs of one workflow run, grouped by failed job — the run-scoped twin of ci_failure_logs for surfaces that aren't PR-scoped (default-branch failures, the run page). logs_available is false when the run didn't fail or its logs aged out of the short Logs retention.
|
|
457
|
+
- **OpenAPI operationId**: `engineering_analytics_run_failure_logs`
|
|
458
|
+
- **Path params**: None
|
|
459
|
+
- **Query params**: `run_id`, `source_id`
|
|
460
|
+
- **Response codes**: `200`, `400`
|
|
461
|
+
- **Transport options**: None
|
|
462
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
463
|
+
|
|
464
|
+
**Inputs**
|
|
465
|
+
|
|
466
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
467
|
+
- Client transport options: None
|
|
468
|
+
|
|
469
|
+
**Outputs**
|
|
470
|
+
|
|
471
|
+
- Client return type: `{ jobs: ({ lines: ({ original_line: number | null; text: string })[]; job_id: number; run_id: number; conclusion: string; branch: string; original_total_lines: number; line_count: number; truncated: boolean })[]; run_id...`
|
|
472
|
+
- OpenAPI response codes: `200`, `400`
|
|
473
|
+
|
|
474
|
+
```ts
|
|
475
|
+
import posthog from "@utdk/posthog";
|
|
476
|
+
|
|
477
|
+
type EngineeringAnalyticsRunFailureLogsInput = Parameters<typeof posthog.engineeringAnalyticsRunFailureLogs> extends [infer T, ...unknown[]] ? T : undefined;
|
|
478
|
+
type EngineeringAnalyticsRunFailureLogsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsRunFailureLogs>>;
|
|
479
|
+
|
|
480
|
+
const result: EngineeringAnalyticsRunFailureLogsOutput = await posthog.engineeringAnalyticsRunFailureLogs();
|
|
481
|
+
|
|
482
|
+
// Result shape (from schema): { jobs: ({ lines: ({ original_line: number | null; text: string })[]; job_id: number; run_id: number; conclusion: string; branch: string; original_total_lines: number; line_count: number; truncated: boolean })[]; run_id...
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### `posthog.engineeringAnalyticsSources`
|
|
486
|
+
|
|
487
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/sources/`
|
|
488
|
+
- **What it does**: The team's connected GitHub data warehouse sources, oldest first. Populate a source picker from this and pass a chosen `id` back as `source_id` to the other endpoints. A team can connect GitHub more than once (e.g. one source per repository); this lists them all, including any whose tables aren't fully synced yet.
|
|
489
|
+
- **OpenAPI operationId**: `engineering_analytics_sources`
|
|
490
|
+
- **Path params**: None
|
|
491
|
+
- **Query params**: None
|
|
492
|
+
- **Response codes**: `200`
|
|
493
|
+
- **Transport options**: None
|
|
494
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
495
|
+
|
|
496
|
+
**Inputs**
|
|
497
|
+
|
|
498
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
499
|
+
- Client transport options: None
|
|
500
|
+
|
|
501
|
+
**Outputs**
|
|
502
|
+
|
|
503
|
+
- Client return type: `({ id: string; repo: string; prefix: string })[]`
|
|
504
|
+
- OpenAPI response codes: `200`
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
import posthog from "@utdk/posthog";
|
|
508
|
+
|
|
509
|
+
type EngineeringAnalyticsSourcesInput = Parameters<typeof posthog.engineeringAnalyticsSources> extends [infer T, ...unknown[]] ? T : undefined;
|
|
510
|
+
type EngineeringAnalyticsSourcesOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsSources>>;
|
|
511
|
+
|
|
512
|
+
const result: EngineeringAnalyticsSourcesOutput = await posthog.engineeringAnalyticsSources();
|
|
513
|
+
|
|
514
|
+
// Result shape (from schema): ({ id: string; repo: string; prefix: string })[]
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### `posthog.engineeringAnalyticsWorkflowHealth`
|
|
518
|
+
|
|
519
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_health/`
|
|
520
|
+
- **What it does**: Per-workflow CI health over a window (default last 24 hours, maximum 366 days): run count, success rate, p50/p95 duration, last failure time, latest-run status, and a zero-filled run history bucketed by hour/day/week to fit the window. p50/p95 are over successful runs only, so cancelled (superseded) and failed runs never bias the duration trend. Optionally scope to a single git branch via `branch`, or to attributed pull-request runs via `run_scope=pull_request`. Use this for 'is CI getting slower' and 'which workflow is the long pole'; compare two windows to get a trend.
|
|
521
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_health`
|
|
522
|
+
- **Path params**: None
|
|
523
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `run_scope`, `source_id`
|
|
524
|
+
- **Response codes**: `200`, `400`
|
|
525
|
+
- **Transport options**: None
|
|
526
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
527
|
+
|
|
528
|
+
**Inputs**
|
|
529
|
+
|
|
530
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
531
|
+
- Client transport options: None
|
|
532
|
+
|
|
533
|
+
**Outputs**
|
|
534
|
+
|
|
535
|
+
- Client return type: `({ repo: { provider: string; owner: string; name: string }; buckets: ({ bucket_start: string; run_count: number; completed: number; successes: number; failures: number })[]; workflow_name: string; run_count: number; suc...`
|
|
536
|
+
- OpenAPI response codes: `200`, `400`
|
|
537
|
+
|
|
538
|
+
```ts
|
|
539
|
+
import posthog from "@utdk/posthog";
|
|
540
|
+
|
|
541
|
+
type EngineeringAnalyticsWorkflowHealthInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowHealth> extends [infer T, ...unknown[]] ? T : undefined;
|
|
542
|
+
type EngineeringAnalyticsWorkflowHealthOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowHealth>>;
|
|
543
|
+
|
|
544
|
+
const result: EngineeringAnalyticsWorkflowHealthOutput = await posthog.engineeringAnalyticsWorkflowHealth();
|
|
545
|
+
|
|
546
|
+
// Result shape (from schema): ({ repo: { provider: string; owner: string; name: string }; buckets: ({ bucket_start: string; run_count: number; completed: number; successes: number; failures: number })[]; workflow_name: string; run_count: number; suc...
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### `posthog.engineeringAnalyticsWorkflowJobs`
|
|
550
|
+
|
|
551
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_jobs/`
|
|
552
|
+
- **What it does**: Jobs of a single workflow run attempt, with per-job duration, runner tier, and estimated cost. Scoped to one run_attempt (the latest unless specified) so a re-run's attempts don't merge. Returns an empty list when the job-level source isn't synced yet.
|
|
553
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_jobs`
|
|
554
|
+
- **Path params**: None
|
|
555
|
+
- **Query params**: `run_attempt`, `run_id`, `source_id`
|
|
556
|
+
- **Response codes**: `200`, `400`
|
|
557
|
+
- **Transport options**: None
|
|
558
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
559
|
+
|
|
560
|
+
**Inputs**
|
|
561
|
+
|
|
562
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
563
|
+
- Client transport options: None
|
|
564
|
+
|
|
565
|
+
**Outputs**
|
|
566
|
+
|
|
567
|
+
- Client return type: `({ id: number; run_id: number; name: string; status: string; conclusion: string | null; started_at: string | null; completed_at: string | null; duration_seconds: number | null; runner_provider: string; runner_label: str...`
|
|
568
|
+
- OpenAPI response codes: `200`, `400`
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
import posthog from "@utdk/posthog";
|
|
572
|
+
|
|
573
|
+
type EngineeringAnalyticsWorkflowJobsInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowJobs> extends [infer T, ...unknown[]] ? T : undefined;
|
|
574
|
+
type EngineeringAnalyticsWorkflowJobsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowJobs>>;
|
|
575
|
+
|
|
576
|
+
const result: EngineeringAnalyticsWorkflowJobsOutput = await posthog.engineeringAnalyticsWorkflowJobs();
|
|
577
|
+
|
|
578
|
+
// Result shape (from schema): ({ id: number; run_id: number; name: string; status: string; conclusion: string | null; started_at: string | null; completed_at: string | null; duration_seconds: number | null; runner_provider: string; runner_label: str...
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
### `posthog.engineeringAnalyticsWorkflowRunActivity`
|
|
582
|
+
|
|
583
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_run_activity/`
|
|
584
|
+
- **What it does**: Compact per-run points for a single workflow over a window (date_from default -30d), newest first, for the run-activity chart: each run's start time, duration, conclusion, branch, and attributed PR. Optionally scope to a single git branch via `branch`, matching workflow_runs. Leaner and higher-capped than workflow_runs so the chart spans the full window even on busy workflows; `truncated` is true when the cap is hit, so the chart covers only the most recent runs.
|
|
585
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_run_activity`
|
|
586
|
+
- **Path params**: None
|
|
587
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `repo`, `source_id`, `workflow_name`
|
|
588
|
+
- **Response codes**: `200`, `400`
|
|
589
|
+
- **Transport options**: None
|
|
590
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
591
|
+
|
|
592
|
+
**Inputs**
|
|
593
|
+
|
|
594
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
595
|
+
- Client transport options: None
|
|
596
|
+
|
|
597
|
+
**Outputs**
|
|
598
|
+
|
|
599
|
+
- Client return type: `{ points: ({ run_id: number; conclusion: string | null; run_started_at: string; duration_seconds: number | null; head_branch: string; pr_number: number; head_sha: string })[]; truncated: boolean; limit: number }`
|
|
600
|
+
- OpenAPI response codes: `200`, `400`
|
|
601
|
+
|
|
602
|
+
```ts
|
|
603
|
+
import posthog from "@utdk/posthog";
|
|
604
|
+
|
|
605
|
+
type EngineeringAnalyticsWorkflowRunActivityInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowRunActivity> extends [infer T, ...unknown[]] ? T : undefined;
|
|
606
|
+
type EngineeringAnalyticsWorkflowRunActivityOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowRunActivity>>;
|
|
607
|
+
|
|
608
|
+
const result: EngineeringAnalyticsWorkflowRunActivityOutput = await posthog.engineeringAnalyticsWorkflowRunActivity();
|
|
609
|
+
|
|
610
|
+
// Result shape (from schema): { points: ({ run_id: number; conclusion: string | null; run_started_at: string; duration_seconds: number | null; head_branch: string; pr_number: number; head_sha: string })[]; truncated: boolean; limit: number }
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### `posthog.engineeringAnalyticsWorkflowRun`
|
|
614
|
+
|
|
615
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_run/`
|
|
616
|
+
- **What it does**: A single workflow run: status, conclusion, duration, branch, attempt, and the attributed pull request. Run-level only — per-job and per-step detail are not tracked yet.
|
|
617
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_run`
|
|
618
|
+
- **Path params**: None
|
|
619
|
+
- **Query params**: `run_id`, `source_id`
|
|
620
|
+
- **Response codes**: `200`, `400`, `404`
|
|
621
|
+
- **Transport options**: None
|
|
622
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
623
|
+
|
|
624
|
+
**Inputs**
|
|
625
|
+
|
|
626
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
627
|
+
- Client transport options: None
|
|
628
|
+
|
|
629
|
+
**Outputs**
|
|
630
|
+
|
|
631
|
+
- Client return type: `{ repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at: ...`
|
|
632
|
+
- OpenAPI response codes: `200`, `400`, `404`
|
|
633
|
+
|
|
634
|
+
```ts
|
|
635
|
+
import posthog from "@utdk/posthog";
|
|
636
|
+
|
|
637
|
+
type EngineeringAnalyticsWorkflowRunInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowRun> extends [infer T, ...unknown[]] ? T : undefined;
|
|
638
|
+
type EngineeringAnalyticsWorkflowRunOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowRun>>;
|
|
639
|
+
|
|
640
|
+
const result: EngineeringAnalyticsWorkflowRunOutput = await posthog.engineeringAnalyticsWorkflowRun();
|
|
641
|
+
|
|
642
|
+
// Result shape (from schema): { repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at: ...
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### `posthog.engineeringAnalyticsWorkflowRunnerCosts`
|
|
646
|
+
|
|
647
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_runner_costs/`
|
|
648
|
+
- **What it does**: A workflow's estimated CI cost broken down by runner tier over a window (date_from default -30d), highest spend first. Optionally scope to a single git branch via `branch`. Returns an empty list when the job-level source isn't synced.
|
|
649
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_runner_costs`
|
|
650
|
+
- **Path params**: None
|
|
651
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `repo`, `source_id`, `workflow_name`
|
|
652
|
+
- **Response codes**: `200`, `400`
|
|
653
|
+
- **Transport options**: None
|
|
654
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
655
|
+
|
|
656
|
+
**Inputs**
|
|
657
|
+
|
|
658
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
659
|
+
- Client transport options: None
|
|
660
|
+
|
|
661
|
+
**Outputs**
|
|
662
|
+
|
|
663
|
+
- Client return type: `({ provider: string; runner_label: string; job_count: number; billable_minutes: number; estimated_cost_usd: number | null })[]`
|
|
664
|
+
- OpenAPI response codes: `200`, `400`
|
|
665
|
+
|
|
666
|
+
```ts
|
|
667
|
+
import posthog from "@utdk/posthog";
|
|
668
|
+
|
|
669
|
+
type EngineeringAnalyticsWorkflowRunnerCostsInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowRunnerCosts> extends [infer T, ...unknown[]] ? T : undefined;
|
|
670
|
+
type EngineeringAnalyticsWorkflowRunnerCostsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowRunnerCosts>>;
|
|
671
|
+
|
|
672
|
+
const result: EngineeringAnalyticsWorkflowRunnerCostsOutput = await posthog.engineeringAnalyticsWorkflowRunnerCosts();
|
|
673
|
+
|
|
674
|
+
// Result shape (from schema): ({ provider: string; runner_label: string; job_count: number; billable_minutes: number; estimated_cost_usd: number | null })[]
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### `posthog.engineeringAnalyticsWorkflowRuns`
|
|
678
|
+
|
|
679
|
+
- **HTTP**: `GET /api/projects/{project_id}/engineering_analytics/workflow_runs/`
|
|
680
|
+
- **What it does**: Runs of a single workflow within a repo over a window (date_from default -30d), newest first. Optionally scope to a single git branch via `branch`. Each row is run-level — per-job and per-step detail are not tracked yet. Use this as the GitHub 'workflow' page between the workflow list and a single run.
|
|
681
|
+
- **OpenAPI operationId**: `engineering_analytics_workflow_runs`
|
|
682
|
+
- **Path params**: None
|
|
683
|
+
- **Query params**: `branch`, `date_from`, `date_to`, `repo`, `source_id`, `workflow_name`
|
|
684
|
+
- **Response codes**: `200`, `400`
|
|
685
|
+
- **Transport options**: None
|
|
686
|
+
- **TypeScript**: [Client interface](../types.ts)
|
|
687
|
+
|
|
688
|
+
**Inputs**
|
|
689
|
+
|
|
690
|
+
- Client input type: `{ [key: string]: unknown }`
|
|
691
|
+
- Client transport options: None
|
|
692
|
+
|
|
693
|
+
**Outputs**
|
|
694
|
+
|
|
695
|
+
- Client return type: `({ repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at:...`
|
|
696
|
+
- OpenAPI response codes: `200`, `400`
|
|
697
|
+
|
|
698
|
+
```ts
|
|
699
|
+
import posthog from "@utdk/posthog";
|
|
700
|
+
|
|
701
|
+
type EngineeringAnalyticsWorkflowRunsInput = Parameters<typeof posthog.engineeringAnalyticsWorkflowRuns> extends [infer T, ...unknown[]] ? T : undefined;
|
|
702
|
+
type EngineeringAnalyticsWorkflowRunsOutput = Awaited<ReturnType<typeof posthog.engineeringAnalyticsWorkflowRuns>>;
|
|
703
|
+
|
|
704
|
+
const result: EngineeringAnalyticsWorkflowRunsOutput = await posthog.engineeringAnalyticsWorkflowRuns();
|
|
705
|
+
|
|
706
|
+
// Result shape (from schema): ({ repo: { provider: string; owner: string; name: string }; id: number; workflow_name: string; head_sha: string; head_branch: string; status: string; conclusion: string | null; run_started_at: string | null; updated_at:...
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
<!-- prompt-hash:
|
|
711
|
+
8c3694991a4c289225f05a4e8f1e098cc74d085a088d7dffd82f00d93797b7f8
|
|
712
|
+
-->
|