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

Define a TelemetryBlob type to hold JSON blobs #42

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

rtamalin
Copy link
Collaborator

@rtamalin rtamalin commented Aug 2, 2024

The TelemetryBlob type provides helper methods that can be used to validate that provided blobs are:

  • Valid JSON
  • JSON objects
  • Contain a top-level "version" field
  • Are not too big.

The validity of provided JSON blobs is checked when they are received via a Generate() interface.

Also update client side item handling to leverage the json.RawMessage type for storing the JSON blobs; this avoid undesirable processing of the provided JSON blob data, which should remain untouched en-route to long term storage in the SUSE Telemetry service.

Minor restructuring of the client side library, moving limits to it's own subpackage to avoid an import loop when adding the CheckLimits() helper method to the TelemetryBlob.

Fixes: #41, #26

The TelemetryBlob type provides helper methods that can be used to
validate that provided blobs are:
* Valid JSON
* JSON objects
* Contain a top-level "version" field
* Are not too big.

The validity of provided JSON blobs is checked when they are received
via a Generate() interface.

Also update client side item handling to leverage the json.RawMessage
type for storing the JSON blobs; this avoid undesirable processing of
the provided JSON blob data, which should remain untouched en-route
to long term storage in the SUSE Telemetry service.

Minor restructuring of the client side library, moving limits to it's
own subpackage to avoid an import loop when adding the CheckLimits()
helper method to the TelemetryBlob.

Fixes: #41, #26
rtamalin added a commit to SUSE/telemetry-server that referenced this pull request Aug 2, 2024
Ensure that provided telemetry data JSOB blob data is not processed
unless needed, avoiding unmarshaling and re-marshaling of the field.

Depends up breaking changes in SUSE/telemetry#42

Fixes: #27
@rtamalin rtamalin requested a review from gbuenodevsuse August 2, 2024 12:59
Copy link
Collaborator

@gbuenodevsuse gbuenodevsuse left a comment

Choose a reason for hiding this comment

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

LGTM

@rtamalin rtamalin merged commit 2bb7d2c into main Aug 2, 2024
1 check passed
@rtamalin rtamalin deleted the blob_type_and_raw_message_handling branch August 2, 2024 15:14
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.

SDK: Enforce telemetry data JSON blob requirements
2 participants