[英]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:我正在做这些假设:
tracker_protocol_violations
tracker_protocol_violations
类型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.