Entity modeling

Updated at:

Overview

An EntitySet is a core concept in UModel that defines a set of observable entities. It defines the structure, properties, and behavior for a class of entity resources and is a fundamental element for building observable data models.

An EntitySet uses a unified entity definition to:

  • Standardize descriptions of various resources in an IT environment.

  • Establish relationships between entities.

  • Support entity lifecycle management.

  • Perform cross-domain data fusion and analysis.

Case study materials

Download the materials for this use case: umodel-enrich-dev.zip.

EntitySet definition and design principles

Core definition

An EntitySet is an abstract definition of a class of entities. It includes:

  • Entity type identity: A unique name that identifies the entity class.

  • Field structure: The property fields and constraints of the entity.

  • Primary key design: The identity field that uniquely identifies an entity.

  • Metadata: The display name, description, and other information about the entity.

Design principles

  1. Single responsibility principle: Each EntitySet should describe only one type of entity.

  2. Clear border principle: Entity borders should be clear to avoid conceptual overlap.

  3. Evolution and compatibility principle: Consider future extension requirements during design to maintain backward compatibility.

Entity field design

Field types and properties

Fields in an EntitySet have rich configuration options. For more information, see Field system. 

  • Primary key field design: A primary key field uniquely identifies an entity. Single-field and composite primary keys are supported.

    Design requirement

    Description

    Recommended practice

    Practice to avoid

    Uniqueness guarantee

    The primary key field must uniquely identify an entity in the system.

    service_name + cluster_name

    Using non-unique fields, such as port.

    Stability requirement

    The primary key must remain stable throughout the entity lifecycle.

    service_id, hostname

    ip_address, process_id

    Semantic clarity

    The primary key should have clear business semantics.

    service_name, pod_name

    uuid, hash_value

  • Primary key type configuration

    Primary key type

    Configuration example

    Scenario

    Single-field primary key

    primary_key_fields: ["service_name"]

    Globally unique entities.

    Composite primary key

    primary_key_fields: ["service_name", "cluster_name"]

    Entities that require a combination of multiple fields for unique identification.

Entity lifecycle management

Lifecycle stages

An entity in UModel has the following lifecycle stages:

Stage

Description

Behavior

Active

The entity is active.

During the active period, the entity can be queried.

Expired

The entity has expired.

The entity is marked as expired. It cannot be queried in the latest time range, but can still be queried within its survival period.

Deleted

The entity is deleted.

After the last report, the entity is deleted when a specific Time to Live (TTL) expires. The default TTL is 30 days. A deleted entity cannot be queried.

Semantics of time fields

Field name

Field configuration

Semantics

Purpose

Management method

First observed time

first_observed_time_field

The time when the entity was first observed by the system.

Determines the creation time of the entity.

Set at creation and does not change. This field can be left empty if the reporting program does not include a status.

Last observed time

last_observed_time_field

The time when the entity was last observed by the system.

Determines the active status of the entity.

Refreshed at each update.

Keepalive time

keep_alive_seconds

The survival period of the entity after the last observed time.

Determines the visibility scope of the entity.

Configure a static field. The default value is 3600 seconds.

Entity visibility period

  • The entity visibility period is calculated as a left-closed, right-open interval: [First observed time, Last observed time + Keepalive time).

  • The following examples show how the entity visibility period is calculated:

    1. If the first observed time is 2024-01-01 10:00:00, the last observed time is 2024-01-01 11:00:00, and the keepalive time is 3600 seconds, the entity visibility period is [2024-01-01 10:00:00, 2024-01-01 12:00:00).

    2. If the first observed time is 2024-01-01 10:00:00, the last observed time is 2024-01-01 12:00:00, and the keepalive time is 300 seconds, the entity visibility period is [2024-01-01 10:00:00, 2024-01-01 12:05:00).