Skip to main content

Documentation Index

Fetch the complete documentation index at: https://bilanc.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Pull Request Metrics

Pull request metrics provide insights into the volume, size, productivity, and interactions of pull requests in your repositories.

Available Metrics

pull-requests-count
string
Number of pull requests
pull-requests-size
string
Size of pull requests (additions + deletions)
review-rate
string
Percentage of PRs that received at least one review
complexity-score
string
Code complexity score of pull requests
contributors-count
string
Number of unique contributors
reviews-count
string
Number of reviews submitted
review-interactions-count
string
Number of review interactions
review-rounds
string
Number of review rounds per PR
reviewers-per-pr
string
Average number of reviewers per PR
active-reviewers
string
Number of distinct reviewers in the period
changes-requested-rate
string
Rate of reviews that requested changes
comment-interactions-count
string
Comment interaction count
comments-count
string
Number of comments
comments-per-pr
string
Average number of comments per PR
commit-interactions-count
string
Commit interaction count
commits-count
string
Number of commits

Pull Requests Count Metric

This endpoint provides the count of pull requests based on specified filters.
curl -X POST 'https://api.bilanc.co/metrics/pull-requests-count' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "pr_states": ["merged", "closed"],
      "start_date": "2023-01-01",
      "end_date": "2023-01-02"
    },
    "group_by": ["repository", "pr_state"],
    "date_level": "day",
    "date_field": "created_at",
  }'

Pull Requests Size Metric

This endpoint provides information about the size of pull requests.
curl -X POST 'https://api.bilanc.co/metrics/pull-requests-size' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "start_date": "2023-01-01",
      "end_date": "2023-12-31"
    },
    "group_by": ["repository"],
    "aggregation": "sum",
    "date_field": "created_at"
  }'

Complexity Score Metric

This endpoint provides the complexity score of pull requests, which measures code complexity introduced per PR.
curl -X POST 'https://api.bilanc.co/metrics/complexity-score' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "team": ["team123"],
      "start_date": "2023-01-02",
      "end_date": "2023-01-31"
    },
    "date_level": "week",
    "aggregation": "AVG",
    "date_field": "merged_at"
  }'

Parameter Notes

date_field
string
For pull request metrics, the following date fields are available:
  • created_at: When the PR was created
  • merged_at: When the PR was merged
  • closed_at: When the PR was closed
aggregation
string
Required for non-count metrics. Accepted values: SUM, MAX, MIN, AVG. Count-based metrics (pull-requests-count, reviews-count, comments-count, commits-count, review-interactions-count, comment-interactions-count, commit-interactions-count, review-rounds, active-reviewers, reviewers-per-pr, review-rate, changes-requested-rate, comments-per-pr, contributors-count) do not require an aggregation.

Common Use Cases

  • Monitor PR Volume: Track the number of PRs created over time
  • Identify Large PRs: Find PRs that are above a certain size threshold using metric_min_value
  • Analyze Review Culture: Track review rate and comments per PR
  • Assess productivity Trends: Monitor if code productivity is increasing or decreasing over time
  • Team Comparison: Compare PR metrics across different teams or repositories