从主机返回排名的命名空间
在给定时间窗口内,按最高总执行时间(降序)排名,返回给定进程的命名空间子集。
路径参数
-
用于标识项目的唯一 24-十六进制数字字符串。 使用 /groups 端点检索身份验证的用户有权访问权限的所有项目。
注意:群组和项目是同义词。您的群组 ID 与项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。资源和相应的端点使用“群组”一词。
格式应符合以下模式:
^([a-f0-9]{24})$
。 -
为 MongoDB 进程提供服务的主机名和 IANA 端口的组合。主机必须是运行 MongoDB 进程(mongod 或 mongos)的主机的主机名、完全限定域名 (FQDN) 或 Internet 协议地址(IPv4 或 IPv6)。该端口必须是 MongoDB 进程侦听请求的 IANA 端口。
格式应符合以下模式:
^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$
。
查询参数
-
指示应用程序是否将响应包装在
envelope
JSON 对象中的标志。某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,请在查询中设置 Envelope=true。返回结果列表的端点将结果对象用作 envelope。应用程序将状态参数添加到响应正文中。默认值为
false
。 -
MongoDB Cloud 开始报告指标的日期和时间。此参数以 UTC 格式的 ISO 8601 时间戳表示其值。未设置周期时,请包含此参数。
-
MongoDB Cloud 停止报告指标的日期和时间。此参数以 UTC 格式的 ISO 8601 时间戳表示其值。未设置周期时,请包含此参数。
-
Atlas 报告指标的持续时间。此参数以 UTC 格式的 ISO 8601 持续时间格式表示其值。在未设置开始和结束时包含此参数。
atlas api collectionLevelMetrics getGroupProcessCollStatNamespaces --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20241113001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.GetGroupProcessCollStatNamespacesApiParams{}
sdkResp, httpResp, err := client.CollectionLevelMetricsApi.
GetGroupProcessCollStatNamespacesWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2024-11-13+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/processes/{processId}/collStats/namespaces?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2024-11-13+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/processes/{processId}/collStats/namespaces?pretty=true"
{
"groupId": "32b6e34b3d91647abb20e7b8",
"identifierId": "string",
"rankedNamespaces": [
"string"
]
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}