ezgh obs datasets sampling set <dataset> -f <policy.json> [--force] [flags]Replace a dataset’s trace sampling policy with a JSON file (-f - reads stdin):
{ "enabled": true, "decisionWait": "30s",
"rules": [ { "name": "errors", "when": { "status": "error" }, "keep": "all" } ],
"default": { "percent": 5 } }Rules are tried in order and the first that matches decides the whole trace; default decides when none does, and is required when enabled is true. A rule keeps “all”, “none”, { “percent”: p } (0.01 to 100) or { “perSecond”: n } (1 to 10,000). obs-api checks the policy and refuses one out of bounds, saying where. The file can be the output of ezgh obs datasets sampling get -o json: its policy is taken.
It’s sent with the ETag ezgh reads just before: if someone changed the policy in between, nothing changes, and ezgh says so. A file from get -o json carries the version it was read at: when the policy has changed since (someone saved another version while you edited), ezgh refuses and changes nothing. --force sends no ETag, overwriting whatever is there.
Part of ezgh obs datasets sampling.
Examples
ezgh obs datasets sampling set production -f sampling.json
ezgh obs datasets sampling set staging -f - --force < sampling.jsonFlags
| Flag | Type | Default | Description |
|---|---|---|---|
-f, --file |
string | the policy’s JSON file, or - for stdin | |
--force |
boolean | send no ETag: overwrite the policy even if it changed since it was read |
This command also takes the global flags.