codevsfp CLIsfp serverlibraries

Metrics

Query and display metrics from sfp server

sfp metrics display

Display a summary of key metrics from the SFP server

USAGE
  $ sfp metrics display [--json] [-c build|deploy|validate|release|prepare|all] [-d <value>] [--repository <value>]
    [-e <value>] [-t <value>] [--sfp-server-url <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -c, --category=<option>          [default: all] Metric category to display
                                   <options: build|deploy|validate|release|prepare|all>
  -d, --days=<value>               [default: 30] Number of days to query (default: 30)
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Display a summary of key metrics from the SFP server

EXAMPLES
  $ sfp metrics:display

  $ sfp metrics:display --category build

  $ sfp metrics:display --category deploy --days 7

  $ sfp metrics:display --category all --days 90

See code: src/commands/metrics/display.ts

sfp metrics query

Query metrics from the SFP server

USAGE
  $ sfp metrics query [--json] [-n <value> | -q <value> | -l <value>] [-r <value>] [--package <value>] [--org
    <value>] [--branch <value>] [--start <value>] [--end <value>] [--step <value>] [--repository <value>] [-e <value>]
    [-t <value>] [--sfp-server-url <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -l, --label=<value>              Get distinct values for a label (e.g., __name__, package, org)
  -n, --name=<value>               Metric name to query (e.g., build.duration, package.created). Supports wildcards like
                                   "build.*"
  -q, --query=<value>              Raw MetricsQL/PromQL query expression for advanced queries
  -r, --range=<value>              [default: 1h] Time range to query (default: 1h). Options: 5m, 15m, 30m, 1h, 3h, 6h,
                                   12h, 24h, 2d, 7d, 30d
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
      --branch=<value>             Filter by branch name (used with --name)
      --end=<value>                Range end (RFC3339 or unix seconds). Overrides --range.
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --org=<value>                Filter by target org (used with --name)
      --package=<value>            Filter by package name (used with --name)
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url
      --start=<value>              Range start (RFC3339 or unix seconds). Overrides --range.
      --step=<value>               Step/resolution for range queries (e.g., 30s, 1m, 1h)

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Query metrics from the SFP server

EXAMPLES
  $ sfp metrics:query -n build.duration

  $ sfp metrics:query -n "build.*" --range 1h

  $ sfp metrics:query -n package.created --package salespkg --range 24h

  $ sfp metrics:query -q "sum(sfpowerscripts_build_completed)" --start 2024-01-01T00:00:00Z --end 2024-01-02T00:00:00Z --step 1h

  $ sfp metrics:query --label __name__

See code: src/commands/metrics/query.ts

sfp metrics report

Report a custom metric to any sfp supported metric provider

USAGE
  $ sfp metrics report -m <value> -t gauge|counter|timer [--json] [-v <value>] [-g <value>] [--repository <value>]
    [-e <value>] [-t <value>] [--sfp-server-url <value>] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>              Email address for authenticated user. Ignored if --application-token is provided. Can
                                   be set via SFP_SERVER_USER env var.
  -g, --tags=<value>               tags for metric (JSON format)
  -m, --metric=<value>             (required) metrics to publish
  -t, --application-token=<value>  Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                   (CLI flags take precedence over env vars).
  -t, --type=<option>              (required) type of metric
                                   <options: gauge|counter|timer>
  -v, --value=<value>              value of metric
      --loglevel=<option>          [default: info] logging level for this command invocation
                                   <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --repository=<value>         The repository identifier. E.g `owner/repo` for GitHub/GitLab or `org/project/repo`
                                   for Azure DevOps
      --sfp-server-url=<value>     URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                   config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Report a custom metric to any sfp supported metric provider

EXAMPLES
  $ sfp metrics:report -m <metric> -t <type> -v <value>

  $ sfp metrics:report -m build.duration -t timer -v 12000 --sfp-server-url http://localhost:3029 -e dev@flxbl.io

See code: src/commands/metrics/report.ts

On this page