Skip to content

Create an entity modelling guide #2328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jsuereth
Copy link
Contributor

@jsuereth jsuereth commented Jun 6, 2025

Fixes #2246

Changes

  • Creates new "how to write conventions" section in non-normative guidance
  • Adds "resource and entity" guidance to this section.

Please provide a brief description of the changes here.

Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.

Merge requirement checklist

@jsuereth jsuereth marked this pull request as ready for review June 6, 2025 14:04
@jsuereth jsuereth requested review from a team as code owners June 6, 2025 14:04
@github-actions github-actions bot added the enhancement New feature or request label Jun 6, 2025
Comment on lines +17 to +33
`model/{my_domain}/entities.yaml`:

```yaml
groups:
- id: entity.my_entity
type: entity
stability: development
name: my_entity
brief: >
A description of my_entity here.
attributes:
- ref: some.attribute
role: identifying
- ref: some.other_attribute
role: descriptive
...
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea to include an example!

where one or many of the named entities may be associated with the
metric. There is *no* requirement on disjointness due to how is-a
relationships are modelled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention that some entities (e.g. service) are implicitly associated with everything and don't need to be explicitly listed? Or should we encourage people to add all applicable ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question.

I think we encourage people to add applicable ones. I also wonder if we SHOULD list service on many conventions we have today, to denote we expect SDKs to have service and data to be attached to it as a minimum thing. WDYT?

Also cc @open-telemetry/specs-entities-approvers for thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's try explicitly listing it and see if/how we like it


- Default to introducing separate entities with a clear "is a" (or similar) relationship
- Extend an entity with new descriptive attributes if and only if the following is true:
- The extending entity cannot be associated with any telemetry by itself.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this sentence. maybe an example would be helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an example.

- Default to introducing separate entities with a clear "is a" (or similar) relationship
- Extend an entity with new descriptive attributes if and only if the following is true:
- The extending entity cannot be associated with any telemetry by itself.
- The extending entity doesn’t have any other entities that logically can only be associated with it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't understand this one either

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one I get. I can get rid of this when entity is a "signal" type, but effectively this is when you don't expect to report relationships for the entity. It's just a special case of the first rule, but needs to be clarified prior to entity-as-a-signal (phase 2 for Entities work) being defined in the specification.

the SDK that is externally visible. An alternative is to have the SDK
provide a relationship between the service.instance.id and another entity
that is visible externally. Care should be taken when modelling Entities
to avoid this problem where possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some reasoning/explanation that despite being anti-pattern, we make service.instance.id identifiable in https://github.com/open-telemetry/semantic-conventions/pull/2278/files#diff-3d85dfd25c44f916cd9a6c53adf7628b01d37ce93cd2fd5083567af3ee9a64ef due to its usefulness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is describing that care that needs to be taken even when using service.instance.id to make sure you don't wind up with different identity depending on who's observing it. It's a bit of a major problem today, and manifests on kubernetes in this way:

  • Reading container logs on a VM and trying to identify if those logs came from an OTEL service.
  • Reading metrics via prometheus and trying to identify if those metrics came from an OTEL service.
  • Accepting OTLP where the SDK did local discovery of OTEL service.

If you're not careful, you can wind up with three different service.instance.ids for the same SDK.

See:

So this guidance is actually helping users understand the "magic" for how service.instance.id can work, and why it's horribly confusing when it doesn't.

While we can allow more things like service.instance.id I don't think we need to or should unless there's no alternative (which there is not for service.instance.id). That's why the guidance in semconv is to have a system of record from which multiple observers can obtain the same identifier.


Regarding adding more rationale in this guide - I'll see what I can add.

Do you think what I typed here makes sense for the guide?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Needs More Approval
Development

Successfully merging this pull request may close these issues.

[entities] Adding Entity Support to Semantic Conventions
2 participants