オブジェクトパターンは、オブジェクトセマンティクスを備えた、統一され、抽象的で、拡張可能なクエリ機能を提供します。これは、EntitySet のコンテキストでメソッド (entity-call) を呼び出すことによって機能します。この Topic では、構文、パラメーター、例など、メソッドをカテゴリ別に要約しています。この情報は、メソッドを迅速に統合し、動的に呼び出すのに役立ちます。
一般的な構文:
.entity_set with(domain='domain_name', name='entity_name', [ids|query|other_parameters])
| entity-call method_name(parameters...)
一般的なパラメーター:
パラメーター | タイプ | 必須 | 説明 | 例 |
domain | string | はい | EntitySet のドメイン。 | ‘apm’ |
name | string | はい | EntitySet の名前。 | ‘apm.service’ |
ids | array | いいえ | エンティティ ID のリスト。 | [‘id1’,‘id2’] |
query | string | いいえ | フィルター条件。詳細については、「SPL 構文」をご参照ください。 | ‘service_id = “xxx”’ |
注: メソッドの可用性、パラメーター、および戻り値は、エンティティに関連付けられているデータセットまたはリンクによって異なります。__list_method__() メソッドを使用して、機能を動的に検出できます。
1. 組み込みエンティティメソッド
1.1 list_method (メソッドリスト)
説明: 現在の
EntitySetでサポートされているすべてのメソッド、パラメーター スキーマ、および戻り値スキーマをリストします。例:
.entity_set with(domain='apm', name='apm.service') | entity-call __list_method__()返されるフィールド:
name、display_name、description、params(JSON 配列)、およびreturns(JSON 配列)。
1.2 get_entity_set (現在のエンティティ定義の取得)
説明: 外部データセットにアクセスせずに、現在の
EntitySetの定義を返します。パラメーター:
パラメーター
タイプ
必須
説明
例
detail
boolean
いいえ
完全な定義を JSON フォーマットで返すかどうかを指定します。
false
例:
.entity_set with(domain='apm', name='apm.service') | entity-call get_entity_set()返されるフィールド:
entity_set_id、domain、name、filterable_fields、fields、およびentity_set_detail。
1.3 list_data_set (関連データセットのリスト)
説明: 現在のエンティティに関連付けられているデータセットをリストします。これらのデータセットには、MetricSet、LogSet、TraceSet、EventSet、ProfileSet などのタイプが含まれます。
パラメーター:
パラメーター
タイプ
必須
説明
例
data_set_types
array
いいえ
データセットタイプで結果をフィルターします。
[‘metric_set’]
detail
boolean
いいえ
詳細情報を返すかどうかを指定します。
true
例:
.entity_set with(domain='apm', name='apm.service') | entity-call list_data_set(['metric_set'], true)返されるフィールド:
data_set_id、type、domain、name、fields_mapping、filterable_fields、fields、data_link_detail、およびdata_set_detail。
1.4 list_related_entity_set (関連エンティティのリスト)
説明: 現在の
EntitySetに関連する他のエンティティセットをリストします。パラメーター:
パラメーター
タイプ
必須
説明
例
relations
array
いいえ
関係タイプで結果をフィルターします。
[‘contains’]
direction
string
いいえ
関係の方向。「in」、「out」、「both」が有効な値です。
‘out’
detail
boolean
いいえ
詳細情報を返すかどうかを指定します。
true
例:
.entity_set with(domain='apm', name='apm.service') | entity-call list_related_entity_set(['contains'], 'out')返されるフィールド:
entity_set_id、relation、direction、domain、name、fields_mapping、fields、relation_data_sets、entity_link_detail、およびentity_set_detail。
1.5 inspect (構成チェック)
説明: UModel 構成の完全性と正確性を検証します。エラー、警告、ヒントを含む構造化されたレポートを出力します。
パラメーター: なし
2. エンティティリストのアクセスメソッド
2.1 get_entities (エンティティリスト)
説明: 現在の
EntitySet内のエンティティのリストを取得します。一般的なコンテキストパラメーターを使用して、フィルター条件と ID リストを渡すことができます。すべてのエンティティを取得:
.entity_set with(domain='apm', name='apm.service')
| entity-call get_entities()
返される SPL:
.entity with(domain='apm', type='apm.service')
ID でエンティティを取得:
.entity_set with(domain='apm', name='apm.service', ids=['4503c9','35353'])
| entity-call get_entities()
返される SPL は次のとおりです:
.entity with(domain='apm', type='apm.service', entityIds='4503c9,35353')
条件でエンティティを取得:
.entity_set with(domain='apm', name='apm.service', query='service = "order"')
| entity-call get_entities()
返される SPL:
.entity with(domain='apm', type='apm.service') | where service = 'order'
2.2 get_neighbor_entities (隣接エンティティ)
説明: 現在のエンティティの隣接エンティティである他のエンティティを取得します。関係タイプと方向でフィルターできます。
パラメーター:
パラメーター
タイプ
必須
説明
dest_entity_set_domain
string
いいえ
宛先エンティティのドメイン名。空の場合、すべてのドメインが含まれます。
dest_entity_set_name
string
いいえ
宛先エンティティの名前。空の場合、すべての名前が含まれます。
dest_entity_ids
array
いいえ
宛先エンティティ ID のリスト。空の配列はすべての ID を含みます。
dest_entity_filter
string
いいえ
宛先エンティティのフィルター条件。空の場合、フィルターは適用されません。
relation_type
string
いいえ
関係タイプ。空の場合、すべてのタイプが含まれます。
direction
string
いいえ
関係の方向。「in」、「out」、「both」が有効な値です。空の場合、すべての方向が含まれます。
例:
.entity_set with(domain='apm', name='apm.service', ids=['aa158','xxx']) | entity-call get_neighbor_entities('apm','apm.external.rpc_client',['abc123'], 'region_id = "cn-hongkong" and call_type = "grpc_client" and instance_addr = "cart"', 'contains','out')戻り値:
propertiesのリスト。リスト内の各項目は、宛先エンティティのpropertiesJSON オブジェクトです。
3. データセットのアクセスメソッド
3.1 get_golden_metrics (ゴールデンメトリックコレクション)
説明: エンティティに関連付けられた MetricSet から「ゴールデンメトリック」としてマークされた時系列を取得します。このメソッドは最大 10 個のゴールデンメトリックを返します。
パラメーター:
パラメーター
タイプ
必須
説明
デフォルト
query_type
string
いいえ
'range' または 'instant'
‘range’
step
string
いいえ
ステップサイズは range にのみ適用されます。
自動
aggregate
boolean
いいえ
結果を集計するかどうかを指定します。
true
例:
.entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"') | entity-call get_golden_metrics('range', '1m')戻り値:
metric、__labels__、__ts__、および__value__。
3.2 get_metric (メトリックデータの取得)
説明: 関連する MetricSet からメトリックデータを取得します。フィールドマッピングとフィルター条件は自動的に適用されます。
パラメーター:
パラメーター
タイプ
必須
説明
domain
string
はい
MetricSet のドメイン名。
name
string
はい
MetricSet の名前。
metric
string
はい
メトリックの名前。
query_type
string
いいえ
'range' または 'instant'
step
string
いいえ
ステップサイズ。
aggregate
boolean
いいえ
結果を集計するかどうかを指定します。
例:
.entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"') | entity-call get_metric('apm', 'apm.metric.apm.service', 'request_count', 'range', '1m')
3.3 get_label_values (ラベル値の取得)
パラメーター:
パラメーター
タイプ
必須
説明
domain
string
はい
MetricSet のドメイン名。
name
string
はい
MetricSet の名前。
label
string
はい
ラベルの名前。
例:
.entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"') | entity-call get_label_values('apm', 'apm.metric.apm.service', 'region')
3.4 get_log/get_trace/get_event/get_profile (ログ/トレース/イベント/プロファイルデータの取得)
パラメーター:
パラメーター
タイプ
必須
説明
domain
string
はい
LogSet のドメイン名。
name
string
はい
LogSet の名前。
例:
.entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"') | entity-call get_log('apm', 'apm.log.app')
4. リレーショナルデータアクセスメソッド
4.1 get_relation_golden_metrics (リレーショナルゴールデンメトリック)
説明: エンティティリレーションシップのゴールデンメトリックを取得します。このメソッドは、ソースエンティティと宛先エンティティのデータを使用して、フィルター条件を自動的に構築し、フィールドマッピングを適用します。
パラメーター:
パラメーター
タイプ
必須
説明
dest_entity_set_domain
string
はい
宛先エンティティのドメイン名。
dest_entity_set_name
string
はい
宛先エンティティの名前。
entity_ids
array
いいえ
宛先エンティティ ID のリスト。これは空の配列にすることができます。
dest_entity_filter
string
いいえ
宛先エンティティのフィルター条件。これは空の文字列にすることができます。
entity_link_type
string
はい
'calls' や 'contains' などの関係タイプ。
direction
string
はい
関係の方向。「in」と「out」が有効な値です。
query_type
string
いいえ
`range` または `instant`
step
string
いいえ
ステップサイズ。このパラメーターは `query_type` が 'range' の場合にのみ有効です。
aggregate
boolean
いいえ
結果を集計するかどうかを指定します。
例:
.entity_set with(domain='apm', name='apm.service', query='service = "service-a"') | entity-call get_relation_golden_metrics( 'apm', 'apm.service', [], 'service = "service-b"', 'calls', 'out', 'range', '5m', false )戻り値:
metric、__labels__、__ts__、および__value__。
4.2 get_relation_metric (リレーショナルメトリック)
説明: エンティティリレーションシップについて、指定された MetricSet からメトリックデータを取得します。
パラメーター:
パラメーター | タイプ | 必須 | 説明 |
dest_entity_set_domain | string | はい | 宛先エンティティのドメイン名。 |
dest_entity_set_name | string | はい | 宛先エンティティの名前。 |
dest_entity_ids | array | はい | 宛先エンティティ ID のリスト。これは空の配列にすることができます。 |
dest_entity_filter | string | はい | 宛先エンティティのフィルター条件。これは空の文字列にすることができます。 |
entity_link_type | string | はい | 'calls' や 'contains' などの関係タイプ。 |
direction | string | はい | 関係の方向。「in」と「out」が有効な値です。 |
metric_set_domain | string | はい | MetricSet のドメイン名。 |
metric_set_name | string | はい | MetricSet の名前。 |
metric | string | はい | メトリックの名前。 |
query_type | string | いいえ | 'range' または 'instant' |
step | string | いいえ | ステップサイズ。 |
aggregate | boolean | いいえ | 結果を集計するかどうかを指定します。 |
例:
.entity_set with(domain='apm', name='apm.service', query='service = "service-a"')
| entity-call get_relation_metric(
'apm', 'apm.service', [], 'service = "service-b"',
'calls', 'out',
'apm', 'apm.metric.service_calls_service',
'request_count', 'range', '5m'
)
4.3 get_relation_label_values (リレーショナルラベル値)
説明: エンティティリレーションシップについて、関連する MetricSet からラベル値を取得します。
パラメーター:
パラメーター | タイプ | 必須 | 説明 |
dest_entity_set_domain | string | はい | 宛先エンティティのドメイン名。 |
dest_entity_set_name | string | はい | 宛先エンティティの名前。 |
dest_entity_ids | array | はい | 宛先エンティティ ID のリスト。 |
dest_entity_filter | string | はい | 宛先エンティティのフィルター条件。 |
entity_link_type | string | はい | 関係タイプ。 |
direction | string | はい | 関係の方向。「in」と「out」が有効な値です。 |
metric_set_domain | string | はい | MetricSet のドメイン名。 |
metric_set_name | string | はい | MetricSet の名前。 |
label | string | いいえ | ラベルの名前。このパラメーターが空または指定されていない場合、すべてのラベルが含まれます。 |
例:
.entity_set with(domain='apm', name='apm.service', query='service_id = "service-a"')
| entity-call get_relation_label_values(
'apm', 'apm.operation', [], 'service = "service-a"',
'contains', 'out',
'apm', 'apm.metric.apm.operation',
'rpc'
)
4.4 get_relation_log/get_relation_trace/get_relation_event/get_relation_profile (リレーショナルログ/トレース/イベント/プロファイル)
説明: エンティティリレーションシップについて、関連するデータセットからログ、トレース、イベント、またはプロファイルデータを取得します。
パラメーター:
パラメーター | タイプ | 必須 | 説明 |
dest_entity_set_domain | string | はい | 宛先エンティティのドメイン名。 |
dest_entity_set_name | string | はい | 宛先エンティティの名前。 |
dest_entity_ids | array | はい | 宛先エンティティ ID のリスト。 |
dest_entity_filter | string | はい | 宛先エンティティのフィルター条件。 |
entity_link_type | string | はい | 関係タイプ。 |
direction | string | はい | 関係の方向。「in」と「out」が有効な値です。 |
log_set_domain | string | はい | LogSet のドメイン名。 |
log_set_name | string | はい | LogSet の名前。 |
例:
.entity_set with(domain='apm', name='apm.service', ids=['dc5abde8cd8cbc1fd142927f006f694d']) | entity-call get_relation_log( 'apm', 'apm.operation', ['dc5abde8cd8cbc1fd142927f006f694a'], '', 'contains', 'out', 'apm', 'apm.log.relation' )