Stats
Set the repository a function deploys from POST
Points the function at one repository from `ListRepositories`, with the branch that deploys (the repository's default branch when empty) and an optional `subdirectory`. The function must already have a provider connected (`FAILED_PRECONDITION` otherwise). For GitLab this also registers the push webhook and provisions a project access token. That needs Maintainer access on the project (`PERMISSION_DENIED` otherwise) and a connect session that has not expired (`FAILED_PRECONDITION`). `outcome` is `REPOSITORY_OUTCOME_CONNECTED`, or `REPOSITORY_OUTCOME_CONNECTED_NO_TOKEN` when the webhook was registered but no deploy token could be created. For GitHub, the App installation supplies the credential and the webhook, and `outcome` is `REPOSITORY_OUTCOME_CONNECTED`. Needs the editor role in the owning team. A `git.select_repo` event is recorded. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:edit`
Get a function's traffic stats POST
Returns the function's edge traffic as a series of buckets, oldest first: requests, 4xx and 5xx responses, cold starts, and p50 and p95 latency. `rangeSec` defaults to 24 hours and is capped at 14 days. `stepSec` is raised to the five-minute storage resolution, and coarsened so that at most about 500 points come back. Buckets with no traffic are returned as zeros. The series is not paged: it is bounded by the point cap. Needs the viewer role in the owning team. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:read`