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

host.id is set to empty value in containerized setups #4312

Closed
mx-psi opened this issue Jul 14, 2023 · 3 comments · Fixed by #4317
Closed

host.id is set to empty value in containerized setups #4312

mx-psi opened this issue Jul 14, 2023 · 3 comments · Fixed by #4317
Labels
area:resources Part of OpenTelemetry resources bug Something isn't working help wanted Extra attention is needed

Comments

@mx-psi
Copy link
Member

mx-psi commented Jul 14, 2023

Description

The resource.WithHostID option sets the host.id resource attribute to the empty string on (certain) containerized setups. The attribute should be set in accordance to the specification which states that host.id should be a:

Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the machine-id. See the table below for the sources to use to determine the machine-id based on operating system.

An empty string is not a unique host ID.

Environment

  • OS: Ubuntu 22.04.2, likely irrelevant
  • Architecture: x86_64, likely irrelevant
  • Go Version: go1.19, likely irrelevant
  • opentelemetry-go version: Tested with v1.16.0

Steps To Reproduce

Run the binary resulting from the following program:

package main

import (
	"context"
	"fmt"

	"go.opentelemetry.io/otel/sdk/resource"
)

func main() {
	res, err := resource.New(context.Background(),
		resource.WithHostID(),
	)

	if err != nil {
		panic(err)
	}

	fmt.Println(res)
}

On any of the following images:

The resulting output is:

host.id=

Expected behavior

The host.id resource attribute is either not set or set to a value that is specification compliant.


cc @mwear. I have not tried to reproduce this on opentelemetry-js but it's likely the issue occurs there as well.

@mwear
Copy link
Member

mwear commented Jul 14, 2023

I'll fix this.

@mwear
Copy link
Member

mwear commented Jul 14, 2023

I opened #4317. It is a fix for this problem, but may or may not be the fix we're looking for. Take a look at the PR description and we can decide what the right thing to do is.

@pellared
Copy link
Member

According to the description it indeed fixes the bug

The host.id resource attribute is either not set or set to a value that is specification compliant.

However, I think it would be good to open another issue (enhancement) to provide a more meaningful value.

@MrAlias MrAlias added this to the v1.17.0/v0.40.0 milestone Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:resources Part of OpenTelemetry resources bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants