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

Initial Attempt at JSON Support #12

Merged
merged 4 commits into from
Mar 31, 2019
Merged

Conversation

endzyme
Copy link
Collaborator

@endzyme endzyme commented Mar 29, 2019

Changes

  • Added interface for printers (to support simple types with a factory)
  • Added json implementation for printing
  • Refactored text printing implementation into a struct
  • Augmented resourceMetric to support building value functions (as closures) for printing correct value strings

Problems / Considerations

  • The json and text printers use different struct methods for printing the values and percent values, this should probably be converged to an interface?? (not sure)
  • A longer term solution might be to better define the output structure an implement a serializer to differnet outputs, but i don't know (first rodeo here :D)

fmt.Printf("%s", jsonRaw)
}

func (jp *jsonPrinter) buildJSONClusterMetrics() jsonClusterMetrics {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This might not need to be a pointer ref method

return response
}

func (jp *jsonPrinter) buildJSONResourceOutput(item *resourceMetric) *jsonResourceOutput {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

might not need to be a pointer ref method of jsonPrinter

Nick Huanca added 2 commits March 29, 2019 08:44
* Moved `cluster` wording to `cluster_totals` for more clarity on valued within
@endzyme endzyme marked this pull request as ready for review March 29, 2019 19:10
Copy link
Owner

@robscott robscott left a comment

Choose a reason for hiding this comment

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

This is awesome! Thanks so much for all the work on this, it looks great. I'm going to merge this in and maybe try to tackle one of the other issues this weekend before I bundle this into a new release.

@robscott robscott merged commit 82b3974 into robscott:master Mar 31, 2019
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.

None yet

2 participants