试图为从性能洞察中检索到的数据创建一个带有数组的架构。
{
"$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
}
]
}]
}
}我已经将模式推送到了我的repo中,我还推了几个其他的模式,它们可以工作,但不像接收数组数据那样复杂。
似乎当我故意把类型错误,我看到错误在我的坏收集器。当一切都像上面一样正确的时候,我只看到
schemaKey:"iglu:com.acme/performance_insights/jsonschema/1-0-3"
schemaCriterion:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-*"作为一个failure.message
有什么想法吗?
发布于 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架构中。就像这样:
{
"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。
您可以在雪犁文档这里中更多地了解这种类型的故障。
https://stackoverflow.com/questions/70672577
复制相似问题