Forge Custom Metrics is now available as part of Forge Early Access Program (EAP). To start testing this feature, sign up using this form.
Forge Custom Metrics is an experimental feature offered to selected users for testing and feedback purposes. This feature is unsupported and subject to change without notice
For more details, see Forge EAP, Preview, and GA.
Custom metrics allow you to track specific events, actions, and measurements within your Forge app. This enables you to monitor business-specific KPIs and instrument critical paths within your app code.
Only users with admin role can register, edit, and delete custom metrics.
To view custom metrics:
Access the developer console.
Select the Forge app that you want to view metrics for.
Select Metrics in the left menu.
Select Custom in the left menu.
To start using custom metrics for your app, you need to register them in the developer console.
To register a custom metric:
Select Custom in the left menu under Metrics.
Click Register metric.
Enter a name and description for your metric. For example, jira-actions-success
.
Select Register.
After a custom metric is registered, it may take up to 15 minutes before the metric is ingested into the system.
Before proceeding further, ensure you have registered the custom metric for your app already.
Install the Forge metrics package by running this command in your terminal:
1 2npm install @forge/metrics
Use the metrics package installed above in your app code:
1 2import { internalMetrics } from '@forge/metrics';
Implement the custom metrics logic in your code. For example:
1 2export const run = async (payload, context) => { const counter = internalMetrics.counter('jira-actions-success'); // Name should exactly match as registered in developer console const jiraIssues = await fetch(...); counter.incr(); // Increment by 1 // Or increment by a specific value counter.incrBy(value); for (const issue of jiraIssues) { .... } };
The metric name in your app code must match the metric name registered in the developer console.
Deploy your app using the Forge CLI by running:
1 2forge deploy
View the instrumented custom metric in the developer console.
Once deleted, custom metric ingestion will be stopped immediately. However, you will still have access to historical data up to 14 days in the past.
To delete a custom metric:
Use these filters to refine your metrics:
Environment: Narrows down the metrics for a specific app environment for your app.
Date: Narrows down the metrics based on your chosen time interval. Choose from a range of predefined values, such as the Last 24 hours, or choose a more specific time interval using the Custom option.
Sites: Narrows down the metrics based on the sites that your app is installed onto, for example,
<your-site>.atlassian.net
. You can select multiple sites.
Major App Versions: Narrows down the metrics based on the major version of your app.
Function names: Narrows down the metrics based on the function name from where the custom metric is emitted.
Rate this page: