cx-service-catalog
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseService Catalog Skill
Service Catalog 技能
Use this skill to discover and query Service Catalog entities — services,
databases, operations, database operations, JVMs, JVM GC, Kubernetes pods, and
transactions — and their columnar metrics (latency, error rate, health, resource
usage, etc.) via the v2 Service Catalog API.
使用此技能可通过v2 Service Catalog API发现并查询Service Catalog实体——服务、数据库、操作、数据库操作、JVM、JVM GC、Kubernetes Pod和事务——以及它们的列指标(延迟、错误率、健康状态、资源使用率等)。
CLI Commands
CLI命令
| Command | Purpose | Key flags |
|---|---|---|
| List entity types this account has data for | - |
| Columns/labels schema for one entity type | - |
| Known entities of one type (e.g. service names) | - |
| Aggregated column data across every entity of a type | |
| Column data for one named entity (drilldown) | |
- All commands are read-only and support /
-o jsonfor structured output.-o agents - Entity type accepts short forms: ,
service,database,operation,database-operation,jvm,jvm-gc,k8s-pod(case-insensitive, hyphens or underscores). The full proto name (transaction) also works. Unknown values are rejected client-side before any request is made.ENTITY_TYPE_K8S_POD - /
--startaccept--end,now-style relative expressions, or RFC3339 timestamps.now-1h - is required and repeatable — discover valid column ids with
--columnfirst; the API rejects unknown ones.cx service-catalog schema <entity-type> - is repeatable across distinct labels only (filters AND together); combine multiple values for the same label with commas rather than repeating the flag — repeating a label is rejected client-side.
--filter label=value1,value2 - is
--aggregation(default behavior when combined withtable/--limit/--sort-column) or--sort-order.timeseries,--limit, and--sort-columnonly apply to--sort-order— the backend silently ignores them fortable, so the CLI rejects that combination up front rather than sending a request whose flags are quietly dropped.timeseries - percent-encodes the entity id for you — pass it as returned by
entity-data(e.g.entities), quoted if it containscheckout/api./
| 命令 | 用途 | 关键参数 |
|---|---|---|
| 列出当前账户有数据的实体类型 | - |
| 单个实体类型的列/标签schema | - |
| 某一类型的已知实体(如服务名称) | - |
| 某一类型所有实体的聚合列数据 | |
| 单个命名实体的列数据(钻取) | |
- 所有命令均为只读,并支持/
-o json以输出结构化数据。-o agents - 实体类型支持简写:、
service、database、operation、database-operation、jvm、jvm-gc、k8s-pod(大小写不敏感,连字符或下划线均可)。完整的proto名称(如transaction)同样有效。未知值会在发送请求前被客户端拒绝。ENTITY_TYPE_K8S_POD - /
--start接受--end、now这类相对表达式,或RFC3339格式的时间戳。now-1h - 为必填项且可重复——需先通过
--column发现有效的列ID;API会拒绝未知的列ID。cx service-catalog schema <entity-type> - 仅可针对不同标签重复使用(多个过滤器为逻辑与关系);同一标签的多个值需用逗号组合,而非重复使用该参数——重复同一标签会被客户端拒绝。
--filter label=value1,value2 - 可选值为
--aggregation(当与table/--limit/--sort-column组合时的默认行为)或--sort-order。timeseries、--limit和--sort-column仅适用于--sort-order模式——后端在table模式下会静默忽略这些参数,因此CLI会提前拒绝这种组合,避免发送参数被悄悄丢弃的请求。timeseries - 会自动对实体ID进行百分号编码——直接传入
entity-data命令返回的ID即可(如entities),若包含checkout/api需加引号。/
Inspection Workflow
检查流程
Four steps, and only because each one supplies an input the next one requires:
gives valid values, gives valid
ids, gives the for a drilldown.
entity-types<entity-type>schema--columnentitiesentity-id-
Discover what entity types exist — never guess, they vary by account:bash
cx service-catalog entity-types -o json -
Check the schema for one entity type to find valid column ids and filterable/groupable labels:bash
cx service-catalog schema service -o json -
List known entities of that type (e.g. service names):bash
cx service-catalog entities service -o json -
Query data — aggregated across all entities, or scoped to one. Column ids, filter/group-by labels, and entity ids below are placeholders — always substitute values returned by/
schemafor the entity type in question, they vary by account and entity type:entitiesbashcx service-catalog data <entity-type> --start now-1h --end now \ --column <column-id> --column <column-id> -o json cx service-catalog entity-data <entity-type> <entity-id> --start now-1h --end now \ --column <column-id> -o json
分为四个步骤,每个步骤的输出作为下一个步骤的输入:提供有效的值,提供有效的 ID,提供钻取所需的。
entity-types<entity-type>schema--columnentitiesentity-id-
发现存在的实体类型——切勿猜测,不同账户的实体类型可能不同:bash
cx service-catalog entity-types -o json -
检查某一实体类型的schema,找到有效的列ID以及可过滤/可分组的标签:bash
cx service-catalog schema service -o json -
列出该类型的已知实体(如服务名称):bash
cx service-catalog entities service -o json -
查询数据——可针对所有实体的聚合数据,或单个实体的专属数据。以下示例中的列ID、过滤器标签、分组标签和实体ID均为占位符——需始终替换为对应实体类型的/
schema命令返回的值,不同账户和实体类型的值可能不同:entitiesbashcx service-catalog data <entity-type> --start now-1h --end now \ --column <column-id> --column <column-id> -o json cx service-catalog entity-data <entity-type> <entity-id> --start now-1h --end now \ --column <column-id> -o json
Examples
示例
The commands below use and for concreteness, but every
, , , and
must come from that entity type's own / output — never
assume a column or label from one entity type exists on another.
servicek8s-pod<column-id><filterable-label><groupable-label><entity-id>schemaentities以下命令以和为例,但所有、、和均需来自对应实体类型的/输出——切勿假设某一实体类型的列或标签在另一实体类型中存在。
servicek8s-pod<column-id><filterable-label><groupable-label><entity-id>schemaentitiesTop 5 entities by a metric in the last hour
过去一小时内指标排名前5的实体
bash
cx service-catalog schema service -o json # discover column ids first
cx service-catalog data service --start now-1h --end now \
--column <column-id> --aggregation table \
--sort-column <column-id> --sort-order desc --limit 5 -o jsonbash
cx service-catalog schema service -o json # 先发现列ID
cx service-catalog data service --start now-1h --end now \
--column <column-id> --aggregation table \
--sort-column <column-id> --sort-order desc --limit 5 -o jsonFilter to one label value
过滤到单个标签值
bash
cx service-catalog schema service -o json # discover filterable_labels first
cx service-catalog data service --start now-1h --end now \
--column <column-id> --column <column-id> \
--filter <filterable-label>=<value> -o jsonbash
cx service-catalog schema service -o json # 先发现可过滤标签
cx service-catalog data service --start now-1h --end now \
--column <column-id> --column <column-id> \
--filter <filterable-label>=<value> -o jsonGroup by a label
按标签分组
bash
cx service-catalog schema service -o json # discover groupable_labels first
cx service-catalog data service --start now-1h --end now \
--column <column-id> --group-by <groupable-label> -o jsonbash
cx service-catalog schema service -o json # 先发现可分组标签
cx service-catalog data service --start now-1h --end now \
--column <column-id> --group-by <groupable-label> -o jsonKubernetes pod resource saturation
Kubernetes Pod资源饱和度
bash
cx service-catalog schema k8s-pod -o json # discover column ids first
cx service-catalog data k8s-pod --start now-1h --end now \
--column <column-id> --column <column-id> --column <column-id> -o jsonbash
cx service-catalog schema k8s-pod -o json # 先发现列ID
cx service-catalog data k8s-pod --start now-1h --end now \
--column <column-id> --column <column-id> --column <column-id> -o jsonLatency over time for one entity
单个实体的延迟随时间变化
bash
cx service-catalog entities service -o json # discover entity ids first
cx service-catalog entity-data service <entity-id> --start now-24h --end now \
--column <column-id> --aggregation timeseries -o jsonbash
cx service-catalog entities service -o json # 先发现实体ID
cx service-catalog entity-data service <entity-id> --start now-24h --end now \
--column <column-id> --aggregation timeseries -o jsonJust the rows
仅获取行数据
bash
undefinedbash
undefinedTable responses live under .rows; timeseries under .series
表格响应位于.rows下;时间序列响应位于.series下
cx service-catalog data service --start now-1h --end now
--column <column-id> -o json | jq '.rows'
--column <column-id> -o json | jq '.rows'
undefinedcx service-catalog data service --start now-1h --end now
--column <column-id> -o json | jq '.rows'
--column <column-id> -o json | jq '.rows'
undefinedKey Principles
核心原则
- Discover before querying — and
entity-typesare cheap and answer "what's valid here" before spending aschema/datacall on a guess.entity-data - values are per-entity-type — a column valid for
--columnmay not exist forservice; always re-checkk8s-podwhen switching entity types.schema - Malformed responses are errors, not silent empty results — a column that is neither a value nor an error (or both) fails loudly rather than producing a partial or empty row, so a non-zero exit means investigate, not "no data".
- A column-level error is not a command failure — an individual column can
come back as inside an otherwise successful row (e.g. a query timeout for just that column); check per-column before assuming the whole request failed.
{"error": "..."} - vs
tableare mutually exclusive result shapes —timeseriesresponses are flat rows suitable fortable;-o json | jq '.rows'responses nest datapoints per series and are best consumed as raw JSON rather than forced into a table.timeseries - Use with
-o jsonfor filtering; usejqfor token-efficient output in agent contexts.-o agents - Multi-profile fan-out works on every subcommand — repeat to compare the same entity type/data across accounts; rows and series are tagged with
-p <profile>when more than one is given.profile
- 先发现再查询——和
entity-types命令开销低,能在发起schema/data查询前回答“此处哪些内容是有效的”,避免盲目猜测。entity-data - 值与实体类型绑定——某一实体类型(如
--column)有效的列,在另一实体类型(如service)中可能不存在;切换实体类型时务必重新检查k8s-pod。schema - 格式错误的响应会触发错误,而非静默返回空结果——若某列既非有效值也非错误(或两者皆是),会直接报错,而非返回部分或空行;因此非零退出码意味着需要排查问题,而非“无数据”。
- 列级错误不代表命令执行失败——单个列可能在成功返回的行中显示为(例如仅该列查询超时);在假设整个请求失败前,需检查每一列的状态。
{"error": "..."} - 与
table是互斥的结果格式——timeseries响应是扁平的行数据,适合通过table处理;-o json | jq '.rows'响应按序列嵌套数据点,最好直接以原始JSON格式使用,而非强行转换为表格。timeseries - 结合与
-o json进行过滤;在Agent环境中使用jq以获得高效的令牌输出。-o agents - 多配置文件扩展适用于所有子命令——重复使用可跨账户比较同一实体类型/数据;当指定多个配置文件时,行和序列会标记对应的
-p <profile>。profile
Related Skills
相关技能
- — infrastructure resource health (hosts, containers) is a distinct concept from Service Catalog entity health; use
cx-infrafor host/instance-level monitoring and this skill for application/service-level APM entities.cx-infra - — once a service or pod name surfaces from this skill's commands, pivot to raw telemetry:
cx-telemetry-queryingorcx logs "filter $l.subsystemname == '<service>'"to find related log/span fields. Correlate a latency or error spike with the underlying logs/spans.cx search-fields "<name>" -s value - —
cx-alertsfinds alert definitions matching a service surfaced by this skill.cx alerts list --name "<service-name>" - —
cx-dashboardsfinds dashboards built around a service found here.cx dashboards search "<service-name> ..."
- ——基础设施资源健康(主机、容器)与Service Catalog实体健康是不同概念;使用
cx-infra进行主机/实例级监控,使用本技能进行应用/服务级APM实体监控。cx-infra - ——当通过本技能获取到服务或Pod名称后,可转向原始遥测数据:
cx-telemetry-querying或cx logs "filter $l.subsystemname == '<service>'"以查找相关日志/追踪字段。将延迟或错误峰值与底层日志/追踪数据关联分析。cx search-fields "<name>" -s value - ——
cx-alerts可查找与本技能发现的服务匹配的告警规则。cx alerts list --name "<service-name>" - ——
cx-dashboards可查找围绕本技能发现的服务构建的仪表板。cx dashboards search "<service-name> ..."