[英]SnowPlow Analytics Schemas
尝试使用 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
}
它正常,然后我向它发送数据:
{
"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
}
]
}]
}
}
我已经将模式推送到我的回购协议中,我已经推送了其他几个可以工作但没有复杂到接收数组数据的模式。
似乎当我故意把类型弄错时,我在我的坏收集器中看到了错误。 当一切都如上正确时,我只看到
schemaKey:"iglu:com.acme/performance_insights/jsonschema/1-0-3"
schemaCriterion:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*"
作为 failure.message
有任何想法吗?
我正在做这些假设:
tracker_protocol_violations
类型CriterionMismatch
子类型。 当提供的负载是一个有效的 JSON 并且它是一个自我描述的负载时,就会发生这种类型的故障,但它的模式与关联的模式标准不匹配。 failure.message
向您显示失败事件的模式和需要匹配的模式标准。
在您的情况下,模式是com.acme/performance_insights/jsonschema/1-0-3
但匹配的标准是com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*
。
您看到此错误是因为自描述事件需要包含在com.snowplowanalytics.snowplow/payload_data
模式中。 像这样:
{
"schema": "com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4",
"data": [
"...": "...",
"ue_px": "<base64-encoded-string>",
"...": "..."
]
}
其中<base64-encoded-string>
是 base64 编码的 JSON 和com.acme/performance_insights
架构。
您可以在此处的 Snowplow 文档中阅读有关此类故障的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.