Lattice Hub 文档
HTTP OpenAPI治理

故障探测

主动探测规则与 release。

主动探测规则与 release。

默认 Base URL:http://127.0.0.1:8090。管理面接口需 Authorization(登录返回的 token)。

故障探测

故障探测:查询、创建/更新、删除与 releases(发布 / 回滚 / 停灰度)。body 为规则数组;字段以 specification 为准。

GET/naming/v1/faultdetectors需要鉴权

查询故障探测

分页查询故障探测。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    按 ID。

  • namequery · string可选

    按名称。

  • namespacequery · string可选

    按命名空间。

  • servicequery · string可选

    按服务。

  • enablequery · bool可选

    是否启用。

  • offsetquery · integer可选

    偏移,默认 0。

  • limitquery · integer可选

    分页大小,常见上限 100。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/faultdetectors?limit=20' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "data": [{ "id": "...", "name": "demo", "enable": true }]
}
GET/naming/v1/faultdetectors/detail需要鉴权

查询故障探测详情

按 id 等条件查单条详情。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    按 ID。

  • namequery · string可选

    按名称。

  • namespacequery · string可选

    按命名空间。

  • servicequery · string可选

    按服务。

  • enablequery · bool可选

    是否启用。

  • offsetquery · integer可选

    偏移,默认 0。

  • limitquery · integer可选

    分页大小,常见上限 100。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/faultdetectors/detail?id=<id>' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/faultdetectors需要鉴权

创建故障探测

写接口 body 多为 protobuf 消息数组;下列为单条对象字段(见 specification)。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · FaultDetectRule[]必填

    请求体为 FaultDetectRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string必填

    rule name

  • descriptionbody · string可选

    description simple description rules

  • target_servicebody · DestinationService可选

    detect target

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • prioritybody · uint32可选

    priority rules priority

  • metadatabody · map<string,string>可选

    metadata

  • rulesbody · FaultDetectSubRule[]可选

    rules

    • intervalbody · uint32可选

      detect interval

    • timeoutbody · uint32可选

      detect timeout

    • portbody · uint32可选

      detect port

    • protocolbody · FaultDetectRule.Protocol可选

      detect protocol

    • http_configbody · HttpProtocolConfig可选

      http detect config

      • methodbody · string可选

        method

      • urlbody · string可选

        url

      • headersbody · MessageHeader[]可选

        headers

        • keybody · string可选

          key

        • valuebody · string可选

          value

      • bodybody · string可选

        body

    • tcp_configbody · TcpProtocolConfig可选

      tcp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • udp_configbody · UdpProtocolConfig可选

      udp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • disablebody · bool可选

      sub rule disabled

  • namespacebody · string必填

    namespace

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • faultDetectRulebody · FaultDetectRule可选

    返回中的 FaultDetectRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      rule name

    • revisionbody · string可选

      revision routing version

    • ctimebody · string可选

      ctime create time of the rules

    • mtimebody · string可选

      mtime modify time of the rules

    • descriptionbody · string可选

      description simple description rules

    • target_servicebody · DestinationService可选

      detect target

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • prioritybody · uint32可选

      priority rules priority

    • metadatabody · map<string,string>可选

      metadata

    • editablebody · bool可选

      操作标志位

    • deleteablebody · bool可选

      deleteable

    • rulesbody · FaultDetectSubRule[]可选

      rules

      • intervalbody · uint32可选

        detect interval

      • timeoutbody · uint32可选

        detect timeout

      • portbody · uint32可选

        detect port

      • protocolbody · FaultDetectRule.Protocol可选

        detect protocol

      • http_configbody · HttpProtocolConfig可选

        http detect config

        • methodbody · string可选

          method

        • urlbody · string可选

          url

        • headersbody · MessageHeader[]可选

          headers

          • keybody · string可选

            key

          • valuebody · string可选

            value

        • bodybody · string可选

          body

      • tcp_configbody · TcpProtocolConfig可选

        tcp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • udp_configbody · UdpProtocolConfig可选

        udp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • disablebody · bool可选

        sub rule disabled

    • namespacebody · string可选

      namespace

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/faultdetectors' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"name":"demo-fd","enable":true}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
PUT/naming/v1/faultdetectors需要鉴权

更新故障探测

更新规则;body 为数组。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · FaultDetectRule[]必填

    请求体为 FaultDetectRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string可选

    rule name

  • descriptionbody · string可选

    description simple description rules

  • target_servicebody · DestinationService可选

    detect target

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • prioritybody · uint32可选

    priority rules priority

  • metadatabody · map<string,string>可选

    metadata

  • rulesbody · FaultDetectSubRule[]可选

    rules

    • intervalbody · uint32可选

      detect interval

    • timeoutbody · uint32可选

      detect timeout

    • portbody · uint32可选

      detect port

    • protocolbody · FaultDetectRule.Protocol可选

      detect protocol

    • http_configbody · HttpProtocolConfig可选

      http detect config

      • methodbody · string可选

        method

      • urlbody · string可选

        url

      • headersbody · MessageHeader[]可选

        headers

        • keybody · string可选

          key

        • valuebody · string可选

          value

      • bodybody · string可选

        body

    • tcp_configbody · TcpProtocolConfig可选

      tcp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • udp_configbody · UdpProtocolConfig可选

      udp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • disablebody · bool可选

      sub rule disabled

  • namespacebody · string可选

    namespace

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • faultDetectRulebody · FaultDetectRule可选

    返回中的 FaultDetectRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      rule name

    • revisionbody · string可选

      revision routing version

    • ctimebody · string可选

      ctime create time of the rules

    • mtimebody · string可选

      mtime modify time of the rules

    • descriptionbody · string可选

      description simple description rules

    • target_servicebody · DestinationService可选

      detect target

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • prioritybody · uint32可选

      priority rules priority

    • metadatabody · map<string,string>可选

      metadata

    • editablebody · bool可选

      操作标志位

    • deleteablebody · bool可选

      deleteable

    • rulesbody · FaultDetectSubRule[]可选

      rules

      • intervalbody · uint32可选

        detect interval

      • timeoutbody · uint32可选

        detect timeout

      • portbody · uint32可选

        detect port

      • protocolbody · FaultDetectRule.Protocol可选

        detect protocol

      • http_configbody · HttpProtocolConfig可选

        http detect config

        • methodbody · string可选

          method

        • urlbody · string可选

          url

        • headersbody · MessageHeader[]可选

          headers

          • keybody · string可选

            key

          • valuebody · string可选

            value

        • bodybody · string可选

          body

      • tcp_configbody · TcpProtocolConfig可选

        tcp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • udp_configbody · UdpProtocolConfig可选

        udp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • disablebody · bool可选

        sub rule disabled

    • namespacebody · string可选

      namespace

请求示例
curl -sS -X PUT 'http://127.0.0.1:8090/naming/v1/faultdetectors' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"name":"demo-fd","enable":true}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/faultdetectors/delete需要鉴权

删除故障探测

删除规则;body 为含 id 的数组。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · FaultDetectRule[]必填

    请求体为 FaultDetectRule 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • namebody · string可选

    rule name

  • descriptionbody · string可选

    description simple description rules

  • target_servicebody · DestinationService可选

    detect target

    • servicebody · string可选

      Main tuning service and namespace

    • namespacebody · string可选

      namespace

  • prioritybody · uint32可选

    priority rules priority

  • metadatabody · map<string,string>可选

    metadata

  • rulesbody · FaultDetectSubRule[]可选

    rules

    • intervalbody · uint32可选

      detect interval

    • timeoutbody · uint32可选

      detect timeout

    • portbody · uint32可选

      detect port

    • protocolbody · FaultDetectRule.Protocol可选

      detect protocol

    • http_configbody · HttpProtocolConfig可选

      http detect config

      • methodbody · string可选

        method

      • urlbody · string可选

        url

      • headersbody · MessageHeader[]可选

        headers

        • keybody · string可选

          key

        • valuebody · string可选

          value

      • bodybody · string可选

        body

    • tcp_configbody · TcpProtocolConfig可选

      tcp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • udp_configbody · UdpProtocolConfig可选

      udp detect config

      • sendbody · string可选

        send

      • receivebody · string[]可选

        receive

    • disablebody · bool可选

      sub rule disabled

  • namespacebody · string可选

    namespace

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • faultDetectRulebody · FaultDetectRule可选

    返回中的 FaultDetectRule 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • namebody · string可选

      rule name

    • revisionbody · string可选

      revision routing version

    • ctimebody · string可选

      ctime create time of the rules

    • mtimebody · string可选

      mtime modify time of the rules

    • descriptionbody · string可选

      description simple description rules

    • target_servicebody · DestinationService可选

      detect target

      • servicebody · string可选

        Main tuning service and namespace

      • namespacebody · string可选

        namespace

    • prioritybody · uint32可选

      priority rules priority

    • metadatabody · map<string,string>可选

      metadata

    • editablebody · bool可选

      操作标志位

    • deleteablebody · bool可选

      deleteable

    • rulesbody · FaultDetectSubRule[]可选

      rules

      • intervalbody · uint32可选

        detect interval

      • timeoutbody · uint32可选

        detect timeout

      • portbody · uint32可选

        detect port

      • protocolbody · FaultDetectRule.Protocol可选

        detect protocol

      • http_configbody · HttpProtocolConfig可选

        http detect config

        • methodbody · string可选

          method

        • urlbody · string可选

          url

        • headersbody · MessageHeader[]可选

          headers

          • keybody · string可选

            key

          • valuebody · string可选

            value

        • bodybody · string可选

          body

      • tcp_configbody · TcpProtocolConfig可选

        tcp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • udp_configbody · UdpProtocolConfig可选

        udp detect config

        • sendbody · string可选

          send

        • receivebody · string[]可选

          receive

      • disablebody · bool可选

        sub rule disabled

    • namespacebody · string可选

      namespace

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/faultdetectors/delete' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/faultdetectors/releases需要鉴权

发布故障探测

发布 release,使客户端读到 active 视图。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • ruleReleasebody · RuleRelease可选

    返回中的 RuleRelease 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/faultdetectors/releases' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>","release_type":"normal"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
GET/naming/v1/faultdetectors/releases需要鉴权

查询故障探测发布

查询已发布版本。

  • Authorizationheader · string必填

    登录返回的 token。

  • idquery · string可选

    规则 ID。

  • limitquery · integer可选

    分页大小。

请求示例
curl -sS 'http://127.0.0.1:8090/naming/v1/faultdetectors/releases?limit=20' \
  -H "Authorization: $TOKEN"
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
PUT/naming/v1/faultdetectors/releases/rollback需要鉴权

回滚故障探测

回滚到指定 release。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • ruleReleasebody · RuleRelease可选

    返回中的 RuleRelease 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X PUT 'http://127.0.0.1:8090/naming/v1/faultdetectors/releases/rollback' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
PUT/naming/v1/faultdetectors/releases/stopbeta需要鉴权

停止故障探测灰度

停止灰度 release。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组:[{...}, ...]。下列字段为数组中单条对象的完整字段(含嵌套)。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码,成功多为 200000。

  • infobody · string可选

    提示信息。

  • ruleReleasebody · RuleRelease可选

    返回中的 RuleRelease 实体字段(批量接口在 responses[] 内)。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X PUT 'http://127.0.0.1:8090/naming/v1/faultdetectors/releases/stopbeta' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[{"id":"<rule-id>"}]'
响应示例
{
  "code": 200000,
  "info": "execute success",
  "amount": 1
}
POST/naming/v1/faultdetectors/releases/delete需要鉴权

删除发布

删除发布。

  • Authorizationheader · string必填

    登录返回的 token。

  • (body)body · RuleRelease[]必填

    请求体为 RuleRelease 的 JSON 数组;下列为单条字段。

  • idbody · string可选

    id

  • rule_idbody · string可选

    rule_id

  • rule_namebody · string可选

    rule_name

  • release_namebody · string可选

    release_name

  • descriptionbody · string可选

    description

  • release_typebody · string可选

    release_type

  • client_labelsbody · ClientLabel[]可选

    client_labels

    • keybody · string可选

      key

    • valuebody · MatchString可选

      value

      • typebody · enum(MatchStringType)可选

        type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

      • valuebody · string可选

        value

      • value_typebody · enum(ValueType)可选

        value_type 枚举:TEXT | PARAMETER

  • versionbody · uint64可选

    version

  • resourcebody · enum(RuleType)可选

    resource 枚举:

  • codebody · uint32必填

    业务码。

  • infobody · string可选

    提示信息。

  • RuleReleasebody · RuleRelease可选

    实体字段。

    • idbody · string可选

      id

    • rule_idbody · string可选

      rule_id

    • rule_namebody · string可选

      rule_name

    • release_namebody · string可选

      release_name

    • descriptionbody · string可选

      description

    • release_typebody · string可选

      release_type

    • client_labelsbody · ClientLabel[]可选

      client_labels

      • keybody · string可选

        key

      • valuebody · MatchString可选

        value

        • typebody · enum(MatchStringType)可选

          type 枚举:EXACT | REGEX | NOT_EQUALS | IN | NOT_IN | RANGE

        • valuebody · string可选

          value

        • value_typebody · enum(ValueType)可选

          value_type 枚举:TEXT | PARAMETER

    • versionbody · uint64可选

      version

    • resourcebody · enum(RuleType)可选

      resource 枚举:

    • activebody · bool可选

      active

    • ctimebody · string可选

      ctime

    • mtimebody · string可选

      mtime

请求示例
curl -sS -X POST 'http://127.0.0.1:8090/naming/v1/faultdetectors/releases/delete' \
  -H "Authorization: $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '[]'
响应示例
{
  "code": 200000,
  "info": "execute success"
}

On this page