1
0
mirror of synced 2025-12-23 21:07:12 -05:00
Files
docs/content/rest/reference/metrics.md
Rachael Sewell a340162d84 reorganize repository apis (#23728)
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2022-01-11 11:53:12 +10:00

2.4 KiB

title, intro, allowTitleToDifferFromFilename, redirect_from, versions, topics, miniTocMaxHeadingLevel
title intro allowTitleToDifferFromFilename redirect_from versions topics miniTocMaxHeadingLevel
Metrics The repository metrics API allows you to retrieve community profile, statistics, and traffic for your repository. true
/rest/reference/repository-metrics
fpt ghes ghae ghec
* * * *
API
3

{% for operation in currentRestOperations %} {% unless operation.subcategory %}{% include rest_operation %}{% endunless %} {% endfor %}

{% ifversion fpt or ghec %}

Community

{% for operation in currentRestOperations %} {% if operation.subcategory == 'community' %}{% include rest_operation %}{% endif %} {% endfor %}

{% endif %}

Statistics

The Repository Statistics API allows you to fetch the data that {% data variables.product.product_name %} uses for visualizing different types of repository activity.

A word about caching

Computing repository statistics is an expensive operation, so we try to return cached data whenever possible. If the data hasn't been cached when you query a repository's statistics, you'll receive a 202 response; a background job is also fired to start compiling these statistics. Give the job a few moments to complete, and then submit the request again. If the job has completed, that request will receive a 200 response with the statistics in the response body.

Repository statistics are cached by the SHA of the repository's default branch; pushing to the default branch resets the statistics cache.

Statistics exclude some types of commits

The statistics exposed by the API match the statistics shown by different repository graphs.

To summarize:

  • All statistics exclude merge commits.
  • Contributor statistics also exclude empty commits.

{% for operation in currentRestOperations %} {% if operation.subcategory == 'statistics' %}{% include rest_operation %}{% endif %} {% endfor %}

{% ifversion fpt or ghec %}

Traffic

For repositories that you have push access to, the traffic API provides access to the information provided in your repository graph. For more information, see "Viewing traffic to a repository."

{% for operation in currentRestOperations %} {% if operation.subcategory == 'traffic' %}{% include rest_operation %}{% endif %} {% endfor %} {% endif %}