Monocle icon

Monocle

Interact with Monocle API

Actions7

Overview

The node interacts with the Monocle API to retrieve metrics data. Specifically, for the Metric - Get operation, it fetches metric values based on a workspace index, a specific metric identifier, and an optional query string. It can return either the current value or a time series trend of the metric over specified intervals.

This node is useful in scenarios where you want to programmatically access software development metrics such as code changes, reviews, or other productivity indicators tracked by Monocle. For example, you might use it to:

  • Retrieve the latest value of a particular metric for a given workspace.
  • Obtain historical trends (hourly, daily, weekly, etc.) of a metric to analyze performance over time.
  • Automate reporting workflows that include metric data from Monocle.

Properties

Name Meaning
Index Workspace selection: choose from a list of available workspaces or specify one via string input.
Metric Name or ID The specific metric to retrieve, selectable from a list or specified by ID using an expression.
Query A query string similar to what is used in the Monocle URL, filtering the data scope (e.g., timeframe).
Trend Interval Defines if the output should be a single current value or a time series. Options:
- 0 - None (current value only)
- 1 - Auto (automatic interval)
- 2 - Hourly
- 3 - Daily
- 4 - Weekly
- 5 - Monthly
- 6 - Yearly

Output

The node outputs JSON data representing the requested metric information:

  • For the Get operation, the json field contains the metric data returned by the Monocle API.
  • If a trend interval is specified (other than "none"), the output includes a time series of metric values aggregated according to the chosen interval.
  • If no trend is requested, the output provides the current metric value.
  • The structure of the JSON depends on the Monocle API response but generally includes metric values, timestamps (for trends), and metadata about the metric.

The node does not output binary data.

Dependencies

  • Requires an active connection to the Monocle API endpoint (https://demo.changemetrics.io).
  • Needs an API authentication credential configured in n8n to authorize requests.
  • Uses internal helper functions to load options dynamically for workspaces and metrics.

Troubleshooting

  • Common issues:

    • Invalid or missing workspace index may cause the API request to fail.
    • Specifying a metric that does not exist or is unavailable in the selected workspace will result in empty or error responses.
    • Incorrect query strings may lead to unexpected results or errors.
    • Selecting an unsupported trend interval could cause the API to reject the request.
  • Error messages:

    • API errors are propagated and may include HTTP status codes and messages from Monocle.
    • If the node is set to continue on failure, errors are attached to the output item under an error property.
    • To resolve errors, verify credentials, ensure correct workspace and metric selections, and validate query syntax.

Links and References

Discussion