서비스 데이터 API
서비스 데이터 API는 서비스 핑과 관련이 있습니다.
서비스 핑 데이터 내보내기
- GitLab 16.9에서 소개되었습니다.
 
‘read_service_ping’ 스코프가 있는 개인 액세스 토큰이 필요합니다.
Service Ping에서 수집된 JSON 페이로드를 반환합니다. 응용 프로그램 캐시에서 사용 가능한 페이로드 데이터가 없는 경우 빈 응답을 반환합니다. 페이로드 데이터가 비어 있는 경우 서비스 핑 기능이 활성화되어 있는지 확인하고 cron 작업이 실행되기를 기다리거나 매뉴얼으로 페이로드 데이터를 생성하기를 기다리세요.
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/usage_data/service_ping"
예시 응답:
  "recorded_at": "2024-01-15T23:33:50.387Z",
  "license": {},
  "counts": {
    "assignee_lists": 0,
    "ci_builds": 463,
    "ci_external_pipelines": 0,
    "ci_pipeline_config_auto_devops": 0,
    "ci_pipeline_config_repository": 0,
    "ci_triggers": 0,
    "ci_pipeline_schedules": 0
...
메트릭 정의를 단일 YAML 파일로 내보내기
- GitLab 13.11에서 소개되었습니다.
 
모든 메트릭 정의를 메트릭 사전과 유사한 단일 YAML 파일로 내보냄으로써 쉽게 가져올 수 있도록 합니다.
GET /usage_data/metric_definitions
예시 요청:
curl "https://gitlab.example.com/api/v4/usage_data/metric_definitions"
예시 응답:
---
- key_path: redis_hll_counters.search.i_search_paid_monthly
  description: 유료 라이선스를 통해 월별 검색을 수행한 고유 사용자 수를 계산함
  product_section: enablement
  product_stage: enablement
  product_group: global_search
  value_type: number
  status: active
  time_frame: 28d
  data_source: redis_hll
  distribution:
  - ee
  tier:
  - premium
  - ultimate
...
서비스 핑 SQL 쿼리 내보내기
이 작업은 usage_data_queries_api 피처 플래그 뒤에 숨겨져 있으며 GitLab 인스턴스 관리자 사용자만 사용할 수 있습니다.
- GitLab 13.11에서 소개되었습니다.
 - 기본적으로 비활성화된
 usage_data_queries_api피처 플래그 뒤에 배포되었습니다.
서비스 핑을 계산하는 데 사용된 모든 원시 SQL 쿼리를 반환합니다.
GET /usage_data/queries
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/usage_data/queries"
예시 응답:
{
  "recorded_at": "2021-03-23T06:31:21.267Z",
  "uuid": null,
  "hostname": "localhost",
  "version": "13.11.0-pre",
  "installation_type": "gitlab-development-kit",
  "active_user_count": "SELECT COUNT(\"users\".\"id\") FROM \"users\" WHERE (\"users\".\"state\" IN ('active')) AND (\"users\".\"user_type\" IS NULL OR \"users\".\"user_type\" IN (NULL, 6, 4))",
  "edition": "EE",
  "license_md5": "c701acc03844c45366dd175ef7a4e19c",
  "license_sha256": "366dd175ef7a4e19cc701acc03844c45366dd175ef7a4e19cc701acc03844c45",
  "license_id": null,
  "historical_max_users": 0,
  "licensee": {
    "Name": "John Doe1"
  },
  "license_user_count": null,
  "license_starts_at": "1970-01-01",
  "license_expires_at": "2022-02-23",
  "license_plan": "starter",
...
UsageDataNonSqlMetrics API
이 작업은 usage_data_non_sql_metrics 피처 플래그 뒤에 숨겨져 있으며 GitLab 인스턴스 관리자 사용자만 사용할 수 있습니다.
- GitLab 13.11에서 도입되었습니다.
 - 기본적으로 비활성화된
 usage_data_non_sql_metrics이라는 피처 플래그 뒤에 배포되었습니다.
서비스 ping에서 사용된 모든 비 SQL 메트릭 데이터를 반환합니다.
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/usage_data/non_sql_metrics"
샘플 응답:
{
  "recorded_at": "2021-03-26T07:04:03.724Z",
  "uuid": null,
  "hostname": "localhost",
  "version": "13.11.0-pre",
  "installation_type": "gitlab-development-kit",
  "active_user_count": -3,
  "edition": "EE",
  "license_md5": "bb8cd0d8a6d9569ff3f70b8927a1f949",
  "license_sha256": "366dd175ef7a4e19cc701acc03844c45366dd175ef7a4e19cc701acc03844c45",
  "license_id": null,
  "historical_max_users": 0,
  "licensee": {
    "Name": "John Doe1"
  },
  "license_user_count": null,
  "license_starts_at": "1970-01-01",
  "license_expires_at": "2022-02-26",
  "license_plan": "starter",
  "license_add_ons": {
    "GitLab_FileLocks": 1,
    "GitLab_Auditor_User": 1
  },
  "license_trial": null,
  "license_subscription_id": "0000",
  "license": {},
  "settings": {
    "ldap_encrypted_secrets_enabled": false,
    "operating_system": "mac_os_x-11.2.2"
  },
...
도움말