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

remove specification for service.name #68

Conversation

codeboten
Copy link
Contributor

The attributes should really just be treated like a map of values. Specifying the service name here doesn't provide much value. Additionally, this is preventing the go-jsonschema library from generating the code for attributes as a map. With the service name specification, the generated code looks like this:

type Attributes struct {
	// ServiceName corresponds to the JSON schema field "service.name".
	ServiceName *string `mapstructure:"service.name,omitempty"`
}

Without the service name property specified:

type Attributes map[string]interface{}

I understand this appears to be a bug in go-jsonschema, but after thinking about this, i decided to open this PR as a proposal to work around the issue. Defining the service name property made sense when we wanted to require it, but since it's not required, i dont see much benefit to having it.

The attributes should really just be treated like a map of values. Specifying the service name here doesn't provide much value. Additionally, this is preventing the go-jsonschema library from generating the code for attributes as a map. With the service name specification, the generated code looks like this:

```
type Attributes struct {
	// ServiceName corresponds to the JSON schema field "service.name".
	ServiceName *string `mapstructure:"service.name,omitempty"`
}

```

Without the service name property specified:

```
type Attributes map[string]interface{}
```

I understand this appears to be a bug in go-jsonschema, but after thinking about this, i decided to open this PR as a proposal to work around the issue. Defining the service name property made sense when we wanted to require it, but since it's not required, i dont see much benefit to having it.

Signed-off-by: Alex Boten <aboten@lightstep.com>
@codeboten codeboten requested a review from a team January 18, 2024 20:51
"type": "string"
}
}
"additionalProperties": true
Copy link
Member

Choose a reason for hiding this comment

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

Just so I understand - does the go implementation struggle with all places where we set additionalProperties: true? I think being able to read additional properties will be critical to supporting custom extension components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct... i will try to submit a fix for supporting additional properties

Copy link
Contributor Author

@codeboten codeboten Jan 19, 2024

Choose a reason for hiding this comment

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

@jack-berg to be clear I'm not suggesting that we remove support for additional properties across the schema. Running into this issue in go-jsonschema made me wonder if attributes needed any properties defined or not, this is why I opened a PR to remove the service name

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. Yeah the "required" feels wrong to me. While an SDK is required to produce a resource with service.name, there is no requirement that it is specified by OTEL_SERVICE_NAME or the user, since there is a well defined fallback value.

I think the same should probably apply here: drop the service.name requirement, but heavily encourage in the example documentation.

@codeboten codeboten merged commit 6215d43 into open-telemetry:main Mar 1, 2024
2 checks passed
@codeboten codeboten deleted the codeboten/remove-specification-for-service-name branch March 1, 2024 23:30
marcalff added a commit to marcalff/opentelemetry-cpp that referenced this pull request Mar 4, 2024
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.

3 participants