Monocle icon

Monocle

Interact with Monocle API

Actions7

Overview

The node interacts with the Monocle API to perform search queries on a specified data index. Specifically, for the Search resource and Query operation, it runs predefined query types or custom query strings against a chosen index in Monocle. This is useful for extracting insights from code repositories, author activities, change metrics, and review statistics.

Common scenarios include:

  • Retrieving summaries of repository changes.
  • Identifying top authors by various activity metrics (created, merged, reviewed, commented changes).
  • Gathering statistics on change reviews, lifecycle, and active authors.
  • Analyzing commit and review histograms over time.
  • Comparing commits versus reviews ratios.

Practical example:

  • A user wants to get the top authors who created changes in the last month across a specific workspace index. They select the "Search" resource, "Query" operation, choose the relevant index, pick the "Top Authors Changes Created" query type, and optionally provide a custom query string to filter results.

Properties

Name Meaning
Index The workspace or data index to run the query against. Can be selected from a list loaded dynamically or specified as a string.
Query Type The type of predefined query to execute. Options include:
- Change
- Repos Summary
- Top Authors Changes Created
- Top Authors Changes Merged
- Top Authors Changes Reviewed
- Top Authors Changes Commented
- Top Reviewed Authors
- Top Commented Authors
- Top Authors Peers
- New Changes Authors
- Changes Review Stats
- Changes Lifecycle Stats
- Active Authors Stats
- Change And Events
- Changes Tops
- Ratio Commits Vs Reviews
- Histo Commits
- Histo Reviews And Comments
Query A custom query string similar to what is used in the Monocle URL, allowing fine-grained filtering of the data. Defaults to "from:now-3weeks" if not specified.

Output

The output JSON contains the result of the executed query. Its structure depends on the selected query type but generally includes aggregated metrics, lists of authors, change events, or statistical summaries related to the queried data index.

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to the Monocle API endpoint (https://demo.changemetrics.io by default).
  • Needs an API authentication credential configured in n8n to authorize requests to Monocle.
  • Dynamic loading of available indexes and metrics depends on Monocle API responses.

Troubleshooting

  • Common issues:
    • Invalid or missing API credentials will cause authentication failures.
    • Specifying an incorrect or unavailable index may result in empty or error responses.
    • Using unsupported or malformed query strings can lead to query errors.
  • Error messages:
    • Authentication errors typically indicate invalid or expired API keys; reconfigure credentials.
    • "Index not found" or similar errors suggest verifying the index name or loading options.
    • Query syntax errors require checking the query string format according to Monocle's query language.

Links and References

Discussion