Overview
This node integrates with the SonarQube or SonarCloud API to retrieve information about software quality metrics and components. Specifically, for the Metrics resource with the Search operation, it allows users to search for available metrics in SonarQube. This is useful when you want to explore or filter the set of metrics that SonarQube tracks, such as bugs, code smells, coverage, complexity, etc.
Common scenarios include:
- Discovering which metrics are available for analysis in your SonarQube instance.
- Paginating through large sets of metrics to find specific ones by name or key.
- Automatically fetching all metrics without manual pagination.
Practical example:
- A user wants to list all metrics related to code quality to decide which ones to monitor or report on in their CI/CD pipeline.
Properties
| Name | Meaning |
|---|---|
| Page (p) | The page number of results to fetch. Must be 1 or greater. |
| Page Size (ps) | Number of metrics to return per page. Minimum 1, maximum 500. |
| Get All? (scroll) | If enabled, automatically fetches all pages of results, returning the complete list. |
Output
The output JSON contains the response from the SonarQube API's /api/metrics/search endpoint. It includes a list of metric objects under the metrics key. Each metric object typically contains details such as the metric key, name, description, domain, type, and other metadata describing the metric.
If the "Get All?" option is enabled, the node returns a combined array of all metrics across all pages.
No binary data is produced by this operation.
Dependencies
- Requires an API authentication credential for SonarQube or SonarCloud configured in n8n.
- Access to the SonarQube server's API endpoint.
- No additional external dependencies beyond the SonarQube API.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication errors.
- Requesting a page number or page size outside allowed ranges may result in API errors.
- Network connectivity issues to the SonarQube server can cause request failures.
Error messages:
- Authentication errors: Ensure the API key or token is valid and has sufficient permissions.
- Pagination errors: Verify that "Page" and "Page Size" values are within allowed limits.
- Rate limiting or server errors: Retry after some time or check SonarQube server status.
Links and References
- SonarQube Metrics API Documentation
- SonarQube Web API (replace with your instance URL)
