orbee 0.1.0__tar.gz
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.
- orbee-0.1.0/PKG-INFO +302 -0
- orbee-0.1.0/README.md +271 -0
- orbee-0.1.0/orbee/__init__.py +1 -0
- orbee-0.1.0/orbee/__main__.py +3 -0
- orbee-0.1.0/orbee/adapters/__init__.py +0 -0
- orbee-0.1.0/orbee/adapters/_audit_log.py +54 -0
- orbee-0.1.0/orbee/adapters/_errors.py +14 -0
- orbee-0.1.0/orbee/adapters/bigquery.py +131 -0
- orbee-0.1.0/orbee/adapters/cloud_asset.py +116 -0
- orbee-0.1.0/orbee/adapters/cloud_logging.py +313 -0
- orbee-0.1.0/orbee/adapters/cloud_logging_audit.py +186 -0
- orbee-0.1.0/orbee/adapters/iam.py +51 -0
- orbee-0.1.0/orbee/adapters/resource_manager.py +61 -0
- orbee-0.1.0/orbee/cli.py +277 -0
- orbee-0.1.0/orbee/core/__init__.py +0 -0
- orbee-0.1.0/orbee/core/access.py +128 -0
- orbee-0.1.0/orbee/core/changes.py +124 -0
- orbee-0.1.0/orbee/core/coverage.py +81 -0
- orbee-0.1.0/orbee/core/errors.py +26 -0
- orbee-0.1.0/orbee/core/evidence.py +39 -0
- orbee-0.1.0/orbee/core/failures.py +221 -0
- orbee-0.1.0/orbee/core/incident.py +254 -0
- orbee-0.1.0/orbee/core/permissions.py +159 -0
- orbee-0.1.0/orbee/core/scope.py +43 -0
- orbee-0.1.0/orbee/core/window.py +20 -0
- orbee-0.1.0/orbee/mcp.py +268 -0
- orbee-0.1.0/orbee/payloads.py +347 -0
- orbee-0.1.0/orbee/ports.py +115 -0
- orbee-0.1.0/orbee/py.typed +0 -0
- orbee-0.1.0/orbee/render.py +348 -0
- orbee-0.1.0/orbee/service.py +337 -0
- orbee-0.1.0/orbee/settings.py +43 -0
- orbee-0.1.0/orbee/wiring.py +203 -0
- orbee-0.1.0/pyproject.toml +81 -0
- orbee-0.1.0/pyproject.toml.orig +65 -0
orbee-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: orbee
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Understand your Google Cloud platform, across projects: what changed, what broke, who has access. Read-only.
|
|
5
|
+
Keywords: google-cloud,gcp,platform-engineering,sre,audit-logs,iam,cloud-asset-inventory,observability,mcp,cli
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: System Administrators
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: System :: Monitoring
|
|
16
|
+
Classifier: Topic :: System :: Systems Administration
|
|
17
|
+
Requires-Dist: google-cloud-asset>=3.26
|
|
18
|
+
Requires-Dist: google-cloud-audit-log>=0.3
|
|
19
|
+
Requires-Dist: google-cloud-bigquery>=3.27
|
|
20
|
+
Requires-Dist: google-cloud-logging>=3.11
|
|
21
|
+
Requires-Dist: google-cloud-resource-manager>=1.14
|
|
22
|
+
Requires-Dist: mcp>=1.20
|
|
23
|
+
Requires-Dist: pydantic-settings>=2.6
|
|
24
|
+
Requires-Dist: rich>=13.9
|
|
25
|
+
Requires-Dist: typer>=0.15
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Project-URL: Repository, https://github.com/tosun-si/orbee
|
|
28
|
+
Project-URL: Changelog, https://github.com/tosun-si/orbee/releases
|
|
29
|
+
Project-URL: Issues, https://github.com/tosun-si/orbee/issues
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Orbee
|
|
33
|
+
|
|
34
|
+
**Understand your Google Cloud platform. Across projects. With context.**
|
|
35
|
+
|
|
36
|
+
Orbee answers the questions a platform team asks every morning and during every incident,
|
|
37
|
+
across all the projects of an organization at once:
|
|
38
|
+
|
|
39
|
+
- What changed since yesterday, and who changed it?
|
|
40
|
+
- What failed last night on this team's projects?
|
|
41
|
+
- Which changes came right before this incident?
|
|
42
|
+
- Who has access to this resource, and through which group or inherited binding?
|
|
43
|
+
|
|
44
|
+
Orbee is **read-only** and needs **no setup**: it reads the audit logs and the workload logs
|
|
45
|
+
Google already keeps in every project, and links every answer to its evidence in the Google
|
|
46
|
+
Cloud console.
|
|
47
|
+
|
|
48
|
+
> Status: pre-alpha. `orbee changes`, `orbee failures` (Cloud Run, Cloud Composer, BigQuery), `orbee coverage` and
|
|
49
|
+
> the MCP server work end to end; see [the roadmap](docs/roadmap.md).
|
|
50
|
+
> A demo guide, commands and agent prompts: [orbee-demo](https://github.com/tosun-si/orbee-demo).
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv tool install orbee # or pipx install orbee; uvx orbee runs it without installing
|
|
56
|
+
gcloud auth application-default login
|
|
57
|
+
|
|
58
|
+
export ORBEE_PROJECT=my-platform-tools # the project Orbee's API calls are billed to
|
|
59
|
+
export ORBEE_PARENT=organizations/123456789012 # or folders/456, or the organization number
|
|
60
|
+
|
|
61
|
+
orbee doctor # which permissions you miss, and how to grant them
|
|
62
|
+
orbee changes --since 24h
|
|
63
|
+
orbee changes --since 7d -p solis-prd -p billing-prd
|
|
64
|
+
orbee changes --since 2h -o json # with a console link to each log entry
|
|
65
|
+
orbee changes --since 200d -p solis-dev --method UpdateProject # who renamed this project?
|
|
66
|
+
orbee changes --since 7d --actor alice@ --resource billing # any case, substring
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### What changed: Admin Activity audit logs
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
organization / folder ──▶ Resource Manager: every active project, nested folders included
|
|
73
|
+
├── project A ┐
|
|
74
|
+
├── project B ├─ Cloud Logging, _Required bucket ──▶ orbee CLI / MCP
|
|
75
|
+
└── project C ┘ (Admin Activity audit logs, kept 400 days by Google)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Every deployment, IAM binding and configuration change of the organization, its projects and the
|
|
79
|
+
organization or folder itself, with who made it. Read at the source, 50 projects per Cloud Logging
|
|
80
|
+
call: an 84-project organization answers in about 10 seconds over 24 hours. Entries that change
|
|
81
|
+
nothing (Apigee status heartbeats, Cloud SQL connections, operation polls) are left out: on a real
|
|
82
|
+
organization they are most of the log.
|
|
83
|
+
|
|
84
|
+
A project whose logs cannot be read is listed as unreachable, its changes unknown, and the
|
|
85
|
+
command exits with code `3`.
|
|
86
|
+
|
|
87
|
+
`--method`, `--resource` and `--actor` filter at the source, before `--limit`. Cloud Logging
|
|
88
|
+
still scans every entry of the window, one call after the other inside a call: Orbee reads 5
|
|
89
|
+
projects per call and long windows in time slices, 32 reads at a time, within the read quota (200
|
|
90
|
+
requests per minute per user, retried with a backoff). On an 84-project organization with Apigee,
|
|
91
|
+
a rare method over 200 days takes about 25 seconds.
|
|
92
|
+
|
|
93
|
+
#### Optional: the BigQuery audit source
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
orbee changes --source bigquery --since 30d # or ORBEE_AUDIT_SOURCE=bigquery
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The [`org-setup`](terraform/modules/org-setup) Terraform module exports the Admin Activity audit
|
|
100
|
+
logs of the whole organization to one partitioned BigQuery table through an aggregated log sink.
|
|
101
|
+
Use it to keep them beyond 400 days or to query them in SQL; a question is then one
|
|
102
|
+
partition-pruned query, bounded by `ORBEE_MAX_BYTES_BILLED`. It holds the entries from its setup
|
|
103
|
+
on, not before.
|
|
104
|
+
|
|
105
|
+
```hcl
|
|
106
|
+
module "orbee" {
|
|
107
|
+
source = "git::https://github.com/tosun-si/orbee.git//terraform/modules/org-setup?ref=main"
|
|
108
|
+
|
|
109
|
+
project_id = "my-platform-tools"
|
|
110
|
+
parent_type = "organization"
|
|
111
|
+
parent_id = "123456789012"
|
|
112
|
+
reader_members = ["group:platform-team@example.com"]
|
|
113
|
+
export_audit_logs = true
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Applying it needs `roles/logging.configWriter`, the right to create a custom role and to grant
|
|
118
|
+
roles on the organization (or folder), and the rights to create a dataset and grant roles in
|
|
119
|
+
`project_id`. The sink creates its table with the first exported entry; set
|
|
120
|
+
`ORBEE_AUDIT_DATASET` to the `dataset_id` output when it is not `orbee_audit`.
|
|
121
|
+
|
|
122
|
+
The module also grants `reader_members` the **Orbee Reader** custom role on the organization (or
|
|
123
|
+
folder). Without `export_audit_logs` (the default), that role is all it creates: the access the
|
|
124
|
+
default Cloud Logging source needs, see [Permissions](#permissions).
|
|
125
|
+
|
|
126
|
+
### What failed: Cloud Run, Cloud Composer and BigQuery
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
orbee failures --since 12h # every active project under ORBEE_PARENT
|
|
130
|
+
orbee failures -p solis-dev -p solis-prd --since 24h
|
|
131
|
+
orbee failures -p solis-prd -o json # with a Logs Explorer link to each failure
|
|
132
|
+
orbee failures --since 7d --service cloud_run --kind request # 5xx only
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Failures are read at the source, in Cloud Logging, project by project: nothing is copied. Orbee
|
|
136
|
+
keeps the `ERROR` entries of:
|
|
137
|
+
|
|
138
|
+
- **Cloud Run services**: 5xx requests grouped per status, container failures (crash, memory
|
|
139
|
+
limit, startup probe) and application errors grouped per error line;
|
|
140
|
+
- **Cloud Run jobs**: errors grouped per execution;
|
|
141
|
+
- **Cloud Composer**: Airflow task errors grouped per task run (every attempt), broken DAGs and
|
|
142
|
+
scheduler or triggerer errors;
|
|
143
|
+
- **BigQuery**: jobs that failed while running or were refused when submitted, grouped per error
|
|
144
|
+
and per principal, from the Data Access audit logs BigQuery writes by default. A job logged in
|
|
145
|
+
both audit formats is counted once.
|
|
146
|
+
|
|
147
|
+
Access is checked first (testIamPermissions), then projects are read in batches of 50 per Cloud
|
|
148
|
+
Logging call: an 84-project organization answers in about 30 seconds over 7 days. When one
|
|
149
|
+
noisy service fills `--limit`, its project keeps the most recent entries and is reported as
|
|
150
|
+
truncated, and the others are read again without it.
|
|
151
|
+
|
|
152
|
+
A project Orbee cannot read is listed as unreachable, its failures unknown, and the command
|
|
153
|
+
exits with code `3`; when no project can be read, it fails with code `1`.
|
|
154
|
+
|
|
155
|
+
### What happened: one incident on one timeline
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
orbee incident -p solis-dev --workload checkout --since 24h # the latest episode, its leads, who can reach it
|
|
159
|
+
orbee incident -p solis-dev --since 7d --at 2026-11-27T22:30 # the episode at that time
|
|
160
|
+
orbee incident -p solis-dev -o json # every episode with its top lead
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The failures of a project, or one workload, are split into episodes: more than 30 minutes without
|
|
164
|
+
an error starts a new one. The changes of the project are read once, and every change around the
|
|
165
|
+
start of an episode becomes a lead, ranked by a rule anyone can check:
|
|
166
|
+
|
|
167
|
+
- **strong**: changes the failing workload, at most 15 minutes before the first failure;
|
|
168
|
+
- **possible**: changes it earlier, changes another workload of the project just before (a
|
|
169
|
+
dependency), or changes access, a secret, the network, a database or an API of the project;
|
|
170
|
+
- **excluded**: after the first failure, so it cannot have started it (a fix, a rollback).
|
|
171
|
+
|
|
172
|
+
Leads are hypotheses, never causes. The answer says what it did not check: changes outside the
|
|
173
|
+
project (Shared VPC host, organization IAM) and metrics. When the failures were cut at the limit,
|
|
174
|
+
the start is marked uncertain and the changes are read from the start of the window.
|
|
175
|
+
|
|
176
|
+
### Who has access: every IAM binding of the organization
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
orbee access --risky # public, owner/editor to a person, external members
|
|
180
|
+
orbee access --member alice@ # everything alice holds, on any resource
|
|
181
|
+
orbee access --role roles/owner -o json # every owner, with a console link to the IAM page
|
|
182
|
+
orbee access --resource billing --role storage # who holds a storage role on the billing resources
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
One Cloud Asset Inventory search covers the organization (or folder), its folders, projects and
|
|
186
|
+
resources with a policy of their own: buckets, datasets, secrets, service accounts. Each binding
|
|
187
|
+
carries its risks: **public** (`allUsers`, `allAuthenticatedUsers`), **basic_role** (owner or
|
|
188
|
+
editor granted to a person or a group) and **external** (a user, group or domain outside the
|
|
189
|
+
organization's domain, or `ORBEE_INTERNAL_DOMAINS`). Bindings are direct: access through a
|
|
190
|
+
group's members or inherited from a parent is not expanded. Who granted a binding, and when, is
|
|
191
|
+
`orbee changes --method SetIamPolicy`.
|
|
192
|
+
|
|
193
|
+
The command exits with code `3` when the bindings are cut at `--limit`. Cloud Asset Inventory is
|
|
194
|
+
billed and quota-checked on `ORBEE_PROJECT`: enable `cloudasset.googleapis.com` there.
|
|
195
|
+
|
|
196
|
+
### Coverage: where Orbee is blind
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
orbee coverage --since 7d
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Lists every active project under `ORBEE_PARENT`, nested folders included, with the time of its
|
|
203
|
+
last change in the window (read project by project, or in one query with `--source bigquery`) and
|
|
204
|
+
whether its logs can be read. A project seen in the audit logs but
|
|
205
|
+
not listed (a folder you cannot browse), or whose logs cannot be read, is a blind spot: the
|
|
206
|
+
command exits with code `3`. A project without change in the window is quiet, not blind.
|
|
207
|
+
|
|
208
|
+
Every answer states its source, its scope, the time window and when it was collected. A source
|
|
209
|
+
Orbee cannot read is an error, never an empty answer.
|
|
210
|
+
|
|
211
|
+
### Doctor: what you miss, and how to grant it
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
orbee doctor --member group:platform-team@example.com
|
|
215
|
+
orbee doctor -p solis-dev -p solis-prd # projects named one by one, without a parent
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Checks, with `testIamPermissions`, every permission each source needs, and prints the commands
|
|
219
|
+
an administrator runs to grant what is missing. Orbee never grants anything itself. Exits with
|
|
220
|
+
code `3` when a permission is missing or could not be checked.
|
|
221
|
+
|
|
222
|
+
## Permissions
|
|
223
|
+
|
|
224
|
+
Every permission Orbee needs is a read. The list is the contract, short enough to review:
|
|
225
|
+
|
|
226
|
+
| Where | Permissions | For | Predefined alternative |
|
|
227
|
+
|---|---|---|---|
|
|
228
|
+
| Organization or folder (inherited) | `resourcemanager.projects.get`, `resourcemanager.folders.get`, `logging.logEntries.list`, `cloudasset.assets.searchAllIamPolicies` | `access`, `changes`, `coverage`, `failures` | `roles/browser` + `roles/logging.viewer` + `roles/cloudasset.viewer` |
|
|
229
|
+
| Each project, without a parent | `resourcemanager.projects.get`, `logging.logEntries.list` | `changes -p`, `failures -p` | `roles/logging.viewer` |
|
|
230
|
+
| Project hosting the dataset (BigQuery source only) | `bigquery.jobs.create` | `changes`, `coverage` | `roles/bigquery.jobUser` |
|
|
231
|
+
| Audit dataset (BigQuery source only) | `bigquery.tables.get`, `bigquery.tables.getData` | `changes`, `coverage` | `roles/bigquery.dataViewer` |
|
|
232
|
+
|
|
233
|
+
With the default Cloud Logging source, the first line is all Orbee needs. `bigquery.jobs.create`
|
|
234
|
+
runs queries; without `bigquery.tables.create` or `updateData` it cannot write a table. The
|
|
235
|
+
`org-setup` module creates the first four permissions as the **Orbee Reader**
|
|
236
|
+
custom role (`parent_reader_access = "custom_role"`, the default), or grants the predefined roles
|
|
237
|
+
(`"predefined_roles"`), or nothing (`"none"`) when access is granted project by project. Reading
|
|
238
|
+
every project's logs is the sensitive part: grant it on a folder, or project by project, when the
|
|
239
|
+
whole organization is too wide.
|
|
240
|
+
|
|
241
|
+
Granting these roles is the one step that writes, done once by an administrator: `orbee doctor`
|
|
242
|
+
prints the commands, and the `org-setup` module does it in Terraform (`export_audit_logs` left
|
|
243
|
+
off: the role and its bindings, nothing else).
|
|
244
|
+
|
|
245
|
+
## MCP server
|
|
246
|
+
|
|
247
|
+
`orbee mcp` serves the same questions as read-only MCP tools over stdio: `list_changes`,
|
|
248
|
+
`list_failures`, `list_access`, `investigate_incident`, `coverage` and `doctor`, with the same `source` choice
|
|
249
|
+
as `--source`. Their
|
|
250
|
+
answers are sized for an agent's context: `list_failures` returns a summary per project and kind
|
|
251
|
+
then the 50 most recent groups with their first line (`detail` for full messages), and
|
|
252
|
+
`list_changes` takes an end (`until`) so an agent asks what changed in the hour before a failure,
|
|
253
|
+
not over the week. They return the same payloads as `-o json`, and the server instructions tell
|
|
254
|
+
the agent to keep the answer contract: state source, scope, window and collection time, treat
|
|
255
|
+
unreachable projects as unknown, and present a change near a failure as a hypothesis.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Claude Code
|
|
259
|
+
claude mcp add orbee -e ORBEE_PROJECT=my-platform-tools \
|
|
260
|
+
-e ORBEE_PARENT=organizations/123456789012 -- uvx orbee mcp
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
// Gemini CLI: ~/.gemini/settings.json
|
|
265
|
+
{
|
|
266
|
+
"mcpServers": {
|
|
267
|
+
"orbee": {
|
|
268
|
+
"command": "uvx",
|
|
269
|
+
"args": ["orbee", "mcp"],
|
|
270
|
+
"env": {
|
|
271
|
+
"ORBEE_PROJECT": "my-platform-tools",
|
|
272
|
+
"ORBEE_PARENT": "organizations/123456789012"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The server uses your Application Default Credentials, and reads its settings on the first tool
|
|
280
|
+
call: a missing setting comes back as a tool error naming the variable.
|
|
281
|
+
|
|
282
|
+
## Principles
|
|
283
|
+
|
|
284
|
+
- **Read-only.** No write to your platform.
|
|
285
|
+
- **Unknown is not healthy.** What Orbee cannot see is reported as such.
|
|
286
|
+
- **Observed, not guessed.** A change close to an incident is a lead to check, not a cause.
|
|
287
|
+
- **Evidence.** Every fact links back to its source.
|
|
288
|
+
- **Bounded cost.** Every read has a time window and a limit.
|
|
289
|
+
- **No copy by default.** Logs are read where Google keeps them; exporting them is opt-in.
|
|
290
|
+
|
|
291
|
+
## Development
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
cp .envrc.example .envrc && direnv allow
|
|
295
|
+
uv sync
|
|
296
|
+
uv run pytest
|
|
297
|
+
uv run ruff check . && uv run ruff format --check .
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
[Apache 2.0](LICENSE)
|
orbee-0.1.0/README.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Orbee
|
|
2
|
+
|
|
3
|
+
**Understand your Google Cloud platform. Across projects. With context.**
|
|
4
|
+
|
|
5
|
+
Orbee answers the questions a platform team asks every morning and during every incident,
|
|
6
|
+
across all the projects of an organization at once:
|
|
7
|
+
|
|
8
|
+
- What changed since yesterday, and who changed it?
|
|
9
|
+
- What failed last night on this team's projects?
|
|
10
|
+
- Which changes came right before this incident?
|
|
11
|
+
- Who has access to this resource, and through which group or inherited binding?
|
|
12
|
+
|
|
13
|
+
Orbee is **read-only** and needs **no setup**: it reads the audit logs and the workload logs
|
|
14
|
+
Google already keeps in every project, and links every answer to its evidence in the Google
|
|
15
|
+
Cloud console.
|
|
16
|
+
|
|
17
|
+
> Status: pre-alpha. `orbee changes`, `orbee failures` (Cloud Run, Cloud Composer, BigQuery), `orbee coverage` and
|
|
18
|
+
> the MCP server work end to end; see [the roadmap](docs/roadmap.md).
|
|
19
|
+
> A demo guide, commands and agent prompts: [orbee-demo](https://github.com/tosun-si/orbee-demo).
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv tool install orbee # or pipx install orbee; uvx orbee runs it without installing
|
|
25
|
+
gcloud auth application-default login
|
|
26
|
+
|
|
27
|
+
export ORBEE_PROJECT=my-platform-tools # the project Orbee's API calls are billed to
|
|
28
|
+
export ORBEE_PARENT=organizations/123456789012 # or folders/456, or the organization number
|
|
29
|
+
|
|
30
|
+
orbee doctor # which permissions you miss, and how to grant them
|
|
31
|
+
orbee changes --since 24h
|
|
32
|
+
orbee changes --since 7d -p solis-prd -p billing-prd
|
|
33
|
+
orbee changes --since 2h -o json # with a console link to each log entry
|
|
34
|
+
orbee changes --since 200d -p solis-dev --method UpdateProject # who renamed this project?
|
|
35
|
+
orbee changes --since 7d --actor alice@ --resource billing # any case, substring
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### What changed: Admin Activity audit logs
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
organization / folder ──▶ Resource Manager: every active project, nested folders included
|
|
42
|
+
├── project A ┐
|
|
43
|
+
├── project B ├─ Cloud Logging, _Required bucket ──▶ orbee CLI / MCP
|
|
44
|
+
└── project C ┘ (Admin Activity audit logs, kept 400 days by Google)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Every deployment, IAM binding and configuration change of the organization, its projects and the
|
|
48
|
+
organization or folder itself, with who made it. Read at the source, 50 projects per Cloud Logging
|
|
49
|
+
call: an 84-project organization answers in about 10 seconds over 24 hours. Entries that change
|
|
50
|
+
nothing (Apigee status heartbeats, Cloud SQL connections, operation polls) are left out: on a real
|
|
51
|
+
organization they are most of the log.
|
|
52
|
+
|
|
53
|
+
A project whose logs cannot be read is listed as unreachable, its changes unknown, and the
|
|
54
|
+
command exits with code `3`.
|
|
55
|
+
|
|
56
|
+
`--method`, `--resource` and `--actor` filter at the source, before `--limit`. Cloud Logging
|
|
57
|
+
still scans every entry of the window, one call after the other inside a call: Orbee reads 5
|
|
58
|
+
projects per call and long windows in time slices, 32 reads at a time, within the read quota (200
|
|
59
|
+
requests per minute per user, retried with a backoff). On an 84-project organization with Apigee,
|
|
60
|
+
a rare method over 200 days takes about 25 seconds.
|
|
61
|
+
|
|
62
|
+
#### Optional: the BigQuery audit source
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
orbee changes --source bigquery --since 30d # or ORBEE_AUDIT_SOURCE=bigquery
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The [`org-setup`](terraform/modules/org-setup) Terraform module exports the Admin Activity audit
|
|
69
|
+
logs of the whole organization to one partitioned BigQuery table through an aggregated log sink.
|
|
70
|
+
Use it to keep them beyond 400 days or to query them in SQL; a question is then one
|
|
71
|
+
partition-pruned query, bounded by `ORBEE_MAX_BYTES_BILLED`. It holds the entries from its setup
|
|
72
|
+
on, not before.
|
|
73
|
+
|
|
74
|
+
```hcl
|
|
75
|
+
module "orbee" {
|
|
76
|
+
source = "git::https://github.com/tosun-si/orbee.git//terraform/modules/org-setup?ref=main"
|
|
77
|
+
|
|
78
|
+
project_id = "my-platform-tools"
|
|
79
|
+
parent_type = "organization"
|
|
80
|
+
parent_id = "123456789012"
|
|
81
|
+
reader_members = ["group:platform-team@example.com"]
|
|
82
|
+
export_audit_logs = true
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Applying it needs `roles/logging.configWriter`, the right to create a custom role and to grant
|
|
87
|
+
roles on the organization (or folder), and the rights to create a dataset and grant roles in
|
|
88
|
+
`project_id`. The sink creates its table with the first exported entry; set
|
|
89
|
+
`ORBEE_AUDIT_DATASET` to the `dataset_id` output when it is not `orbee_audit`.
|
|
90
|
+
|
|
91
|
+
The module also grants `reader_members` the **Orbee Reader** custom role on the organization (or
|
|
92
|
+
folder). Without `export_audit_logs` (the default), that role is all it creates: the access the
|
|
93
|
+
default Cloud Logging source needs, see [Permissions](#permissions).
|
|
94
|
+
|
|
95
|
+
### What failed: Cloud Run, Cloud Composer and BigQuery
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
orbee failures --since 12h # every active project under ORBEE_PARENT
|
|
99
|
+
orbee failures -p solis-dev -p solis-prd --since 24h
|
|
100
|
+
orbee failures -p solis-prd -o json # with a Logs Explorer link to each failure
|
|
101
|
+
orbee failures --since 7d --service cloud_run --kind request # 5xx only
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Failures are read at the source, in Cloud Logging, project by project: nothing is copied. Orbee
|
|
105
|
+
keeps the `ERROR` entries of:
|
|
106
|
+
|
|
107
|
+
- **Cloud Run services**: 5xx requests grouped per status, container failures (crash, memory
|
|
108
|
+
limit, startup probe) and application errors grouped per error line;
|
|
109
|
+
- **Cloud Run jobs**: errors grouped per execution;
|
|
110
|
+
- **Cloud Composer**: Airflow task errors grouped per task run (every attempt), broken DAGs and
|
|
111
|
+
scheduler or triggerer errors;
|
|
112
|
+
- **BigQuery**: jobs that failed while running or were refused when submitted, grouped per error
|
|
113
|
+
and per principal, from the Data Access audit logs BigQuery writes by default. A job logged in
|
|
114
|
+
both audit formats is counted once.
|
|
115
|
+
|
|
116
|
+
Access is checked first (testIamPermissions), then projects are read in batches of 50 per Cloud
|
|
117
|
+
Logging call: an 84-project organization answers in about 30 seconds over 7 days. When one
|
|
118
|
+
noisy service fills `--limit`, its project keeps the most recent entries and is reported as
|
|
119
|
+
truncated, and the others are read again without it.
|
|
120
|
+
|
|
121
|
+
A project Orbee cannot read is listed as unreachable, its failures unknown, and the command
|
|
122
|
+
exits with code `3`; when no project can be read, it fails with code `1`.
|
|
123
|
+
|
|
124
|
+
### What happened: one incident on one timeline
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
orbee incident -p solis-dev --workload checkout --since 24h # the latest episode, its leads, who can reach it
|
|
128
|
+
orbee incident -p solis-dev --since 7d --at 2026-11-27T22:30 # the episode at that time
|
|
129
|
+
orbee incident -p solis-dev -o json # every episode with its top lead
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The failures of a project, or one workload, are split into episodes: more than 30 minutes without
|
|
133
|
+
an error starts a new one. The changes of the project are read once, and every change around the
|
|
134
|
+
start of an episode becomes a lead, ranked by a rule anyone can check:
|
|
135
|
+
|
|
136
|
+
- **strong**: changes the failing workload, at most 15 minutes before the first failure;
|
|
137
|
+
- **possible**: changes it earlier, changes another workload of the project just before (a
|
|
138
|
+
dependency), or changes access, a secret, the network, a database or an API of the project;
|
|
139
|
+
- **excluded**: after the first failure, so it cannot have started it (a fix, a rollback).
|
|
140
|
+
|
|
141
|
+
Leads are hypotheses, never causes. The answer says what it did not check: changes outside the
|
|
142
|
+
project (Shared VPC host, organization IAM) and metrics. When the failures were cut at the limit,
|
|
143
|
+
the start is marked uncertain and the changes are read from the start of the window.
|
|
144
|
+
|
|
145
|
+
### Who has access: every IAM binding of the organization
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
orbee access --risky # public, owner/editor to a person, external members
|
|
149
|
+
orbee access --member alice@ # everything alice holds, on any resource
|
|
150
|
+
orbee access --role roles/owner -o json # every owner, with a console link to the IAM page
|
|
151
|
+
orbee access --resource billing --role storage # who holds a storage role on the billing resources
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
One Cloud Asset Inventory search covers the organization (or folder), its folders, projects and
|
|
155
|
+
resources with a policy of their own: buckets, datasets, secrets, service accounts. Each binding
|
|
156
|
+
carries its risks: **public** (`allUsers`, `allAuthenticatedUsers`), **basic_role** (owner or
|
|
157
|
+
editor granted to a person or a group) and **external** (a user, group or domain outside the
|
|
158
|
+
organization's domain, or `ORBEE_INTERNAL_DOMAINS`). Bindings are direct: access through a
|
|
159
|
+
group's members or inherited from a parent is not expanded. Who granted a binding, and when, is
|
|
160
|
+
`orbee changes --method SetIamPolicy`.
|
|
161
|
+
|
|
162
|
+
The command exits with code `3` when the bindings are cut at `--limit`. Cloud Asset Inventory is
|
|
163
|
+
billed and quota-checked on `ORBEE_PROJECT`: enable `cloudasset.googleapis.com` there.
|
|
164
|
+
|
|
165
|
+
### Coverage: where Orbee is blind
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
orbee coverage --since 7d
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Lists every active project under `ORBEE_PARENT`, nested folders included, with the time of its
|
|
172
|
+
last change in the window (read project by project, or in one query with `--source bigquery`) and
|
|
173
|
+
whether its logs can be read. A project seen in the audit logs but
|
|
174
|
+
not listed (a folder you cannot browse), or whose logs cannot be read, is a blind spot: the
|
|
175
|
+
command exits with code `3`. A project without change in the window is quiet, not blind.
|
|
176
|
+
|
|
177
|
+
Every answer states its source, its scope, the time window and when it was collected. A source
|
|
178
|
+
Orbee cannot read is an error, never an empty answer.
|
|
179
|
+
|
|
180
|
+
### Doctor: what you miss, and how to grant it
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
orbee doctor --member group:platform-team@example.com
|
|
184
|
+
orbee doctor -p solis-dev -p solis-prd # projects named one by one, without a parent
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Checks, with `testIamPermissions`, every permission each source needs, and prints the commands
|
|
188
|
+
an administrator runs to grant what is missing. Orbee never grants anything itself. Exits with
|
|
189
|
+
code `3` when a permission is missing or could not be checked.
|
|
190
|
+
|
|
191
|
+
## Permissions
|
|
192
|
+
|
|
193
|
+
Every permission Orbee needs is a read. The list is the contract, short enough to review:
|
|
194
|
+
|
|
195
|
+
| Where | Permissions | For | Predefined alternative |
|
|
196
|
+
|---|---|---|---|
|
|
197
|
+
| Organization or folder (inherited) | `resourcemanager.projects.get`, `resourcemanager.folders.get`, `logging.logEntries.list`, `cloudasset.assets.searchAllIamPolicies` | `access`, `changes`, `coverage`, `failures` | `roles/browser` + `roles/logging.viewer` + `roles/cloudasset.viewer` |
|
|
198
|
+
| Each project, without a parent | `resourcemanager.projects.get`, `logging.logEntries.list` | `changes -p`, `failures -p` | `roles/logging.viewer` |
|
|
199
|
+
| Project hosting the dataset (BigQuery source only) | `bigquery.jobs.create` | `changes`, `coverage` | `roles/bigquery.jobUser` |
|
|
200
|
+
| Audit dataset (BigQuery source only) | `bigquery.tables.get`, `bigquery.tables.getData` | `changes`, `coverage` | `roles/bigquery.dataViewer` |
|
|
201
|
+
|
|
202
|
+
With the default Cloud Logging source, the first line is all Orbee needs. `bigquery.jobs.create`
|
|
203
|
+
runs queries; without `bigquery.tables.create` or `updateData` it cannot write a table. The
|
|
204
|
+
`org-setup` module creates the first four permissions as the **Orbee Reader**
|
|
205
|
+
custom role (`parent_reader_access = "custom_role"`, the default), or grants the predefined roles
|
|
206
|
+
(`"predefined_roles"`), or nothing (`"none"`) when access is granted project by project. Reading
|
|
207
|
+
every project's logs is the sensitive part: grant it on a folder, or project by project, when the
|
|
208
|
+
whole organization is too wide.
|
|
209
|
+
|
|
210
|
+
Granting these roles is the one step that writes, done once by an administrator: `orbee doctor`
|
|
211
|
+
prints the commands, and the `org-setup` module does it in Terraform (`export_audit_logs` left
|
|
212
|
+
off: the role and its bindings, nothing else).
|
|
213
|
+
|
|
214
|
+
## MCP server
|
|
215
|
+
|
|
216
|
+
`orbee mcp` serves the same questions as read-only MCP tools over stdio: `list_changes`,
|
|
217
|
+
`list_failures`, `list_access`, `investigate_incident`, `coverage` and `doctor`, with the same `source` choice
|
|
218
|
+
as `--source`. Their
|
|
219
|
+
answers are sized for an agent's context: `list_failures` returns a summary per project and kind
|
|
220
|
+
then the 50 most recent groups with their first line (`detail` for full messages), and
|
|
221
|
+
`list_changes` takes an end (`until`) so an agent asks what changed in the hour before a failure,
|
|
222
|
+
not over the week. They return the same payloads as `-o json`, and the server instructions tell
|
|
223
|
+
the agent to keep the answer contract: state source, scope, window and collection time, treat
|
|
224
|
+
unreachable projects as unknown, and present a change near a failure as a hypothesis.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Claude Code
|
|
228
|
+
claude mcp add orbee -e ORBEE_PROJECT=my-platform-tools \
|
|
229
|
+
-e ORBEE_PARENT=organizations/123456789012 -- uvx orbee mcp
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
// Gemini CLI: ~/.gemini/settings.json
|
|
234
|
+
{
|
|
235
|
+
"mcpServers": {
|
|
236
|
+
"orbee": {
|
|
237
|
+
"command": "uvx",
|
|
238
|
+
"args": ["orbee", "mcp"],
|
|
239
|
+
"env": {
|
|
240
|
+
"ORBEE_PROJECT": "my-platform-tools",
|
|
241
|
+
"ORBEE_PARENT": "organizations/123456789012"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
The server uses your Application Default Credentials, and reads its settings on the first tool
|
|
249
|
+
call: a missing setting comes back as a tool error naming the variable.
|
|
250
|
+
|
|
251
|
+
## Principles
|
|
252
|
+
|
|
253
|
+
- **Read-only.** No write to your platform.
|
|
254
|
+
- **Unknown is not healthy.** What Orbee cannot see is reported as such.
|
|
255
|
+
- **Observed, not guessed.** A change close to an incident is a lead to check, not a cause.
|
|
256
|
+
- **Evidence.** Every fact links back to its source.
|
|
257
|
+
- **Bounded cost.** Every read has a time window and a limit.
|
|
258
|
+
- **No copy by default.** Logs are read where Google keeps them; exporting them is opt-in.
|
|
259
|
+
|
|
260
|
+
## Development
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
cp .envrc.example .envrc && direnv allow
|
|
264
|
+
uv sync
|
|
265
|
+
uv run pytest
|
|
266
|
+
uv run ruff check . && uv run ruff format --check .
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## License
|
|
270
|
+
|
|
271
|
+
[Apache 2.0](LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Orbee: understand your Google Cloud platform, across projects."""
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Reads a Cloud Audit Logs payload, whichever form the Cloud Logging client hands it over in."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Mapping
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from google.cloud.audit.audit_log_pb2 import AuditLog
|
|
10
|
+
from google.protobuf.any_pb2 import Any as AnyProto
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True, slots=True)
|
|
14
|
+
class AuditFields:
|
|
15
|
+
service: str | None = None
|
|
16
|
+
method: str | None = None
|
|
17
|
+
resource: str | None = None
|
|
18
|
+
actor: str | None = None
|
|
19
|
+
status_code: int = 0
|
|
20
|
+
status_message: str = ""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def audit_fields(payload: Any) -> AuditFields:
|
|
24
|
+
"""The fields Orbee reads from an AuditLog.
|
|
25
|
+
|
|
26
|
+
The client hands over a dict, or the raw `Any` when the AuditLog nests a message of a type it
|
|
27
|
+
cannot decode (an IAM CreateRole request, the AuditData of a BigQuery job): that one is
|
|
28
|
+
unpacked as an AuditLog, its own fields are always known.
|
|
29
|
+
"""
|
|
30
|
+
if isinstance(payload, AnyProto):
|
|
31
|
+
audit_log = AuditLog()
|
|
32
|
+
if not payload.Unpack(audit_log):
|
|
33
|
+
return AuditFields()
|
|
34
|
+
return AuditFields(
|
|
35
|
+
service=audit_log.service_name or None,
|
|
36
|
+
method=audit_log.method_name or None,
|
|
37
|
+
resource=audit_log.resource_name or None,
|
|
38
|
+
actor=audit_log.authentication_info.principal_email or None,
|
|
39
|
+
status_code=audit_log.status.code,
|
|
40
|
+
status_message=audit_log.status.message,
|
|
41
|
+
)
|
|
42
|
+
if not isinstance(payload, Mapping):
|
|
43
|
+
return AuditFields()
|
|
44
|
+
authentication = payload.get("authenticationInfo")
|
|
45
|
+
status = payload.get("status")
|
|
46
|
+
status = status if isinstance(status, Mapping) else {}
|
|
47
|
+
return AuditFields(
|
|
48
|
+
service=payload.get("serviceName"),
|
|
49
|
+
method=payload.get("methodName"),
|
|
50
|
+
resource=payload.get("resourceName"),
|
|
51
|
+
actor=authentication.get("principalEmail") if isinstance(authentication, Mapping) else None,
|
|
52
|
+
status_code=int(status.get("code") or 0),
|
|
53
|
+
status_message=str(status.get("message") or ""),
|
|
54
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Turns Google API errors into short reasons a person can act on."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
from google.api_core.exceptions import GoogleAPICallError
|
|
8
|
+
|
|
9
|
+
_REST_PREFIX = re.compile(r"^(GET|POST|PUT|PATCH|DELETE) \S+: ")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def reason(exc: GoogleAPICallError) -> str:
|
|
13
|
+
"""The API's message without the `POST https://...: ` prefix of REST clients."""
|
|
14
|
+
return _REST_PREFIX.sub("", exc.message or str(exc))
|