简体   繁体   English

SnowPlow 分析模式

[英]SnowPlow Analytics Schemas

Trying to create a schema with arrays for data retrieved from performance insights.尝试使用 arrays 为从性能洞察中检索到的数据创建一个架构。

{
    "$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
    "description": "Performance Insights",
    "self": {
        "vendor": "com.acme",
        "name": "performance_insights",
        "format": "jsonschema",
        "version": "1-0-3"
    },
    "type": "object",
    "properties": {
        "SeriesStartTime": {
            "type": "string",
            "format": "date-time",
            "description" : "timestamp"
        },
        "SeriesEndtime": {
            "type": "string",
            "format": "date-time",
            "description" : "timestamp"
        },
        "Identifier": {
            "description": "DataBase",
            "type": "string",
            "maxLength": 128
        },
        "MetricList": {
            "type": "array",
            "items":{
            "type": "object",
            "properties": {
                "Key": {
                    "type": "object",
                    "description": "Key Metric",
                    "properties": {
                        "Metric": {
                            "type": "string",
                            "description": "Load Avg"
                        },
                        "Dimensions": {
                            "properties": {
                                "tokenized_db": {
                                    "type": "string",
                                    "maxLength": 128
                                },
                                "tokenized_id": {
                                    "type": "string",
                                    "maxLength": 128
                                },
                                "tokenized_statement": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                },                
                "DataPoints": {
                    "type": "array",
                    "items": {
                    "type": "object",
                    "properties": {
                        "Timestamp": {
                            "description" : "timestamp",
                            "type": "string",
                            "format": "date-time"
                        },
                        "Value": {
                            "description" : "Value",
                            "type": "number"
                        }
                    }
                }
                }
            }
        },
        "minItems": 1
    }
    
    },
    "additionalProperties": false
    
}

It lints ok then I send data to it:它正常,然后我向它发送数据:

{
      "schema": "iglu:com.acme/performance_insights/jsonschema/1-0-3",
      "data": {
        "SeriesStartTime": "2021-12-09T19:00:00-05:00",
        "SeriesEndtime": "2021-12-09T20:00:00-05:00",
        "Identifier": "db-5LHLHN5OGHFFFFMHRGDM",
        "MetricList": [
            {
                "Key": {
                    "Metric": "db.load.avg"
                },
                "DataPoints": [
                    {
                        "Timestamp": "2021-12-09T19:01:00-05:00",
                        "Value": 0.01818181818181818
                    },
                    {
                        "Timestamp": "2021-12-09T19:25:00-05:00",
                        "Value": 0.01818181818181818
                    }
                ]
            }]
    }
    }

I've pushed the schema to my repo I have push a couple others which work but not so complex as to receive array data.我已经将模式推送到我的回购协议中,我已经推送了其他几个可以工作但没有复杂到接收数组数据的模式。

Seems when I intentionally put the type wrong I see errors in my bad collector.似乎当我故意把类型弄错时,我在我的坏收集器中看到了错误。 When everything is correct as above I only see当一切都如上正确时,我只看到

schemaKey:"iglu:com.acme/performance_insights/jsonschema/1-0-3"
schemaCriterion:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*"

As a failure.message作为 failure.message

Any ideas?有任何想法吗?

I'm making these assumptions:我正在做这些假设:

  • the bad rows that you are citing in your example are of type tracker_protocol_violations您在示例中引用的坏行属于tracker_protocol_violations类型
  • they are of subtype CriterionMismatch .它们属于CriterionMismatch子类型。

This type of failure happens when the supplied payload is a valid JSON and it is a self-describing one, but it's schema does not match the associated schema criterion.当提供的负载是一个有效的 JSON 并且它是一个自我描述的负载时,就会发生这种类型的故障,但它的模式与关联的模式标准不匹配。 The failure.message shows you the schema of the failed event and the schema criterion that needed to be matched. failure.message向您显示失败事件的模式和需要匹配的模式标准。

In your case the schema is com.acme/performance_insights/jsonschema/1-0-3 but the criterion to match is com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-* .在您的情况下,模式是com.acme/performance_insights/jsonschema/1-0-3但匹配的标准是com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*

You are seeing this error because the self-describing event needs to be wrapped up in a com.snowplowanalytics.snowplow/payload_data schema.您看到此错误是因为自描述事件需要包含在com.snowplowanalytics.snowplow/payload_data模式中。 like this:像这样:

{
  "schema": "com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4",
  "data": [
    "...": "...",
    "ue_px": "<base64-encoded-string>",
    "...": "..."
  ]  
}

where <base64-encoded-string> is the base64-encoded JSON with the com.acme/performance_insights schema.其中<base64-encoded-string>是 base64 编码的 JSON 和com.acme/performance_insights架构。

You can read more about this type of failure in the Snowplow documentation here .您可以在此处的 Snowplow 文档中阅读有关此类故障的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 雪花中的克隆模式 - Clone Schemas in Snowflake 从雪花中的所有可用数据库中获取模式 - Getting schemas from all the available database in snowflake 如何在 Snowflake 中查询多个 JSON 文档模式? - How to query multiple JSON document schemas in Snowflake? 基于 Snowflake 中的模式匹配删除模式 - Drop schemas based on pattern match in Snowflake 如何获取雪花数据仓库中模式的总字节大小 - How to get the total byte size of schemas in Snowflake data warehouse 如何从雪花中的所有模式中查找存储过程和函数? - How to find stored procedures and functions from all schemas in Snowflake? 有没有办法在 Snowflake 中的所有数据库和模式中创建可访问的屏蔽策略? - Is there a way to create a masking policy accessible across all databases and schemas in Snowflake? SQL 查询雪花帐户中可用的表数(包括所有数据库和模式) - SQL Query to find number of tables available in Snowflake account(including all DB and schemas) Snowflake - 授予角色对数据库的完全访问权限; 撤销对属于该角色的用户的特定模式的访问权限 - Snowflake - Give full access on database to role; revoke access on specific schemas to user that is part of the role 雪花 - 错误 [HY000] [雪花][雪花] (4) - Snowflake - ERROR [HY000] [Snowflake][Snowflake] (4)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM