Skip to content
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

Start Entities Prototype #244

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

Conversation

tigrannajaryan
Copy link
Owner

@tigrannajaryan tigrannajaryan commented Feb 21, 2024

Changes

  • Added Producing Entity to the internal 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 entity into account.
  • Added resource.NewWithEntity() to allow creating resources with non-service producing entities.
  • Updated OTLP exporters to include entity info in the Resource.

Results

Example output from namedtracer example (no code changes in the example itself) is below.

Note "Entity" under the "Resource".

{
        "Name": "Sub operation...",
        "SpanContext": {
                "TraceID": "0d5a05133e2546b3f78e2149d24da597",
                "SpanID": "6af308754cae0e4b",
                "TraceFlags": "01",
                "TraceState": "",
                "Remote": false
        },
        "Parent": {
                "TraceID": "0d5a05133e2546b3f78e2149d24da597",
                "SpanID": "70cd96e4d83b9e56",
                "TraceFlags": "01",
                "TraceState": "",
                "Remote": false
        },
        "SpanKind": 1,
        "StartTime": "2024-02-21T14:18:24.338284-05:00",
        "EndTime": "2024-02-21T14:18:24.338288458-05:00",
        "Attributes": [
                {
                        "Key": "ex.com/lemons",
                        "Value": {
                                "Type": "STRING",
                                "Value": "five"
                        }
                }
        ],
        "Events": [
                {
                        "Name": "Sub span event",
                        "Attributes": null,
                        "DroppedAttributeCount": 0,
                        "Time": "2024-02-21T14:18:24.338288-05:00"
                }
        ],
        "Links": null,
        "Status": {
                "Code": "Unset",
                "Description": ""
        },
        "DroppedAttributes": 0,
        "DroppedEvents": 0,
        "DroppedLinks": 0,
        "ChildSpanCount": 0,
        "Resource": {
                "Attributes": [
                        {
                                "Key": "service.name",
                                "Value": {
                                        "Type": "STRING",
                                        "Value": "unknown_service:___go_build_go_opentelemetry_io_otel_example_namedtracer"
                                }
                        },
                        {
                                "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",
                "Entity": {
                        "Type": "service",
                        "Id": [
                                {
                                        "Key": "service.name",
                                        "Value": {
                                                "Type": "STRING",
                                                "Value": "unknown_service:___go_build_go_opentelemetry_io_otel_example_namedtracer"
                                        }
                                }
                        ]
                }
        },
        "InstrumentationLibrary": {
                "Name": "example/namedtracer/foo",
                "Version": "",
                "SchemaURL": ""
        }
}

@tigrannajaryan tigrannajaryan changed the title Add entities prototype Start Entities Prototype Feb 21, 2024
mergedType = a.Type
mergedId = mergeAttrs(&b.Id, &a.Id)
} else {
if a.Type == "" {
Copy link

Choose a reason for hiding this comment

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

The OTEP says the entity type must not be empty.

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