Custom Metrics
sfp provides multiple ways to enhance your metrics with custom data:
Report custom metrics using the
metrics:reportcommandAdd organization-wide custom tags to all metrics (sfp-pro only)
sfp metrics report
sfp metrics reportReport a custom metric to any sfp supported metric provider
USAGE
$ @flxbl-io/sfp metrics report -m <value> -t gauge|counter|timer [-v <value>] [-g <value>] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-g, --tags=<value> tags for metric
-m, --metric=<value> (required) metrics to publish
-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>
DESCRIPTION
Report a custom metric to any sfp supported metric provider
EXAMPLES
$ sfp metrics:report -m <metric> -t <type> -v <value>Custom Tags Configuration
Availability
✅
❌
From
August 25
sfp-pro allows you to configure custom tags that will be automatically added to ALL metrics sent by sfp. This is useful for adding consistent organizational metadata without modifying individual commands.
Setting Custom Tags
Use the sfp config set command with the custom-tag.* prefix:
Viewing Custom Tags
To see all configured custom tags:
Removing Custom Tags
Scope of Custom Tags
Custom tags follow the standard sfp configuration hierarchy:
Global tags: Set without
--scope local, applies to all projectsProject-specific tags: Set with
--scope local, applies only to current projectProject tags override global tags when both are present
How Custom Tags Work
Automatic Inclusion: Custom tags are automatically added to every metric sent by sfp
Tag Precedence: Command-specific tags override custom tags if there's a conflict
GitHub Integration: Repository tags are automatically added when running in GitHub Actions
Backend Support: Works with all supported metrics backends (StatsD, DataDog, NewRelic, Splunk)
Example Workflow
Use Cases
Team Attribution
Track metrics by team for resource allocation and performance monitoring:
Multi-Environment Tracking
Differentiate metrics across environments:
Cost Center Tracking
Associate metrics with cost centers for chargeback:
Project Metadata
Add project-specific context:
Best Practices
Establish Naming Conventions: Define standard tag names across your organization
Use Hierarchical Tags: Organize tags logically (e.g.,
team,squad,project)Automate Tag Configuration: Set tags in CI/CD pipeline initialization
Document Required Tags: Maintain a list of required tags for your organization
Regular Audits: Periodically review and clean up unused tags
CI/CD Integration
Configure custom tags in your CI/CD pipeline:
GitHub Actions
Jenkins
Azure DevOps
Limitations
Custom tags are loaded once at command initialization
Tag values must be strings
Tag names should follow your metrics backend's naming conventions
Maximum number of tags depends on your metrics backend limitations
Note: Custom tags are only available in sfp-pro edition. Community edition users must add tags manually to each command or upgrade to sfp-pro.
Last updated