首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SnowPlow分析模式

SnowPlow分析模式
EN

Stack Overflow用户
提问于 2022-01-11 19:46:30
回答 1查看 297关注 0票数 0

试图为从性能洞察中检索到的数据创建一个带有数组的架构。

代码语言:javascript
复制
{
    "$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
    
}

它链接好了,然后我向它发送数据:

代码语言:javascript
复制
{
      "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
                    }
                ]
            }]
    }
    }

我已经将模式推送到了我的repo中,我还推了几个其他的模式,它们可以工作,但不像接收数组数据那样复杂。

似乎当我故意把类型错误,我看到错误在我的坏收集器。当一切都像上面一样正确的时候,我只看到

代码语言:javascript
复制
schemaKey:"iglu:com.acme/performance_insights/jsonschema/1-0-3"
schemaCriterion:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*"

作为一个failure.message

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2022-03-24 14:29:15

我做了这些假设:

  • 在示例中引用的坏行是tracker_protocol_violations类型的。
  • 它们属于CriterionMismatch亚型。

当提供的有效负载是有效的JSON并且是自描述的JSON时,这种类型的失败就会发生,但是它的模式不符合相关的模式标准。failure.message向您展示失败事件的架构和需要匹配的架构条件。

在您的示例中,模式是com.acme/performance_insights/jsonschema/1-0-3,但匹配的标准是com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*

您正在看到此错误,因为需要将自描述事件封装在com.snowplowanalytics.snowplow/payload_data架构中。就像这样:

代码语言:javascript
复制
{
  "schema": "com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4",
  "data": [
    "...": "...",
    "ue_px": "<base64-encoded-string>",
    "...": "..."
  ]  
}

其中<base64-encoded-string>是带有com.acme/performance_insights模式的base64 64编码的JSON。

您可以在雪犁文档这里中更多地了解这种类型的故障。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70672577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档