What BigQuery API method is being referred to in error message? - google-bigquery

We have a Continuous Integration (CI) pipeline that creates resources in GCP, runs some tests upon them, then destroys those resources. This pipeline runs tens of times per day. Some of the resources are BigQuery datasets. We use terraform to create and destroy those resources.
Occasionally the destroying of these resources fails with error:
Error: Error when reading or editing Resource projects/projectname/datasets/p00005167_datasetname for IAM Member (role "serviceAccount:sa-name#projectname.iam.gserviceaccount.com", "projects/projectname/roles/rolename"): Error applying IAM policy for Bigquery Dataset projectname/p00005167_datasetname: Error creating DatasetAccess: googleapi: Error 403: Exceeded rate limits: too many dataset metadata update operations for this dataset. For more information, see https://cloud.google.com/bigquery/docs/troubleshoot-quotas, rateLimitExceeded
I can see the same errors appearing in Logs Explorer which are of the form:
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {
"code": 8,
"message": "Exceeded rate limits: too many dataset metadata update operations for this dataset. For more information, see https://cloud.google.com/bigquery/docs/troubleshoot-quotas"
},
"authenticationInfo": {
"principalEmail": "deployer-dev#projectname.iam.gserviceaccount.com",
"serviceAccountDelegationInfo": [
{
"firstPartyPrincipal": {
"principalEmail": "deployer-dev#projectname.iam.gserviceaccount.com"
}
}
]
},
"requestMetadata": {
"callerIp": "10.51.0.118",
"callerSuppliedUserAgent": "Terraform/0.14.7 (+https://www.terraform.io) Terraform-Plugin-SDK/2.5.0 terraform-provider-google/3.84.0,gzip(gfe)",
"callerNetwork": "//compute.googleapis.com/projects/projectname/global/networks/__unknown__",
"requestAttributes": {},
"destinationAttributes": {}
},
"serviceName": "bigquery.googleapis.com",
"methodName": "datasetservice.update",
"authorizationInfo": [
{
"resource": "projects/projectname/datasets/p00005167_datasetname",
"permission": "bigquery.datasets.update",
"granted": true,
"resourceAttributes": {}
}
],
"resourceName": "projects/projectname/datasets/p00005167_datasetname",
"serviceData": {
"#type": "type.googleapis.com/google.cloud.bigquery.logging.v1.AuditData",
"datasetUpdateRequest": {
"resource": {
"datasetName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname"
},
"info": {
"friendlyName": "currents",
"description": "blah",
},
"acl": {
"entries": [
{
"role": "projects/projectname/roles/rolename",
"userEmail": "sa-name#projectname.iam.gserviceaccount.com",
"specialGroup": "PROJECT_OWNERS",
"viewName": {}
},
{
"role": "WRITER",
"specialGroup": "PROJECT_WRITERS",
"viewName": {}
},
{
"role": "OWNER",
"specialGroup": "PROJECT_OWNERS",
"viewName": {}
},
{
"role": "OWNER",
"userEmail": "deployer-dev#projectname.iam.gserviceaccount.com",
"specialGroup": "PROJECT_OWNERS",
"viewName": {}
},
{
"role": "READER",
"specialGroup": "PROJECT_READERS",
"viewName": {}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsSubscriptiongroupStatechange_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersCampaignsEnrollincontrol_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsCustomevent_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesContentcardClick_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesSmsInboundreceive_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesPushnotificationSend_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesPushnotificationBounce_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesSmsDeliveryfailure_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsInstallattribution_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailBounce_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsAppNewsfeedimpression_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsLocation_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailUnsubscribe_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesInappmessageClick_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesContentcardImpression_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailSend_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailClick_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsUninstall_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailMarkasSpam_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersCampaignsConversion_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesSmsRejection_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesSmsSend_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesInappmessageImpression_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesContentcardDismiss_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailDelivery_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesWebhookSend_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsPurchase_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesPushnotificationIosforeground_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesNewsfeedcardClick_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersCanvasEntry_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesSmsDelivery_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailSoftbounce_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsAppFirstsession_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesNewsfeedcardImpression_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersMessagesEmailOpen_red_v"
}
},
{
"specialGroup": "PROJECT_OWNERS",
"viewName": {
"projectId": "projectname",
"datasetId": "p00005167_datasetname_presentation_red",
"tableId": "UsersBehaviorsAppSessionstart_red_v"
}
}
]
}
}
},
"datasetUpdateResponse": {
"resource": {
"datasetName": {},
"info": {},
"acl": {}
}
}
}
},
"insertId": "ivcvsse1mrrw",
"resource": {
"type": "bigquery_resource",
"labels": {
"project_id": "projectname"
}
},
"timestamp": "2021-10-15T14:25:33.764732Z",
"severity": "ERROR",
"logName": "projects/projectname/logs/cloudaudit.googleapis.com%2Factivity",
"receiveTimestamp": "2021-10-15T14:25:34.287118294Z"
}
I have a number of avenues of investigation I'm pursuing to try and get to the bottom of this however one thing I'd like to clarify is the API method that is being called. The log message states:
"serviceName": "bigquery.googleapis.com",
"methodName": "datasetservice.update",
however if I search for datasetservice.update the closest match I find is Method: datasets.update and the required response body as documented at that URL doesn't seem to match the response body in the log message. For example, the protoPayload.serviceData.datasetUpdateRequest object in the log message contains an object called acl however there is no such object documented in the response body at Method: datasets.update .
Hence I'm slightly confused. Is it correct to say that Method: datasets.update is the API method being called here?

Your suspicion is correct.
The methodName is reporting internal details as part of the audit log entry, namely that there's a datasetService. It services the datasets.* methods: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets
My terraform-fu is pretty weak as I rarely interact with it, but this may represent some underspecified dependencies; it may be that terraform is making a bunch of calls that partially update the access list for example. A series of repeated permission updates to the dataset would be sufficient to trigger the ratelimit error.

Related

GKE - Automatic replacement of Instance Group Template

Current Situation: We're having a Kubernetes Cluster in Google (GKE). There is an instance group that refers an instance template defining the VMs.
Problem: Some days ago we had a spontaneous outage. I could find out that our instance group referred a new instance template, that was missing some access rights leading to that outage. Changing the instance template back to the original one solved the issue.
What I'm still wondering: We did neither change the template for the instance group nor did we create the instance template that was used.
I'm the only person managing the cluster, so I'm pretty sure that this happened automatically. How could this happen?
Searching for a reason:
I was researching on that topic but I could not find any related issues. I discovered three logs that might be interesting, but I cannot find a reason for that.
gke-<MY_PROJECT>-default-pool-4f1a9017 is the new instance template created.
All three logs are direct subsequent logs:
Log1 - ERROR - beta.compute.instanceGroupManagers.insert:
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {
"code": 6,
"message": "The resource 'projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp' already exists"
},
"authenticationInfo": {
"principalEmail": "service-<ID>#container-engine-robot.iam.gserviceaccount.com"
},
"requestMetadata": {
"callerIp": "<IP_V6>",
"callerSuppliedUserAgent": "google-api-go-client/0.5 GoogleContainerEngine/v1",
"requestAttributes": {
"time": "<TIMESTAMP>",
"auth": {}
},
"destinationAttributes": {}
},
"serviceName": "compute.googleapis.com",
"methodName": "beta.compute.instanceGroupManagers.insert",
"authorizationInfo": [
{
"permission": "compute.instanceGroupManagers.create",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"type": "compute.instanceGroupManagers"
}
},
{
"permission": "compute.instances.create",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.disks.create",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/disks/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.disks"
}
},
{
"permission": "compute.disks.setLabels",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/disks/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.disks"
}
},
{
"permission": "compute.subnetworks.use",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/regions/<MY_REGION>/subnetworks/default",
"type": "compute.subnetworks"
}
},
{
"permission": "compute.subnetworks.useExternalIp",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/regions/<MY_REGION>/subnetworks/default",
"type": "compute.subnetworks"
}
},
{
"permission": "compute.instances.setMetadata",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.instances.setTags",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.instances.setLabels",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-4f1a9017-0000",
"type": "compute.instances"
}
}
],
"resourceName": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"request": {
"name": "gke-<MY_PROJECT>-default-pool-19b04905-grp",
"instanceTemplate": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/global/instanceTemplates/<INSTANCE_TEMPLATE_ID>",
"#type": "type.googleapis.com/compute.instanceGroupManagers.insert",
"targetSize": "0",
"baseInstanceName": "gke-<MY_PROJECT>-default-pool-4f1a9017"
},
"response": {
"#type": "type.googleapis.com/error",
"error": {
"message": "The resource 'projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp' already exists",
"errors": [
{
"reason": "alreadyExists",
"domain": "global",
"message": "The resource 'projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp' already exists"
}
],
"code": 409
}
},
"resourceLocation": {
"currentLocations": [
"<MY_ZONE>"
]
}
},
"insertId": "<INSERT_ID>",
"resource": {
"type": "gce_instance_group_manager",
"labels": {
"instance_group_manager_name": "gke-<MY_PROJECT>-default-pool-19b04905-grp",
"project_id": "<MY_PROJECT>",
"location": "<MY_ZONE>",
"instance_group_manager_id": "<INSTANCE_GROUP_MANAGER_ID>"
}
},
"timestamp": "<TIMESTAMP>",
"severity": "ERROR",
"logName": "projects/<MY_PROJECT>/logs/cloudaudit.googleapis.com%2Factivity",
"receiveTimestamp": "<TIMESTAMP>"
}
Log2 - NOTICE - v1.compute.instanceGroupManagers.setInstanceTemplate
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "service-<ID>#container-engine-robot.iam.gserviceaccount.com"
},
"requestMetadata": {
"callerIp": "<IP_V6>",
"callerSuppliedUserAgent": "google-api-go-client/0.5 GoogleContainerEngine/v1",
"requestAttributes": {
"time": "<TIMESTAMP>",
"auth": {}
},
"destinationAttributes": {}
},
"serviceName": "compute.googleapis.com",
"methodName": "v1.compute.instanceGroupManagers.setInstanceTemplate",
"authorizationInfo": [
{
"permission": "compute.instanceGroupManagers.update",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"type": "compute.instanceGroupManagers"
}
},
{
"permission": "compute.instances.create",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.disks.create",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/disks/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.disks"
}
},
{
"permission": "compute.disks.setLabels",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/disks/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.disks"
}
},
{
"permission": "compute.subnetworks.use",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/regions/<MY_REGION>/subnetworks/default",
"type": "compute.subnetworks"
}
},
{
"permission": "compute.subnetworks.useExternalIp",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/regions/<MY_REGION>/subnetworks/default",
"type": "compute.subnetworks"
}
},
{
"permission": "compute.instances.setMetadata",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.instances.setTags",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.instances"
}
},
{
"permission": "compute.instances.setLabels",
"granted": true,
"resourceAttributes": {
"service": "compute",
"name": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instances/gke-<MY_PROJECT>-default-pool-19b04905-0000",
"type": "compute.instances"
}
}
],
"resourceName": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"request": {
"instanceTemplate": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/global/instanceTemplates/<INSTANCE_TEMPLATE_ID>",
"#type": "type.googleapis.com/compute.instanceGroupManagers.setInstanceTemplate"
},
"response": {
"targetId": "8142394286096021440",
"#type": "type.googleapis.com/operation",
"id": "<OPERATION_ID2>",
"insertTime": "<TIMESTAMP>",
"operationType": "compute.instanceGroupManagers.setInstanceTemplate",
"targetLink": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"zone": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/zones/<MY_ZONE>",
"name": "<OPERATION_ID>",
"progress": "0",
"selfLink": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/zones/<MY_ZONE>/operations/<OPERATION_ID>",
"status": "RUNNING",
"user": "service-<ID>#container-engine-robot.iam.gserviceaccount.com",
"selfLinkWithId": "https://www.googleapis.com/compute/v1/projects/<MY_PROJECT>/zones/<MY_ZONE>/operations/<OPERATION_ID2>",
"startTime": "<TIMESTAMP>"
},
"resourceLocation": {
"currentLocations": [
"<MY_ZONE>"
]
}
},
"insertId": "<INSERT_ID>",
"resource": {
"type": "gce_instance_group_manager",
"labels": {
"instance_group_manager_name": "gke-<MY_PROJECT>-default-pool-19b04905-grp",
"location": "<MY_ZONE>",
"project_id": "<MY_PROJECT>",
"instance_group_manager_id": "<INSTANCE_GROUP_MANAGER_ID>"
}
},
"timestamp": "<TIMESTAMP>",
"severity": "NOTICE",
"logName": "projects/<MY_PROJECT>/logs/cloudaudit.googleapis.com%2Factivity",
"operation": {
"id": "<OPERATION_ID>",
"producer": "compute.googleapis.com",
"first": true
},
"receiveTimestamp": "<TIMESTAMP>"
}
Log3 - NOTICE - v1.compute.instanceGroupManagers.setInstanceTemplate
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "service-<ID>#container-engine-robot.iam.gserviceaccount.com"
},
"requestMetadata": {
"callerIp": "<IP_V6>",
"callerSuppliedUserAgent": "google-api-go-client/0.5 GoogleContainerEngine/v1"
},
"serviceName": "compute.googleapis.com",
"methodName": "v1.compute.instanceGroupManagers.setInstanceTemplate",
"resourceName": "projects/<MY_PROJECT>/zones/<MY_ZONE>/instanceGroupManagers/gke-<MY_PROJECT>-default-pool-19b04905-grp",
"request": {
"#type": "type.googleapis.com/compute.instanceGroupManagers.setInstanceTemplate"
}
},
"insertId": "<INSERT_ID>",
"resource": {
"type": "gce_instance_group_manager",
"labels": {
"project_id": "<MY_PROJECT>",
"instance_group_manager_name": "gke-<MY_PROJECT>-default-pool-19b04905-grp",
"instance_group_manager_id": "<INSTANCE_GROUP_MANAGER_ID>",
"location": "<MY_ZONE>"
}
},
"timestamp": "<TIMESTAMP>",
"severity": "NOTICE",
"logName": "projects/<MY_PROJECT>/logs/cloudaudit.googleapis.com%2Factivity",
"operation": {
"id": "<OPERATION_ID>",
"producer": "compute.googleapis.com",
"last": true
},
"receiveTimestamp": "<TIMESTAMP>"
}

Google-Chat-API: Open dialog from posted message

I use bot to post cards with version 2 (сards_v2 property).
Cards are rendered as normal, but I want to add a Button to open Dialog. This does not work.
How can I achieve this?
I post to POST /v1/chat/channels/:channel_id/messages?
body:
{
"cards_v2": [{
"card": {
"header": {
"title": "Rolodex",
"subtitle": "Manage your contacts!",
"imageType": "CIRCLE",
"imageUrl": "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png"
},
"sections": [{
"widgets": [{
"buttonList": {
"buttons": [{
"text": "Add Contact",
"onClick": {
"action": {
"function": "openDialog",
"interaction": "OPEN_DIALOG"
}
}
}]
}
}]
}]
}
}]
}
Then I click on Button, and receive event:
{
"type": "CARD_CLICKED",
"eventTime": "2022-08-31T16:16:36.147391Z",
"message": {
"name": "spaces/:space_id/messages/YTyNVBNW-H4.YTyNVBNW-H4",
"sender": { ... },
"createTime": "2022-08-31T16:16:31.639439Z",
"thread": { ... },
"space": { ... },
"cardsV2": [{
"card": {
"header": {
"title": "Rolodex",
"subtitle": "Manage your contacts!",
"imageType": "CIRCLE",
"imageUrl": "https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png"
},
"sections": [{
"widgets": [{
"buttonList": {
"buttons": [{
"text": "Add Contact",
"onClick": {
"action": {
"function": "openDialog"
}
}
}]
}
}]
}]
}
}],
"retentionSettings": {
"state": "PERMANENT"
}
},
"user": { ... },
"space": { ... },
"action": {
"actionMethodName": "openDialog"
},
"common": {
"hostApp": "CHAT",
"invokedFunction": "openDialog"
}
}
First: Event skips DialogEventType is REQUEST_DIALOG.
Second: When I respond with dialog response, but no dialog appears.
{
"actionResponse": {
"type": "DIALOG",
"dialogAction": {
"dialog": {
"body": {
"sections": [{
"header": "Add new contact",
"widgets": [{
"textInput": {
"name": "contactName",
"label": "Name",
"type": "SINGLE_LINE"
}
}, {
"buttonList": {
"buttons": [{
"text": "Next",
"onClick": {
"action": {
"function": "openSequentialDialog"
}
}
}]
}
}]
}]
}
}
}
}
}
I see only error:

Snowflake Error parsing JSON: unfinished string, pos <number>

I am trying to query a varchar column called "JsonCode" from the "Weather" table in snowflake. The "JsonCode" column looks like this:
{
"Date": "2019-11-07T12:28:18",
"CurrentTemp": "47°F",
"WeatherIconStatus": "clear-day",
"LowTemp": "21°F",
"HighTemp": "50°F",
"WindSpeed": "6 mph",
"TempCategory": "Hot",
"ForecastData": [
{
"Date": "2019-11-08T00:00:00",
"WeatherIconStatus": "clear-day",
"LowTemp": "26°F",
"HighTemp": "51°F",
"WindSpeed": "3 mph"
},
{
"Date": "2019-11-09T00:00:00",
"WeatherIconStatus": "clear-day",
"LowTemp": "28°F",
"HighTemp": "56°F",
"WindSpeed": "7 mph"
}
],
"PrecipitationReportData": {
"ReportDateTimeAsDate": "2019-11-07T04:45:14",
"PrecipitationConditions": "",
"ForecastText": "Clear",
"NewPrecipitationReadings": {
"Overnight": {
"PrecipitationReading": "0in"
},
"TwentyFourHours": {
"PrecipitationReading": "0in"
},
"FortyEightHours": {
"PrecipitationReading": "0in"
},
"SevenDays": {
"PrecipitationReading": "0in"
}
},
"AreaReadings": {
"City": {
"PrecipitationReading": "0in"
},
"Town": {
"PrecipitationReading": "0in"
},
"Highway": {
"PrecipitationReading": null
}
},
"SeasonPrecipitation": {
"PrecipitationReading": "44in"
}
},
"Links": [
{
"Href": "https://weather.com",
"Rel": "self",
"Method": "GET"
}
]
}
I am specifically trying to grab the "WindSpeed" data from 2019-11-07. I created a query that looks like this.
SELECT value:WindSpeed::varchar FROM "DATABASE"."DBO"."WEATHER"
, lateral flatten(input => PARSE_JSON(JsonCode):windspeed);
The response I received is
Error parsing JSON: unfinished string, pos <number>
I have been unable to find any documentation around this error. Any help is appreciated.
Note: I cut out some of the Json since there is multiple days of forecasted data.
This should work without the need of a lateral flatten:
select parse_json(j):WindSpeed
from data
With the posted sample JSON:
with data as (
select $${
"Date": "2019-11-07T12:28:18",
"CurrentTemp": "47°F",
"WeatherIconStatus": "clear-day",
"LowTemp": "21°F",
"HighTemp": "50°F",
"WindSpeed": "6 mph",
"TempCategory": "Hot",
"ForecastData": [
{
"Date": "2019-11-08T00:00:00",
"WeatherIconStatus": "clear-day",
"LowTemp": "26°F",
"HighTemp": "51°F",
"WindSpeed": "3 mph"
},
{
"Date": "2019-11-09T00:00:00",
"WeatherIconStatus": "clear-day",
"LowTemp": "28°F",
"HighTemp": "56°F",
"WindSpeed": "7 mph"
}
],
"PrecipitationReportData": {
"ReportDateTimeAsDate": "2019-11-07T04:45:14",
"PrecipitationConditions": "",
"ForecastText": "Clear",
"NewPrecipitationReadings": {
"Overnight": {
"PrecipitationReading": "0in"
},
"TwentyFourHours": {
"PrecipitationReading": "0in"
},
"FortyEightHours": {
"PrecipitationReading": "0in"
},
"SevenDays": {
"PrecipitationReading": "0in"
}
},
"AreaReadings": {
"City": {
"PrecipitationReading": "0in"
},
"Town": {
"PrecipitationReading": "0in"
},
"Highway": {
"PrecipitationReading": null
}
},
"SeasonPrecipitation": {
"PrecipitationReading": "44in"
}
},
"Links": [
{
"Href": "https://weather.com",
"Rel": "self",
"Method": "GET"
}
]
}$$ j
)
select parse_json(j):WindSpeed
from data

Azure Data Factory Pipeline errorCode

I have a relatively simple process set up in Azure Data Factory to copy, cleanse and process some log files from a chatbot which has been running fine until I recently started getting the following errorCode:
"errorCode": "InvalidTemplate",
"message": "Unable to process expressions for action 'EvaluatefinaliseTSCRPTS': 'The function 'bool' was invoked with a parameter that is not valid. The value cannot be converted to the target type",
"failureType": "UserError",
"target": "finaliseTSCRPTS",
"details": ""
I can't seem to identify the error in the ADF process despite going through the code for my process below:
"name": "SearchBot dailyTranscripts",
"properties": {
"activities": [
{
"name": "MST Validation",
"type": "Validation",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"dataset": {
"referenceName": "teamsLogs",
"type": "DatasetReference"
},
"timeout": "0.00:00:30",
"sleep": 10,
"childItems": true
}
},
{
"name": "Get MST-TSCRPTS",
"type": "Copy",
"dependsOn": [
{
"activity": "MST Validation",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true,
"wildcardFileName": "*.json",
"enablePartitionDiscovery": false
}
},
"sink": {
"type": "JsonSink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings",
"copyBehavior": "MergeFiles"
},
"formatSettings": {
"type": "JsonWriteSettings",
"quoteAllText": true
}
},
"enableStaging": false,
"translator": {
"type": "TabularTranslator",
"mappings": [
{
"source": {
"path": "$['type']"
},
"sink": {
"path": "$['type']"
}
},
{
"source": {
"path": "$['timestamp']"
},
"sink": {
"path": "$['timestamp']"
}
},
{
"source": {
"path": "$['id']"
},
"sink": {
"path": "$['id']"
}
},
{
"source": {
"path": "$['channelId']"
},
"sink": {
"path": "$['channelId']"
}
},
{
"source": {
"path": "$['serviceUrl']"
},
"sink": {
"path": "$['serviceUrl']"
}
},
{
"source": {
"path": "$['from']['id']"
},
"sink": {
"path": "$['from']['id']"
}
},
{
"source": {
"path": "$['from']['aadObjectId']"
},
"sink": {
"path": "$['from']['aadObjectId']"
}
},
{
"source": {
"path": "$['from']['role']"
},
"sink": {
"path": "$['from']['role']"
}
},
{
"source": {
"path": "$['from']['name']"
},
"sink": {
"path": "$['from']['name']"
}
},
{
"source": {
"path": "$['conversation']['conversationType']"
},
"sink": {
"path": "$['conversation']['conversationType']"
}
},
{
"source": {
"path": "$['conversation']['tenantId']"
},
"sink": {
"path": "$['conversation']['tenantId']"
}
},
{
"source": {
"path": "$['conversation']['id']"
},
"sink": {
"path": "$['conversation']['id']"
}
},
{
"source": {
"path": "$['recipient']['id']"
},
"sink": {
"path": "$['recipient']['id']"
}
},
{
"source": {
"path": "$['recipient']['name']"
},
"sink": {
"path": "$['recipient']['name']"
}
},
{
"source": {
"path": "$['recipient']['aadObjectId']"
},
"sink": {
"path": "$['recipient']['aadObjectId']"
}
},
{
"source": {
"path": "$['recipient']['role']"
},
"sink": {
"path": "$['recipient']['role']"
}
},
{
"source": {
"path": "$['channelData']['tenant']['id']"
},
"sink": {
"path": "$['channelData']['tenant']['id']"
}
},
{
"source": {
"path": "$['text']"
},
"sink": {
"path": "$['text']"
}
},
{
"source": {
"path": "$['inputHint']"
},
"sink": {
"path": "$['inputHint']"
}
},
{
"source": {
"path": "$['replyToId']"
},
"sink": {
"path": "$['replyToId']"
}
},
{
"source": {
"path": "$['textFormat']"
},
"sink": {
"path": "$['textFormat']"
}
},
{
"source": {
"path": "$['localTimestamp']"
},
"sink": {
"path": "$['localTimestamp']"
}
},
{
"source": {
"path": "$['locale']"
},
"sink": {
"path": "$['locale']"
}
},
{
"source": {
"path": "$['value']"
},
"sink": {
"path": "$['value']"
}
},
{
"source": {
"path": "$['valueType']"
},
"sink": {
"path": "$['valueType']"
}
},
{
"source": {
"path": "$['name']"
},
"sink": {
"path": "$['name']"
}
},
{
"source": {
"path": "$['label']"
},
"sink": {
"path": "$['label']"
}
}
]
}
},
"inputs": [
{
"referenceName": "teamsLogs",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "transcriptsStaging",
"type": "DatasetReference"
}
]
},
{
"name": "finaliseTSCRPTS",
"type": "IfCondition",
"dependsOn": [
{
"activity": "MST Validation",
"dependencyConditions": [
"Completed"
]
},
{
"activity": "Get MST-TSCRPTS",
"dependencyConditions": [
"Succeeded",
"Skipped"
]
}
],
"userProperties": [],
"typeProperties": {
"expression": {
"value": "activity('MST Validation').output.exists",
"type": "Expression"
},
"ifTrueActivities": [
{
"name": "Combine TSCRPTS",
"type": "Copy",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true,
"wildcardFileName": "*.json",
"enablePartitionDiscovery": false
}
},
"sink": {
"type": "JsonSink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings",
"copyBehavior": "MergeFiles"
},
"formatSettings": {
"type": "JsonWriteSettings",
"quoteAllText": true
}
},
"enableStaging": false
},
"inputs": [
{
"referenceName": "transcriptsStaging",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "SearchBotDailyTranscripts",
"type": "DatasetReference",
"parameters": {
"sourceFileName": "#concat(formatDateTime(utcnow(), 'yyyy-MM-dd'),'.json')"
}
}
]
},
{
"name": "Delete Staging",
"type": "Delete",
"dependsOn": [
{
"activity": "Combine TSCRPTS",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"dataset": {
"referenceName": "transcriptsStaging",
"type": "DatasetReference"
},
"enableLogging": false,
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true
}
}
},
{
"name": "Get monthlyTSCRPTS",
"type": "Copy",
"dependsOn": [
{
"activity": "Combine TSCRPTS",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true
}
},
"sink": {
"type": "JsonSink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings"
},
"formatSettings": {
"type": "JsonWriteSettings",
"quoteAllText": true
}
},
"enableStaging": false
},
"inputs": [
{
"referenceName": "SearchBotDailyTranscripts",
"type": "DatasetReference",
"parameters": {
"sourceFileName": "#concat('2019-',formatDateTime(utcnow(), 'MM'),'-??.json')"
}
}
],
"outputs": [
{
"referenceName": "SearchBotMonthlyTranscripts",
"type": "DatasetReference",
"parameters": {
"sourceFileName": "#dataset().sourceFileName"
}
}
]
},
{
"name": "Get yearlyTSCRPTS",
"type": "Copy",
"dependsOn": [
{
"activity": "Get monthlyTSCRPTS",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true
}
},
"sink": {
"type": "JsonSink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings",
"copyBehavior": "MergeFiles"
},
"formatSettings": {
"type": "JsonWriteSettings",
"quoteAllText": true
}
},
"enableStaging": false
},
"inputs": [
{
"referenceName": "SearchBotMonthlyTranscripts",
"type": "DatasetReference",
"parameters": {
"sourceFileName": {
"value": "#concat(formatDateTime(utcnow(), 'yyyy'),'-??.json')",
"type": "Expression"
}
}
}
],
"outputs": [
{
"referenceName": "SearchBotYearlyTranscripts",
"type": "DatasetReference",
"parameters": {
"sourceFileName": "#dataset().sourceFileName"
}
}
]
},
{
"name": "Copy MST-TSCRPTS",
"type": "Copy",
"dependsOn": [
{
"activity": "Delete Staging",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "0.00:01:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true,
"wildcardFileName": "*.json",
"enablePartitionDiscovery": false
}
},
"sink": {
"type": "JsonSink",
"storeSettings": {
"type": "AzureBlobStorageWriteSettings",
"copyBehavior": "MergeFiles"
},
"formatSettings": {
"type": "JsonWriteSettings",
"quoteAllText": true
}
},
"enableStaging": false
},
"inputs": [
{
"referenceName": "teamsLogs",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "transcriptsHistory",
"type": "DatasetReference"
}
]
},
{
"name": "Delete MST-TSCRPTS",
"type": "Delete",
"dependsOn": [
{
"activity": "Copy MST-TSCRPTS",
"dependencyConditions": [
"Succeeded",
"Failed"
]
}
],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"dataset": {
"referenceName": "teamsLogs",
"type": "DatasetReference"
},
"enableLogging": false,
"storeSettings": {
"type": "AzureBlobStorageReadSettings",
"recursive": true
}
}
},
{
"name": "run learningList",
"type": "ExecutePipeline",
"dependsOn": [
{
"activity": "Delete MST-TSCRPTS",
"dependencyConditions": [
"Succeeded",
"Failed",
"Skipped"
]
}
],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "runLearningList",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
}
]
}
}
],
"parameters": {
"sourceFileName": {
"type": "string",
"defaultValue": "#concat(formatDateTime(utcnow(),'yyyy-MM-dd'),'.json')"
}
},
"annotations": []
},
"type": "Microsoft.DataFactory/factories/pipelines"
There is no expression 'EvaluatefinaliseTSCRPTS' and I can't find a 'bool' function either. The only hint I've found was a previous question here
You have an IF activity named "finaliseTSCRPTS", so "EvaluatefinaliseTSCRPTS" is most likely the internal name of the function that performs the IF condition check. The message seems to indicate that it cannot evaluate your expression "activity('MST Validation').output.exists".

Listing public datasets via API

Is there a way to include public datasets that are visible under a project in BQ cloud console (i.e. publicdata:samples) in datasets.list() / projects.list() ?
Yes - just use project "publicdata" and the datasetId of "samples" in your API calls.
import httplib2
from apiclient import errors
service = build('bigquery', 'v2')
# Auth (however your app does this)
tables = service.tables()
table_list = tables.list(projectId='publicdata',
datasetId='samples').execute()
From the API Console:
GET https://www.googleapis.com/bigquery/v2/projects/publicdata/datasets/samples/tables
{
"kind": "bigquery#tableList",
"etag": "\"asdasdsadsadsad\"",
"tables": [
{
"kind": "bigquery#table",
"id": "publicdata:samples.github_nested",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "github_nested"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.github_timeline",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "github_timeline"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.gsod",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "gsod"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.natality",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "natality"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.shakespeare",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "shakespeare"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.trigrams",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "trigrams"
},
"type": "TABLE"
},
{
"kind": "bigquery#table",
"id": "publicdata:samples.wikipedia",
"tableReference": {
"projectId": "publicdata",
"datasetId": "samples",
"tableId": "wikipedia"
},
"type": "TABLE"
}
],
"totalItems": 7
}