Phase 2 Object pattern - Method list

Updated at:

The Object pattern provides unified, abstract, and extensible query capabilities with object semantics by calling methods (entity-call) in the context of an EntitySet. The following sections list the methods by category, with their syntax, parameters, and examples.

General syntax:

.entity_set with(domain='domain_name', name='entity_name', [ids|query|other_parameters])
| entity-call method_name(parameters...)

General parameters:

Parameter

Type

Required

Description

Example

domain

string

Yes

The domain of the EntitySet.

‘apm’

name

string

Yes

The name of the EntitySet.

‘apm.service’

ids

array

No

A list of entity IDs.

[‘id1’,‘id2’]

query

string

No

The filter condition. For more information, see SPL syntax.

‘service_id = “xxx”’

Note: The availability, parameters, and return values of a method vary depending on the dataset or link associated with the entity. Use the __list_method__() method to discover capabilities dynamically.

1. Built-in entity methods

1.1 list_method (Method list)

  • Description: Lists all supported methods, parameter schemas, and return schemas for the current EntitySet.

  • Example:

    .entity_set with(domain='apm', name='apm.service')
    | entity-call __list_method__()
    
  • Returned fields: name, display_name, description, params (JSON array), and returns (JSON array).

1.2 get_entity_set (Get current entity definition)

  • Description: Returns the definition of the current EntitySet without accessing any external datasets.

  • Parameters:

    Parameter

    Type

    Required

    Description

    Example

    detail

    boolean

    No

    Whether to return the complete definition in JSON format.

    false

  • Example:

    .entity_set with(domain='apm', name='apm.service')
    | entity-call get_entity_set()
    
  • Returned fields: entity_set_id, domain, name, filterable_fields, fields, and entity_set_detail.

1.3 list_data_set (List associated datasets)

  • Description: Lists the datasets associated with the current entity, including MetricSet, LogSet, TraceSet, EventSet, and ProfileSet.

  • Parameters:

    Parameter

    Type

    Required

    Description

    Example

    data_set_types

    array

    No

    Filters the results by dataset type.

    [‘metric_set’]

    detail

    boolean

    No

    Whether to return detailed information.

    true

  • Example:

    .entity_set with(domain='apm', name='apm.service')
    | entity-call list_data_set(['metric_set'], true)
    
  • Returned fields: data_set_id, type, domain, name, fields_mapping, filterable_fields, fields, data_link_detail, and data_set_detail.

  • Description: Lists other entity sets that are related to the current EntitySet.

  • Parameters:

    Parameter

    Type

    Required

    Description

    Example

    relations

    array

    No

    Filters the results by relationship type.

    [‘contains’]

    direction

    string

    No

    The direction of the relationship. Valid values are 'in', 'out', and 'both'.

    ‘out’

    detail

    boolean

    No

    Whether to return detailed information.

    true

  • Example:

    .entity_set with(domain='apm', name='apm.service')
    | entity-call list_related_entity_set(['contains'], 'out')
    
  • Returned fields: entity_set_id, relation, direction, domain, name, fields_mapping, fields, relation_data_sets, entity_link_detail, and entity_set_detail.

1.5 inspect (Configuration check)

  • Description: Validates the completeness and correctness of the UModel configuration and outputs a structured report with errors, warnings, and tips.

  • Parameters: None

2. Entity list access methods

2.1 get_entities (Entity list)

  • Description: Retrieves the list of entities in the current EntitySet. Filter conditions and ID lists can be passed through the general context parameters.

  • Get all entities:

.entity_set with(domain='apm', name='apm.service')
| entity-call get_entities()

Returned SPL:

.entity with(domain='apm', type='apm.service')
  • Get entities by ID:

.entity_set with(domain='apm', name='apm.service', ids=['4503c9','35353'])
| entity-call get_entities()

Returned SPL:

.entity with(domain='apm', type='apm.service', entityIds='4503c9,35353')
  • Retrieve entities by condition:

.entity_set with(domain='apm', name='apm.service', query='service = "order"')
| entity-call get_entities()

Returned SPL:

.entity with(domain='apm', type='apm.service') | where service = 'order'

2.2 get_neighbor_entities (Neighboring entities)

  • Description: Retrieves entities that are neighbors of the current entity, with optional filtering by relationship type and direction.

  • Parameters:

    Parameter

    Type

    Required

    Description

    dest_entity_set_domain

    string

    No

    The domain name of the destination entity. If empty, all domains are included.

    dest_entity_set_name

    string

    No

    The name of the destination entity. If empty, all names are included.

    dest_entity_ids

    array

    No

    A list of destination entity IDs. An empty array includes all IDs.

    dest_entity_filter

    string

    No

    The filter condition for the destination entity. If empty, no filter is applied.

    relation_type

    string

    No

    The relationship type. If empty, all types are included.

    direction

    string

    No

    The direction of the relationship. Valid values are 'in', 'out', and 'both'. If empty, all directions are included.

  • Example:

    .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')
    
  • Returns: A list of properties. Each item in the list is the properties JSON object of a destination entity.

3. Dataset access methods

3.1 get_golden_metrics (Golden metrics collection)

  • Description: Retrieves up to 10 time series marked as "golden metrics" from the MetricSet associated with the entity.

  • Parameters:

    Parameter

    Type

    Required

    Description

    Default

    query_type

    string

    No

    'range' or 'instant'

    ‘range’

    step

    string

    No

    The step size. Applicable only to range queries.

    Automatic

    aggregate

    boolean

    No

    Whether to aggregate the results.

    true

  • Example:

    .entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"')
    | entity-call get_golden_metrics('range', '1m')
    
  • Returns: metric, __labels__, __ts__, and __value__.

3.2 get_metric (Get metric data)

  • Description: Retrieves metric data from the associated MetricSet. Field mappings and filter conditions are applied automatically.

  • Parameters:

    Parameter

    Type

    Required

    Description

    domain

    string

    Yes

    The domain name of the MetricSet.

    name

    string

    Yes

    The name of the MetricSet.

    metric

    string

    Yes

    The name of the metric.

    query_type

    string

    No

    'range' or 'instant'

    step

    string

    No

    The step size.

    aggregate

    boolean

    No

    Whether to aggregate the results.

  • Example:

    .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 (Get label values)

  • Parameters:

    Parameter

    Type

    Required

    Description

    domain

    string

    Yes

    The domain name of the MetricSet.

    name

    string

    Yes

    The name of the MetricSet.

    label

    string

    Yes

    The name of the label.

  • Example:

    .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 (Get log/trace/event/profile data)

  • Parameters:

    Parameter

    Type

    Required

    Description

    domain

    string

    Yes

    The domain name of the LogSet.

    name

    string

    Yes

    The name of the LogSet.

  • Example:

    .entity_set with(domain='apm', name='apm.service', query='service_id = "order-service"')
    | entity-call get_log('apm', 'apm.log.app')
    

4. Relational data access methods

4.1 get_relation_golden_metrics (Relational golden metrics)

  • Description: Retrieves golden metrics for an entity relationship. Filter conditions and field mappings are automatically built from the source and destination entity data.

  • Parameters:

    Parameter

    Type

    Required

    Description

    dest_entity_set_domain

    string

    Yes

    The domain name of the destination entity.

    dest_entity_set_name

    string

    Yes

    The name of the destination entity.

    entity_ids

    array

    No

    A list of destination entity IDs. This can be an empty array.

    dest_entity_filter

    string

    No

    The filter condition for the destination entity. This can be an empty string.

    entity_link_type

    string

    Yes

    The relationship type, such as 'calls' or 'contains'.

    direction

    string

    Yes

    The direction of the relationship. Valid values are 'in' and 'out'.

    query_type

    string

    No

    `range` or `instant`

    step

    string

    No

    The step size. This parameter is valid only when `query_type` is 'range'.

    aggregate

    boolean

    No

    Whether to aggregate the results.

  • Example:

    .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
    )
    
  • Returns: metric, __labels__, __ts__, and __value__.

4.2 get_relation_metric (Relational metric)

  • Description: Retrieves metric data from a specified MetricSet for an entity relationship.

  • Parameters:

Parameter

Type

Required

Description

dest_entity_set_domain

string

Yes

The domain name of the destination entity.

dest_entity_set_name

string

Yes

The name of the destination entity.

dest_entity_ids

array

Yes

A list of destination entity IDs. This can be an empty array.

dest_entity_filter

string

Yes

The filter condition for the destination entity. This can be an empty string.

entity_link_type

string

Yes

The relationship type, such as 'calls' or 'contains'.

direction

string

Yes

The direction of the relationship. Valid values are 'in' and 'out'.

metric_set_domain

string

Yes

The domain name of the MetricSet.

metric_set_name

string

Yes

The name of the MetricSet.

metric

string

Yes

The name of the metric.

query_type

string

No

'range' or 'instant'

step

string

No

The step size.

aggregate

boolean

No

Whether to aggregate the results.

  • Example:

.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 (Relational label values)

  • Description: Retrieves the label values from the associated MetricSet for an entity relationship.

  • Parameters:

Parameter

Type

Required

Description

dest_entity_set_domain

string

Yes

The domain name of the destination entity.

dest_entity_set_name

string

Yes

The name of the destination entity.

dest_entity_ids

array

Yes

A list of destination entity IDs.

dest_entity_filter

string

Yes

The filter condition for the destination entity.

entity_link_type

string

Yes

The relationship type.

direction

string

Yes

The direction of the relationship. Valid values are 'in' and 'out'.

metric_set_domain

string

Yes

The domain name of the MetricSet.

metric_set_name

string

Yes

The name of the MetricSet.

label

string

No

The name of the label. If this parameter is empty or not specified, all labels are included.

  • Example:

.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 (Relational log/trace/event/profile)

  • Description: Retrieves log, trace, event, or profile data from the associated dataset for an entity relationship.

  • Parameters:

Parameter

Type

Required

Description

dest_entity_set_domain

string

Yes

The domain name of the destination entity.

dest_entity_set_name

string

Yes

The name of the destination entity.

dest_entity_ids

array

Yes

A list of destination entity IDs.

dest_entity_filter

string

Yes

The filter condition for the destination entity.

entity_link_type

string

Yes

The relationship type.

direction

string

Yes

The direction of the relationship. Valid values are 'in' and 'out'.

log_set_domain

string

Yes

The domain name of the LogSet.

log_set_name

string

Yes

The name of the LogSet.

  • Example:

    .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'
    )