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

config: Parse model from JSON #4412

Closed
pellared opened this issue Oct 10, 2023 · 8 comments · May be fixed by #4806
Closed

config: Parse model from JSON #4412

pellared opened this issue Oct 10, 2023 · 8 comments · May be fixed by #4806
Labels
area: config Related to config functionality blocked: specification Waiting on clarification of the OpenTelemetry specification before progress can be made

Comments

@pellared
Copy link
Member

pellared commented Oct 10, 2023

Implement https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/file-configuration.md#parse for JSON.

@pellared pellared added the area: config Related to config functionality label Oct 10, 2023
@pellared
Copy link
Member Author

PTAL @codeboten

@pellared
Copy link
Member Author

Changing the description to update the documentation instead of adding a new function.

CC @carrbs @codeboten

@pellared pellared changed the title config: Parse model from JSON config: Add parse OpenTelemetryConfiguration from JSON example Jan 16, 2024
@carrbs
Copy link
Contributor

carrbs commented Jan 16, 2024

Was this ticket initially opened to address this?
https://github.com/open-telemetry/oteps/blob/main/text/0225-configuration.md?plain=1#L52-L61


In order to provide a minimal API surface area, implementations MUST support the following:

Parse(file) -> config

An API called Parse receives a file object. The method loads the contents of the file, parses it, and validates that the configuration against the schema. At least one of JSON or YAML MUST be supported. If either format can be supported without additional dependencies, that format SHOULD be preferred. If neither or both formats are supported natively, YAML should be the preferred choice. If YAML is not supported due to dependency concerns, there MAY be a way for a user to explicitly enable it by installing their own dependency.

The method returns a Configuration model that has been validated. This API MAY return an error or raise an exception, whichever is idiomatic to the implementation for the following reasons:

  • file doesn't exist or is invalid
  • configuration parsed is invalid according to schema

@pellared
Copy link
Member Author

pellared commented Jan 16, 2024

@carrbs Good finding 👍

Actually it should implement this: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/file-configuration.md#parse

Take notice that the specification currently requires only supporting YAML. Making as blocker per spec.

I updated the description.

@pellared pellared added the blocked: specification Waiting on clarification of the OpenTelemetry specification before progress can be made label Jan 16, 2024
@pellared pellared changed the title config: Add parse OpenTelemetryConfiguration from JSON example config: Parse model from JSON Jan 16, 2024
@codeboten
Copy link
Contributor

Take notice that the specification currently requires only supporting YAML. Making as blocker per spec.

The specification mentions both JSON or YAML. Are you saying that since only one is required and YAML is preferred if nether/both are supported, then we should only implement YAML parsing? Just trying to clarify what blocked on specification means here

@pellared
Copy link
Member Author

TODO: decide if JSON file format is required

@codeboten
Copy link
Contributor

@pellared ah fair... i missed this, as it goes against what's written further down :D

@pellared
Copy link
Member Author

Closing the issue for now. We can reopen it if needed.

@pellared pellared closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Related to config functionality blocked: specification Waiting on clarification of the OpenTelemetry specification before progress can be made
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants