Metric topics are compatible with the Prometheus metrics data model and the following APIs:
Metrics Query API
Prometheus HTTP API
Compatible with the following HTTP APIs and commonly used for integration with Grafana.
Instant queries : /api/v1/query
Range queries : /api/v1/query_range
Finding series by label matchers : /api/v1/series
Getting label names : /api/v1/labels
Querying label values : /api/v1/label/<label_name>/values
Querying exemplars : /api/v1/query_exemplars
Not compatible with APIs used for native Prometheus collection configurations, alarm rules, and cluster management features, such as Targets, Rules, Alerts, Querying target metadata, Querying metric metadata, Alertmanagers, Status, TSDB Admin APIs.
Directions for integration with Grafana:
1. On the Grafana Data Sources page, click Add data source.
2. Select Prometheus, and configure the following information in the form:
Search for the required CAM policy as needed, and click to complete policy association. URL: Replace ${region} and ${topicId} where ${region} represents the region abbreviation, and ${topicId} represents the metric topic ID. Public network address: https://${region}.cls.tencentcs.com/prometheus/${topicId}
Private network address: https://${region}.cls.tencentyun.com/prometheus/${topicId}
Basic auth: Turn on this switch.
Basic Auth Details: The API uses Basic Auth for authentication. Use the SecretId and SecretKey from the API Key as the username and password, respectively. username:${SecretId}
password:${SecretKey}
Note:
It is recommended to create a separate sub-account and use the SecretId and SecretKey of that account. Grant this account only the following permissions to ensure security. For configuration details, see Sub-account Authorization. {
"version": "2.0",
"statement": [
{
"effect": "allow",
"action": [
"cls:MetricsSeries",
"cls:MetricsQueryExemplars",
"cls:MetricsLabelValues",
"cls:MetricsQueryRange",
"cls:MetricsLabels",
"cls:MetricsQuery"
],
"resource": [
"*"
]
}
]
}
Manage alerts via Alerting UI: Turn off this switch. CLS is not compatible with Prometheus Alerts-related APIs and does not support this feature.
3. Click Save & Test at the bottom to test whether the configuration is correct and to save the settings.
Prometheus Remote Read API
url: https://${region}.cls.tencentcs.com/prometheus/${topicId}/api/v1/read
basic_auth:
username: ${SecretId
}
password: ${SecretKey
}
In the URL, ${region} represents the region abbreviation, and ${topicId} represents the metric topic ID. The API uses Basic Auth for authentication. Use the SecretId and SecretKey from the API Key as the username and password, respectively. username:${SecretId}
password:${SecretKey}
Note:
It is recommended to create a separate sub-account and use the SecretId and SecretKey of that account. Grant this account only the following permissions to ensure security. For configuration details, see Sub-account Authorization. {
"version": "2.0",
"statement": [
{
"effect": "allow",
"action": [
"cls:MetricsRemoteRead"
],
"resource": [
"*"
]
}
]
}
Metrics Reporting API
Prometheus Remote Write API
This API is commonly used to collect and report metrics to the metric topics by using various collectors compatible with the Prometheus Remote Write protocol, such as vmagent and telegraf. Metrics from a local Prometheus instance can also be reported to metric topics via this API. For detailed instructions, see Metric Reporting.
문제 해결에 도움이 되었나요?