Repository navigation
Releases
v0.3.0
Graphwake CI agent v0.3.0
Usage Discovery. The agent has a second command, graphwake usage: it reads a gateway log or trace export and sends Graphwake a summary of which caller used which endpoint, how many times and on which day last. It reads one file or standard input, runs wherever you run it (a scheduled CI job or any scheduler) and connects to nothing but Graphwake (it never follows a redirect). The summary holds the caller name, the endpoint as a path template, the call count and the last-seen day. Other than the one value you choose as the caller name, nothing from a request is sent: no body, header, query string or IP address.
Optional. Without it, Graphwake still needs only your spec.
upload is unchanged in this release. The top-level help (graphwake -h) now also lists the usage commands.
Highlights
graphwake usage --source <preset>reads--input <file>or standard input (in CI always pass--input: piped input is read until the pipe is closed), fetches the endpoint list of the usage key's usage source from Graphwake, matches every request to an endpoint template on this machine and sends the summary. The key is read fromGRAPHWAKE_USAGE_KEY(--keyis accepted);GRAPHWAKE_KEY, the spec upload's key, is a different key. The other variables:GRAPHWAKE_USAGE_SOURCE,GRAPHWAKE_USAGE_INPUT,GRAPHWAKE_USAGE_SERVICE,GRAPHWAKE_USAGE_CALLER_FIELD,GRAPHWAKE_USAGE_NO_COUNTS,GRAPHWAKE_USAGE_DRY_RUN, andGRAPHWAKE_URLfor the API URL (--url).- Seven sources:
apim(Azure API Management),appinsights(Azure Application Insights, workspace-based, throughaz monitor log-analytics query),datadog(Datadog APM, the spans aggregate API),kong(Kong file-log or http-log),nginx(NGINX, a JSON log format),otel(OpenTelemetry Collector file exporter; the printed configuration needs the Collector's contrib distribution, 0.146.0 or later) andgeneric(CSV or JSON from any other tool).graphwake usage query --source <preset>prints the query or configuration that produces the input, without a key or a network call. --dry-runfetches the endpoint list, builds the summary and prints the exact body that would be sent, then what is not sent: the unmatched requests by host and path prefix (printed to the job log, so masked: a path segment with a digit,@or%, or longer than 24 characters, shows as*, and at most 20 rows are listed) and the withheld and anonymous request counts, then, when the preset skipped lines or elements, how many (2 lines could not be read.). When the summary has no rows, it ends withNote: this summary has no rows, so it would not be sent., because the real run sends nothing then. It sends no summary; it only fetches the endpoint list with the usage key.--caller-fieldnames the field that identifies the caller when the preset's default does not;--servicenames the Graphwake service for requests that no mapping, server URL host orservicecolumn assigns;--no-countssends the summary without per-row counts (the three totalsunmatchedRequests,withheldRequestsandanonymousRequestsare still sent).
Privacy, as the code does it
- A closed field list. The summary has the fields
preset,agentVersion,windowStart,windowEnd,countsIncluded,unmatchedRequests,withheldRequests,anonymousRequestsandrows; each row hascaller,callerKind,endpointId,service,method,path,countandlastSeen. A test fails if a field is added. The row's endpoint, service, method and path template come from the endpoint list Graphwake sent, never from the raw request. - From the input, only the caller field is sent as free text. The value of the field you choose as the caller (the preset's default or
--caller-field) is sent as the caller name unless it is withheld: without white space at its ends and cut to its first 200 characters (the rules are checked before and after the cut). A certificate subject the agent can read (mutual TLS, NGINX's$ssl_client_s_dn; the README's step 2 under What the usage step sends says which) is reduced to its common name; only the common name is sent, soCN=checkout,OU=Payments,O=Acmegives the caller namecheckout. A subject with aUID,DC,emailAddressorEpart may be a person's, so it is not reduced: it is withheld whole. Besides the request counts, the days and, in thegenericpreset, theclientorservicekind from thecallerKindcolumn, nothing is sent from any field other than the chosen caller field: not a request's path or query string, host, API name, body, status code or client IP address. No header value is sent except the one you choose as the caller name (NGINX's suggested format fillscallerfrom$http_x_client_id; Kong's--caller-fieldcan name a header). The caller name is whatever that field holds: a value that no rule below withholds, such as a host name or a status code, is sent if the caller field names one, so point it at a field that names the application. - Withheld caller names, a safety net. A caller name that matches one of the withholding rules is not sent, and its requests are counted in
withheldRequests. The exact rules, with examples of what each one catches and does not catch, are in the README under What the usage step sends. As a summary only, the shapes they look for: an e-mail address; an IPv4 or IPv6 address; 32 or more hexadecimal characters in a row; a run of 32 or more letters, digits and+/_=-with upper case, lower case and a digit; a control character; the sequence##; a path or a URL; and any of the characters{,},",<,>or=. These rules catch common shapes of personal or secret values; they are a safety net, not a guarantee, so choose a caller field that holds a client or application name. - A caller limit: with more distinct callers (caller name and kind pairs) than the limit (2,000 unless Graphwake's endpoint list sets another), nothing is sent and the warning says to choose another
--caller-field. When the summary fits but the usage source already holds too many callers (claimed and ignored ones count), Graphwake refuses it and the agent warns:usage not sent: this source already holds too many callers (claimed and ignored callers count). Unclaim or stop ignoring callers you no longer need in Graphwake, or add a new usage source.The agent stops keeping callers and rows once a limit is passed, so their number cannot exhaust memory; in an input read line by line, a line longer than 16 MB is skipped and counted as unreadable. - Counts saturate at the largest 64-bit integer;
--no-countsleaves the per-row counts out. - The usage key is never printed. A dry run only fetches the endpoint list and never sends a summary.
- Incomplete exports are reported: a Datadog answer with a status other than
done, a warning or cut short, or an Application Insights API answer (thetablesform) with anerrormember that is not null, adds "The export was incomplete (the tool reported a timeout or a warning)." to the result line. Datadog answers carry no dates, so their requests get the day the step runs.
graphwake usage exits 0 for every error it handles (bad input, network, key, plan, limits, an internal error) and prints one result line (--dry-run and usage query print several). It cannot exit 0 when the process is stopped before it finishes: when it runs out of memory (for example on one JSON value of several gigabytes, which is read whole; only input read line by line has the 16 MB cap) or when the runner kills it because standard input is a pipe that is never closed. That is why CI should pass --input.
Install
The GitHub Action, the GitLab template and the Azure DevOps task run upload only and now download agent 0.3.0 by default. Run graphwake usage with the Docker image or the binary.
Docker
docker run --rm -e GRAPHWAKE_USAGE_KEY -v "$PWD:/w" -w /w ghcr.io/graphwake/agent:0.3.0 usage --source generic --input usage.csv --dry-runBinary
VERSION=0.3.0
BASE=https://github.com/graphwake/agent/releases/download/v$VERSION
ARCHIVE=graphwake_${VERSION}_linux_amd64.tar.gz
curl -fsSLO "$BASE/$ARCHIVE" && curl -fsSLO "$BASE/checksums.txt" &&
sha256sum --check --ignore-missing checksums.txt &&
tar -xzf "$ARCHIVE" graphwake &&
./graphwake usage --source generic --input usage.csv --dry-runSpec upload (unchanged)
- uses: graphwake/agent/github-action@v0.3.0
with:
spec: openapi.json
key: ${{ secrets.GRAPHWAKE_KEY }}See the README for every source, flag, output line and a daily GitHub Actions and Azure Pipelines example. Setup for each tool: https://graphwake.com/guides/find-api-consumers-from-gateway-logs. What the step sends: https://graphwake.com/security/usage-data.
Assets
| Platform | amd64 | arm64 |
|---|---|---|
| Linux | graphwake_0.3.0_linux_amd64.tar.gz |
graphwake_0.3.0_linux_arm64.tar.gz |
| macOS | graphwake_0.3.0_darwin_amd64.tar.gz |
graphwake_0.3.0_darwin_arm64.tar.gz |
| Windows | graphwake_0.3.0_windows_amd64.zip |
graphwake_0.3.0_windows_arm64.zip |
SHA-256 checksums are in checksums.txt. The multi-arch Docker image ghcr.io/graphwake/agent:0.3.0 (also :latest) is published for linux/amd64 and linux/arm64.
Upgrade notes
- None required.
uploadis unchanged; pipelines that pin 0.2.0 keep working. - The GitHub Action (
versioninput), the GitLab template (image tag) and the Azure DevOps task (agentVersioninput, task version 0.3.0, extension version 0.3.0) now default to agent 0.3.0. graphwake usageneeds a usage key fr...
v0.2.0
Graphwake CI agent v0.2.0
Pull request comments and an optional check. On an open pull request build on GitHub Actions, or on Azure Pipelines with an Azure Repos repository, the agent now writes the impact of the change on the pull request itself: the breaking changes and the teams subscribed to the endpoints they touch. With --fail-on it can also fail the build until the breaking change is fixed or accepted.
The agent still never fails your pipeline unless you turn on --fail-on. Without it the exit code is always 0. With it, the only non-zero exit is 1, on an open pull request build whose check failed. Graphwake being down, slow or rejecting the request, a comment that cannot be written and an unsupported CI are warnings, never failures.
Highlights
- Pull request comment (GitHub and Azure Repos, on by default): one comment per service, updated on every build instead of adding new ones. It lists up to 10 breaking changes (
METHOD /path: what changed), the affected teams, the changed endpoints with no consumer mapped yet, the number of non-breaking changes and a link to the impact in Graphwake. A pull request that never had a breaking change gets no comment; when a later build has none, the comment changes to "No breaking changes anymore." (on Azure DevOps the thread is resolved). Turn it off with--no-commentorGRAPHWAKE_COMMENT=false. - Team names follow the repository's visibility: shown in private and internal repositories, only the count in public ones. Each service can change this in Graphwake ("Team names in pull request comments": Automatic, Always show, Never show). Alert channel names are never shown.
- Optional check,
--fail-on breaking|affected(GRAPHWAKE_FAIL_ON):breakingfails the pull request build on any breaking change,affected(recommended) only when a breaking change affects at least one subscribed team. Off by default. Default-branch builds never fail. - Escape hatch: the label
graphwake-accept-breakingon the pull request lets a failing check pass. Labels are read when the agent runs, so re-running the check after adding the label is enough. - GitHub Action: new inputs
fail-onandcomment; the action fails the step only when the agent exits 1. The workflow needspull-requests: writeto comment. - Azure DevOps task
GraphwakeUpload@0(0.2.0): new inputsfailOnandcomment; mapSYSTEM_ACCESSTOKEN: $(System.AccessToken)in the step'senvso the agent can comment and read labels (the task also tries the token Azure hands every task, but the mapping is the reliable path). The task fails the step only when the agent exits 1. The<Project> Build Serviceidentity needs "Contribute to pull requests: Allow" on the repository. - Bounded: all GitHub and Azure DevOps API calls of a run share a 10-second budget; the CI token is never printed.
Install
GitHub Actions
on:
pull_request:
types: [opened, synchronize, reopened, closed, labeled, unlabeled]
push:
branches: [main]
permissions:
contents: read
pull-requests: write
jobs:
api-spec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: graphwake/agent/github-action@v0.2.0
with:
spec: openapi.json
key: ${{ secrets.GRAPHWAKE_KEY }}
# fail-on: affected # optionalAzure DevOps
- task: GraphwakeUpload@0
inputs:
spec: openapi.json
key: $(GRAPHWAKE_KEY)
# failOn: affected # optional
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)In a script step instead of the task, map the build's token the same way: SYSTEM_ACCESSTOKEN: $(System.AccessToken) under env.
GitLab CI
include:
- remote: https://raw.githubusercontent.com/graphwake/agent/v0.2.0/gitlab/graphwake.gitlab-ci.yml
graphwake:
extends: .graphwake-upload
variables:
GRAPHWAKE_SPEC: openapi.jsonDocker (Jenkins, Bitbucket, anything else)
Pass your CI's environment variables through with -e so the agent can detect the build (see the README for the list for each platform):
docker run --rm -e GRAPHWAKE_KEY -v "$PWD:/w" -w /w ghcr.io/graphwake/agent:0.2.0 upload --spec openapi.jsonBinary
VERSION=0.2.0
BASE=https://github.com/graphwake/agent/releases/download/v$VERSION
ARCHIVE=graphwake_${VERSION}_linux_amd64.tar.gz
curl -fsSLO "$BASE/$ARCHIVE" && curl -fsSLO "$BASE/checksums.txt" &&
sha256sum --check --ignore-missing checksums.txt &&
tar -xzf "$ARCHIVE" graphwake &&
./graphwake upload --spec openapi.json || echo "graphwake: agent not run, spec not sent"See the README for the comment, the check, the permissions and every option.
Assets
| Platform | amd64 | arm64 |
|---|---|---|
| Linux | graphwake_0.2.0_linux_amd64.tar.gz |
graphwake_0.2.0_linux_arm64.tar.gz |
| macOS | graphwake_0.2.0_darwin_amd64.tar.gz |
graphwake_0.2.0_darwin_arm64.tar.gz |
| Windows | graphwake_0.2.0_windows_amd64.zip |
graphwake_0.2.0_windows_arm64.zip |
SHA-256 checksums are in checksums.txt. The multi-arch Docker image ghcr.io/graphwake/agent:0.2.0 (also :latest) is published for linux/amd64 and linux/arm64.
Notes
- Comments and
--fail-onwork on GitHub Actions and on Azure Pipelines with Azure Repos only. GitLab CI, Bitbucket Pipelines, Jenkins, other CIs and Azure Pipelines building a repository not hosted in Azure Repos (GitHub, Bitbucket or another Git host) get no comment yet, and--fail-onis not applied there: the agent warns--fail-on is not supported on this CI yet; not failingand exits 0. - Without the CI token (
GITHUB_TOKEN, orSYSTEM_ACCESSTOKENon Azure DevOps) the agent writes no comment and warns;--fail-onstill applies, but the label cannot be read. The GitHub Action passes the job token for you; on Azure DevOps, mapSYSTEM_ACCESSTOKEN: $(System.AccessToken)in the step'senv. - Using
--fail-onin your own script step: remove|| true/|| echoafter the agent andcontinueOnError: true, so exit 1 reaches the pipeline. The README has an Azure DevOps script step written this way. - Azure DevOps task version: the task stays on major version 0 (
GraphwakeUpload@0), so pipelines on@0get the comment once the extension is updated. Once the extension is public, behaviour changes will ship as a new major version. - Needs a Graphwake server that returns the pull request outcome. With an older server the agent sends the spec as before and, if
--fail-onis set, warnsthe server did not return a check result; not failing.
v0.1.0
Graphwake CI agent v0.1.0
First release of graphwake, the CI agent that sends your service's OpenAPI spec to Graphwake. Add one step to your pipeline; the agent works out what kind of build it is running in and acts on its own:
- Pull request builds: the spec is stored as a draft, so teams that use your API hear about breaking changes before they ship.
- Default-branch builds: the spec becomes the live spec and notifications go out. If the commit came from a pull request, that pull request's draft is settled as "merged".
- Anything else (feature branches, tags, unknown CI): nothing is sent.
The agent never fails your pipeline: it always exits 0 and prints one line saying what was sent or why nothing was. The ingest key is never printed.
Highlights
- Supported CI platforms: GitHub Actions, GitLab CI, Azure DevOps, Bitbucket Pipelines and Jenkins (multibranch). On any other CI you can set the context with
--pror--live. - Safe live publishing: before sending a live spec, the agent checks that the build is still the branch tip, so an old re-run or a pipeline that finishes out of order can't overwrite a newer spec.
- Merge detection: finds the merged pull request through the GitHub API, or from the platform's default merge commit message. This works for merge, squash and rebase merges.
- Configurable live branches:
--live-branch main,release/*(globs allowed). The default is the platform's default branch. - Spec from a file or a URL, in YAML or JSON, sent as is.
- Built-in integrations:
- GitHub Action:
graphwake/agent/github-action@v0.1.0 - GitLab CI template:
gitlab/graphwake.gitlab-ci.yml - Docker image:
ghcr.io/graphwake/agent:0.1.0 - The GitHub Action downloads the agent and checks its SHA-256 before running it.
- GitHub Action:
- Standard library only, no external Go dependencies.
Install
GitHub Actions
- uses: graphwake/agent/github-action@v0.1.0
with:
spec: openapi.json
key: ${{ secrets.GRAPHWAKE_KEY }}GitLab CI
include:
- remote: https://raw.githubusercontent.com/graphwake/agent/v0.1.0/gitlab/graphwake.gitlab-ci.yml
graphwake:
extends: .graphwake-upload
variables:
GRAPHWAKE_SPEC: openapi.jsonDocker (Jenkins, Bitbucket, anything else)
Pass your CI's environment variables through with -e so the agent can detect the build (see the README for the list for each platform):
docker run --rm -e GRAPHWAKE_KEY -v "$PWD:/w" -w /w ghcr.io/graphwake/agent:0.1.0 upload --spec openapi.jsonBinary
VERSION=0.1.0
BASE=https://github.com/graphwake/agent/releases/download/v$VERSION
ARCHIVE=graphwake_${VERSION}_linux_amd64.tar.gz
curl -fsSLO "$BASE/$ARCHIVE" && curl -fsSLO "$BASE/checksums.txt" &&
sha256sum --check --ignore-missing checksums.txt &&
tar -xzf "$ARCHIVE" graphwake &&
./graphwake upload --spec openapi.json || echo "graphwake: agent not run, spec not sent"See the README for every option and for per-platform setup.
Assets
| Platform | amd64 | arm64 |
|---|---|---|
| Linux | graphwake_0.1.0_linux_amd64.tar.gz |
graphwake_0.1.0_linux_arm64.tar.gz |
| macOS | graphwake_0.1.0_darwin_amd64.tar.gz |
graphwake_0.1.0_darwin_arm64.tar.gz |
| Windows | graphwake_0.1.0_windows_amd64.zip |
graphwake_0.1.0_windows_arm64.zip |
SHA-256 checksums are in checksums.txt. The multi-arch Docker image ghcr.io/graphwake/agent:0.1.0 (also :latest) is published for linux/amd64 and linux/arm64.
Notes
- Each ingest key belongs to one service. If a repository has several services, run the step once per service, each with its own spec and key.