gpt4 book ai didi

logging - 无法使用基于日志的指标(指标类型 : "Counter")

转载 作者:行者123 更新时间:2023-12-05 02:56:29 26 4
gpt4 key购买 nike

我正在努力创建一个图表,其中包含基于日志的指标的 Stackdriver 监控。我的指标是默认没有单位的计数器。
日志可用于我的基于日志的指标,但是当我使用我的指标创建图表时,它显示no data is available for the...
这是我的指标,它确实有效(称为 isOperatorAllowed):

resource.type="container"
resource.labels.namespace_id="default"
jsonPayload.message="CaseForOperator flags"
logName="projects/PROJECT-ID/logs/app"
jsonPayload.caseForOperatorFlags.isOperatorAllowed=true

这是我的图表的 JSON 配置

{
"dataSets": [
{
"timeSeriesFilter": {
"filter": "metric.type=\"logging.googleapis.com/user/IsOperatorAllowed\" resource.type=\"gke_container\"",
"perSeriesAligner": "ALIGN_RATE",
"crossSeriesReducer": "REDUCE_NONE",
"secondaryCrossSeriesReducer": "REDUCE_NONE",
"minAlignmentPeriod": "60s",
"groupByFields": [],
"unitOverride": "1"
},
"targetAxis": "Y1",
"plotType": "LINE"
}
],
"options": {
"mode": "COLOR"
},
"constantLines": [],
"timeshiftDuration": "0s",
"y1Axis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}

有人知道我做错了什么吗?

最佳答案

经过讨论和帮助,答案是:
基于日志的指标在创建后仅采用日志。因此,如果您的日志早于指标创建时间戳,它们将不会出现在指标计数/分布中

示例:

Metric: `03/06/2020 15:55:33`
log 1: `02/06/2020 12:00:00`
log 2: `07/06/2020 12:00:00`

Metric count result: 1 (it will be the log 2)

这里说的是 documentation :

New log entries might not match your metric's logs query. A logs-based metric gets data from matching log entries that are received after the metric is created. Logging does not backfill the metric from previous log entries.

关于logging - 无法使用基于日志的指标(指标类型 : "Counter"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60486112/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com