서비스 핑 API
Offering: GitLab Self-Managed, GitLab Dedicated
이 API를 사용하여 GitLab 서비스 핑 프로세스와 상호작용합니다. 서비스 핑에서 수집된 JSON 페이로드를 내보냅니다. 서비스 핑 JSON 페이로드에는 schema_inconsistencies_metric이 포함됩니다.
이 API를 사용하여 GitLab 서비스 핑 프로세스와 상호작용합니다.
서비스 핑 데이터 내보내기#
히스토리
- GitLab 16.9에서 도입되었습니다.
서비스 핑에서 수집된 JSON 페이로드를 내보냅니다. 애플리케이션 캐시에 사용 가능한 페이로드 데이터가 없으면 빈 응답을 반환합니다. 페이로드 데이터가 비어 있으면 서비스 핑 기능이 활성화되어 있는지 확인하고 cron 작업이 실행되기를 기다리거나 페이로드 데이터를 수동으로 생성하세요.
사전 조건:
read_service_ping범위가 있는 개인 액세스 토큰으로 인증해야 합니다.
GET /usage_data/service_ping
요청 예시:
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "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
...
schema_inconsistencies_metric 해석#
서비스 핑 JSON 페이로드에는 schema_inconsistencies_metric이 포함됩니다. 데이터베이스 스키마 불일치는 예상되는 것이며 인스턴스 문제를 나타낼 가능성이 낮습니다.
이 메트릭은 진행 중인 문제 해결에만 사용하도록 설계되었으며 정기적인 상태 확인으로 사용해서는 안 됩니다. 이 메트릭은 GitLab 지원의 안내에 따라서만 해석해야 합니다. 이 메트릭은 데이터베이스 스키마 검사기 Rake 작업과 동일한 데이터베이스 스키마 불일치를 보고합니다.
자세한 내용은 이슈 467544를 참조하세요.
메트릭 정의 내보내기#
쉽게 가져올 수 있도록 메트릭 사전과 유사하게 모든 메트릭 정의를 단일 YAML 파일로 내보냅니다.
GET /usage_data/metric_definitions
요청 예시:
curl --request GET \
--url "https://gitlab.example.com/api/v4/usage_data/metric_definitions"
응답 예시:
---
- key_path: redis_hll_counters.search.i_search_paid_monthly
description: Calculated unique users to perform a search with a paid license enabled
by month
product_group: global_search
value_type: number
status: active
time_frame: 28d
data_source: redis_hll
tier:
- premium
- ultimate
...
모든 서비스 핑 SQL 쿼리 목록 조회#
서비스 핑을 계산하는 데 사용되는 모든 원시 SQL 쿼리를 나열합니다. 이 작업은 usage_data_queries_api 기능 플래그 뒤에 있으며 GitLab 인스턴스 관리자 사용자에게만 사용 가능합니다.
GET /usage_data/queries
요청 예시:
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "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",
"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"
},
"counts": {
"assignee_lists": "SELECT COUNT(\"lists\".\"id\") FROM \"lists\" WHERE \"lists\".\"list_type\" = 3",
"boards": "SELECT COUNT(\"boards\".\"id\") FROM \"boards\"",
"ci_builds": "SELECT COUNT(\"ci_builds\".\"id\") FROM \"ci_builds\" WHERE \"ci_builds\".\"type\" = 'Ci::Build'",
"ci_internal_pipelines": "SELECT COUNT(\"ci_pipelines\".\"id\") FROM \"ci_pipelines\" WHERE (\"ci_pipelines\".\"source\" IN (1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13) OR \"ci_pipelines\".\"source\" IS NULL)",
"ci_external_pipelines": "SELECT COUNT(\"ci_pipelines\".\"id\") FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"source\" = 6",
"ci_pipeline_config_auto_devops": "SELECT COUNT(\"ci_pipelines\".\"id\") FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"config_source\" = 2",
"ci_pipeline_config_repository": "SELECT COUNT(\"ci_pipelines\".\"id\") FROM \"ci_pipelines\" WHERE \"ci_pipelines\".\"config_source\" = 1",
"ci_runners": "SELECT COUNT(\"ci_runners\".\"id\") FROM \"ci_runners\"",
...
모든 비SQL 메트릭 목록 조회#
서비스 핑에 사용되는 모든 비SQL 메트릭 데이터를 나열합니다. 이 작업은 usage_data_non_sql_metrics 기능 플래그 뒤에 있으며 GitLab 인스턴스 관리자 사용자에게만 사용 가능합니다.
GET /usage_data/non_sql_metrics
요청 예시:
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "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"
},
...
내부 이벤트 추적#
GitLab 인스턴스에서 내부 이벤트를 추적합니다.
사전 조건:
api또는ai_workflows범위가 있는 개인 액세스 토큰으로 인증해야 합니다.
POST /usage_data/track_event
Snowplow로 이벤트를 추적하려면 send_to_snowplow 매개변수를 true로 설정하세요.
요청 예시:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--request POST \
--data '{
"event": "mr_name_changed",
"send_to_snowplow": true,
"namespace_id": 1,
"project_id": 1,
"additional_properties": {
"lang": "eng"
}
}' \
--url "https://gitlab.example.com/api/v4/usage_data/track_event"
여러 이벤트 추적이 필요한 경우 /track_events 엔드포인트에 이벤트 배열을 전송하세요:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--request POST \
--data '{
"events": [
{
"event": "mr_name_changed",
"namespace_id": 1,
"project_id": 1,
"additional_properties": {
"lang": "eng"
}
},
{
"event": "mr_name_changed",
"namespace_id": 2,
"project_id": 2,
"additional_properties": {
"lang": "eng"
}
}
]
}' \
--url "https://gitlab.example.com/api/v4/usage_data/track_events"
