2024-01-14 12:30:33 +02:00

3.9 KiB

peertube.StatsApi

All URIs are relative to https://peertube2.cpy.re

Method HTTP request Description
api_v1_metrics_playback_post POST /api/v1/metrics/playback Create playback metrics
get_instance_stats GET /api/v1/server/stats Get instance stats

api_v1_metrics_playback_post

api_v1_metrics_playback_post(playback_metric_create=playback_metric_create)

Create playback metrics

These metrics are exposed by OpenTelemetry metrics exporter if enabled.

Example

import peertube
from peertube.models.playback_metric_create import PlaybackMetricCreate
from peertube.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
    host = "https://peertube2.cpy.re"
)


# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = peertube.StatsApi(api_client)
    playback_metric_create = peertube.PlaybackMetricCreate() # PlaybackMetricCreate |  (optional)

    try:
        # Create playback metrics
        api_instance.api_v1_metrics_playback_post(playback_metric_create=playback_metric_create)
    except Exception as e:
        print("Exception when calling StatsApi->api_v1_metrics_playback_post: %s\n" % e)

Parameters

Name Type Description Notes
playback_metric_create PlaybackMetricCreate [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_instance_stats

ServerStats get_instance_stats()

Get instance stats

Get instance public statistics. This endpoint is cached.

Example

import peertube
from peertube.models.server_stats import ServerStats
from peertube.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://peertube2.cpy.re
# See configuration.py for a list of all supported configuration parameters.
configuration = peertube.Configuration(
    host = "https://peertube2.cpy.re"
)


# Enter a context with an instance of the API client
with peertube.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = peertube.StatsApi(api_client)

    try:
        # Get instance stats
        api_response = api_instance.get_instance_stats()
        print("The response of StatsApi->get_instance_stats:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling StatsApi->get_instance_stats: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

ServerStats

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation -

[Back to top] [Back to API list] [Back to Model list] [Back to README]