Skip to content

[Draft, do not merge] Entities Prototype #5918

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

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

tigrannajaryan
Copy link
Member

Changes

  • Added entity refs to the Resource representation.
  • Made default Service detector produce a Resource with "service" entity type.
  • Modified stdout exporters to include entity information in the output.
  • Modified Resource.Merge() to use the new logic that takes the entities into account.
  • Added resource.NewWithEntities() to allow creating resources with entities.
  • Updated OTLP exporters to include entity info in the Resource.
  • Modified some existing resource some detectors to include entities (WithProcess, WithHostID) and added WithHostEntity to demonstrate how detectors work.

Results

Example output from dice example is below.

Note EntityRefs under the Resource.

{
        "Resource": {
                "Attributes": [
                        {
                                "Key": "host.id",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "4A135D30-F122-5869-9399-30339FDAE584"
                                }
                        },
                        {
                                "Key": "host.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "KYW9LWX6YV"
                                }
                        },
                        {
                                "Key": "process.command_args",
                                "Value": {
                                        "Type": "STRINGSLICE",
                                        "Value": [
                                                "/Users/tnajaryan/Library/Caches/JetBrains/GoLand2024.2/tmp/GoLand/___go_build_go_opentelemetry_io_otel_example_dice"
                                        ]
                                }
                        },
                        {
                                "Key": "process.executable.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "___go_build_go_opentelemetry_io_otel_example_dice"
                                }
                        },
                        {
                                "Key": "process.executable.path",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "/Users/tnajaryan/Library/Caches/JetBrains/GoLand2024.2/tmp/GoLand/___go_build_go_opentelemetry_io_otel_example_dice"
                                }
                        },
                        {
                                "Key": "process.owner",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "tnajaryan"
                                }
                        },
                        {
                                "Key": "process.pid",
                                "Value": {
                                        "Type": "INT64",
                                        "Value": 91752
                                }
                        },
                        {
                                "Key": "process.runtime.description",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "go version go1.23.2 darwin/arm64"
                                }
                        },
                        {
                                "Key": "process.runtime.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "go"
                                }
                        },
                        {
                                "Key": "process.runtime.version",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "go1.23.2"
                                }
                        },
                        {
                                "Key": "service.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "dice"
                                }
                        },
                        {
                                "Key": "service.version",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "0.1.0"
                                }
                        },
                        {
                                "Key": "telemetry.sdk.language",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "go"
                                }
                        },
                        {
                                "Key": "telemetry.sdk.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "opentelemetry"
                                }
                        },
                        {
                                "Key": "telemetry.sdk.version",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "1.23.0-rc.1"
                                }
                        }
                ],
                "SchemaURL": "https://opentelemetry.io/schemas/1.24.0",
                "EntityRefs": [
                        {
                                "Type": "service",
                                "Id": [
                                        "service.name",
                                        "service.version"
                                ],
                                "Attrs": null,
                                "SchemaURL": "https://opentelemetry.io/schemas/1.24.0"
                        },
                        {
                                "Type": "host",
                                "Id": [
                                        "host.id"
                                ],
                                "Attrs": [
                                        "host.name"
                                ],
                                "SchemaURL": "https://opentelemetry.io/schemas/1.24.0"
                        },
                        {
                                "Type": "process",
                                "Id": [
                                        "process.pid"
                                ],
                                "Attrs": [
                                        "process.runtime.description",
                                        "process.executable.name",
                                        "process.executable.path",
                                        "process.command_args",
                                        "process.owner",
                                        "process.runtime.name",
                                        "process.runtime.version"
                                ],
                                "SchemaURL": "https://opentelemetry.io/schemas/1.24.0"
                        }
                ]
        },
        "ScopeMetrics": []
}

@tigrannajaryan
Copy link
Member Author

I updated this PR to make Resource comparable as required by #6272

jsuereth added a commit to open-telemetry/opentelemetry-specification that referenced this pull request Apr 10, 2025
Adds an initial cut at the Entity DataModel specification from OTEP 256.

## Changes

- Adds information to Resource readme.
- Creates an initial Resource DataModel with content from Entities SIG
discussions on purpose and usage or Resource.
- Creates an `entities` diretory for storing Entities DataModel.

See open-telemetry/opentelemetry-proto#635 for
related protocol change.

Prototypes:

- java: open-telemetry/opentelemetry-java#6855
- collector:
open-telemetry/opentelemetry-collector#11958
- go: open-telemetry/opentelemetry-go#5918

---------

Co-authored-by: Daniel Dyla <[email protected]>
Co-authored-by: Nathan L Smith <[email protected]>
Co-authored-by: Christophe Kamphaus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants