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

Document use of NewSchemaless vs NewWithAttributes #4847

Closed
dmathieu opened this issue Jan 22, 2024 · 7 comments
Closed

Document use of NewSchemaless vs NewWithAttributes #4847

dmathieu opened this issue Jan 22, 2024 · 7 comments
Assignees
Labels
area:resources Part of OpenTelemetry resources documentation Provides helpful information enhancement New feature or request

Comments

@dmathieu
Copy link
Member

This issue is an extraction of the discussion in #4846.

We should provide a documentation of the usage of resource.NewSchemaless vs resource.NewWithAttributes, the pros and cons of both approaches and ways to use both efficiently.

@dmathieu dmathieu added the enhancement New feature or request label Jan 22, 2024
@dmathieu dmathieu self-assigned this Jan 22, 2024
@pellared pellared added documentation Provides helpful information area:resources Part of OpenTelemetry resources labels Jan 22, 2024
@Sanket-0510
Copy link

@pellared shall I take this?

@dmathieu
Copy link
Member Author

This is currently assigned to me, but feel free to take it.

@Sanket-0510
Copy link

RIght now I can only figure out that users can use resource.NewSchemaless instead of resource.NewWIthAttributes if they want to lower the chances of facing resource merge conflicts while implementing Otel go into their go application using
https://opentelemetry.io/docs/languages/go/getting-started/#initialize-the-opentelemetry-sdk

so right now I have only one reason yo use NewSchemaless. where can I find more info regarding both in order to create clear pros and cons of using them in doc file?

@pellared
Copy link
Member

The main use case of using resource.NewSchemaless is when the attributes do not even follow the semantic conventions (when one adds custom attributes).

@Sanket-0510
Copy link

Sanket-0510 commented Jan 30, 2024

@pellared I have prepared this thing for now :

Pros:
Lower Chances of Merge Conflicts:

Pro: Using newSchemaless may reduce the likelihood of facing resource merge conflicts,
especially when dealing with a large codebase or when different contributors are adding custom attributes.
Custom Attributes without Semantic Conventions:

Pro: Ideal for scenarios where custom attributes are added without adhering strictly to semantic conventions.


Cons:
Less Semantic Structure:

1. Con: "Schemaless" nature hampers adherence to predefined structures, making code maintenance challenging.

2. Con: Lack of a well-defined schema results in inconsistency in attribute usage across the codebase.

so this pr should be for -Otel-go Docs Right?

Where do I add this?

@dmathieu
Copy link
Member Author

I'm taking a new look at this, and now that we return the merged, schemaless resource on a merge conflict (#4876), I'm not sure adding a more explicit documentation is required.

@pellared
Copy link
Member

I agree especially that https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#example-New even shows how one can handle the conflict

@dmathieu dmathieu closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
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 documentation Provides helpful information enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants