-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
monitoring/resource_monitoring_dashboard.go:37 -> "panic: runtime error: index out of range [x] with length x" #16439
monitoring/resource_monitoring_dashboard.go:37 -> "panic: runtime error: index out of range [x] with length x" #16439
Comments
Nothing the tf apply also gives the same panic error. I could resolve this manually by going to Google cloud console, open the created monitoring dashboard, manually delete the metrics that were intended to be removed from the json, then tf plan and apply can work. So perhaps some code counted or removed stuff wrongly, causing the index out of bounds. |
@liufuyang this could be a known issue. Take a look at #15676 to see if that make sense. Unfortunately we don't have a lot of options to work around this, as it's a restriction at the SDK level |
Thank you. Yeah I saw that one, but it was mentioned to be related to system version? I am on an arm64 machine and also using arm64 build tf. Also as I mentioned above, the error can be fixed by manually removing some metrics on GoogleCloud. Do you think it is related to that one but not a different case, or a bug in the monitoring provider code? 🤔 My stack trace points to this The error is And it is NOT some |
@liufuyang oh I see. Can you share your monitoring.json and repro steps? |
Ah... my monitoring.json is huge and it has many customised metrics. But let me try draw a simpler one for you perhaps. Hold on...
{
"dashboardFilters": [],
"displayName": "Dashboard",
"labels": {},
"mosaicLayout": {
"columns": 48,
"tiles": [
{
"height": 16,
"widget": {
"title": "VM Instance - CPU utilization [MEAN]",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_MEAN",
"groupByFields": [],
"perSeriesAligner": "ALIGN_MEAN"
},
"filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
}
}
}
],
"thresholds": [],
"yAxis": {
"label": "",
"scale": "LINEAR"
}
}
},
"width": 24
},
{
"height": 16,
"widget": {
"title": "system.cpu.time [SUM]",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": [],
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"workload.googleapis.com/system.cpu.time\" resource.type=\"generic_node\""
}
}
}
],
"thresholds": [],
"yAxis": {
"label": "",
"scale": "LINEAR"
}
}
},
"width": 24,
"yPos": 16
},
{
"height": 16,
"widget": {
"title": "system.memory.usage [MEAN]",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_MEAN",
"groupByFields": [],
"perSeriesAligner": "ALIGN_MEAN"
},
"filter": "metric.type=\"workload.googleapis.com/system.memory.usage\" resource.type=\"generic_node\""
}
}
}
],
"thresholds": [],
"yAxis": {
"label": "",
"scale": "LINEAR"
}
}
},
"width": 24,
"yPos": 32
}
]
}
} |
@liufuyang I do see it is bug here. Your monitoring.json will help us to build tests to cover the use cases |
I build a simpler json for you above, I believe my current large json is nothing special but just more element. So if you do tf apply with the json above, which has 3 tiles, then a dashboard will be created on GoogleCloud Monitoring and having 3 metrics. Then you try remove the last tile from the Let me know whether this helps :) |
{
"dashboardFilters": [],
"displayName": "Dashboard",
"labels": {},
"mosaicLayout": {
"columns": 48,
"tiles": [
{
"height": 16,
"widget": {
"title": "VM Instance - CPU utilization [MEAN]",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_MEAN",
"groupByFields": [],
"perSeriesAligner": "ALIGN_MEAN"
},
"filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
}
}
}
],
"thresholds": [],
"yAxis": {
"label": "",
"scale": "LINEAR"
}
}
},
"width": 24
},
{
"height": 16,
"widget": {
"title": "system.cpu.time [SUM]",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_SUM",
"groupByFields": [],
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"workload.googleapis.com/system.cpu.time\" resource.type=\"generic_node\""
}
}
}
],
"thresholds": [],
"yAxis": {
"label": "",
"scale": "LINEAR"
}
}
},
"width": 24,
"yPos": 16
}
]
}
} |
Let me know it if helps or whether you could see the bug :) By the way, the tf resource setup can be set as this: resource "google_monitoring_dashboard" "service-dashboard" {
dashboard_json = templatefile("${path.module}/monitoring.json", {})
} |
Yeah, thanks for the info. Let me try to repro |
Yes, I can repro with your file. Thanks |
GoogleCloudPlatform#9065)" This reverts commit 262bbe6. That commit introduced the issue at hashicorp/terraform-provider-google#16439
The stacktrace points to code that was introduced at GoogleCloudPlatform/magic-modules#9065 and a comment in the internal bug tracking system also suggests this new code to be the issue. I have opened a PR to revert this change: GoogleCloudPlatform/magic-modules#9538 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
I added some stuff (more metrics) in
monitoring.json
then it works, but when I removed some stuff later in it, the tf plan panics as below.Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
terraform apply
Important Factoids
References
b/309603218
The text was updated successfully, but these errors were encountered: