分割
在本示例中,您将在Split 和 Port 之间创建一个 webhook 集成,用于接收印象信息。
Port 配置
创建以下蓝图定义:
Split impression blueprint
{
"identifier": "splitImpression",
"description": "Blueprint for Split Impressions",
"title": "Split Impression",
"icon": "Webhook",
"schema": {
"properties": {
"key": {
"icon": "DefaultProperty",
"title": "Key",
"description": "Key of the Impression",
"type": "string"
},
"split": {
"title": "Split name",
"description": "Feature flag name",
"type": "string",
"icon": "DefaultProperty"
},
"environment_id": {
"icon": "DefaultProperty",
"title": "Environment Id",
"type": "string",
"description": "Environment Id where feature flag was evaluated"
},
"environment_name": {
"icon": "DefaultProperty",
"title": "Environment Name",
"type": "string",
"description": "Environment name"
},
"label": {
"title": "Label",
"description": "The rule that was applied to return a treatment",
"type": "string"
},
"sdk": {
"title": "sdk",
"description": "SDK language that evaluated",
"type": "string"
},
"sdk_version": {
"title": "SDK Version",
"type": "string",
"description": "the SDK version"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
创建以下 webhook 配置using Port's UI
Split webhook configuration
- 基本信息 选项卡 - 填写以下详细信息:
1.title:
Split Mapper
; 2.标识符 :split_mapper
; 3.Description :将 Splitio 印象映射到 Port
的 webhook 配置; 4.图标 :Jenkins
; - 集成配置选项卡 - 填写以下 JQ 映射:
[
{
"blueprint": "splitImpression",
"itemsToParse": ".body",
"entity": {
"identifier": ".item.key + \"-\" + .item.time",
"title": ".item.split",
"properties": {
"environment_id": ".item.environmentId",
"environment_name": ".item.environmentName",
"label": ".item.label",
"sdk": ".item.sdk",
"sdk_version": ".item.sdkVersion"
}
}
}
]
3.点击页面底部的保存。
在 Split 中创建 webhook
- 转到管理设置。
- 单击 "集成"。
- 选择您的 Workspace。
- 单击外发 Webhook (Impressions) 旁边的添加。
- 选中您希望发送数据的环境。
- 输入创建 Webhook 配置后收到的
url
键的值。 - 单击保存。
完成!任何时候触发印象,webhook 都会将数据发送到 Port 并创建一 个新的 "分割印象 "实体
要查看某个印象的所有可用数据,请访问Split's documentation