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

Avoid touching the original structure of the options #523

Merged
merged 1 commit into from
Jul 16, 2019

Conversation

rubenvp8510
Copy link
Collaborator

@rubenvp8510 rubenvp8510 commented Jul 12, 2019

Signed-off-by: Ruben Vargas ruben.vp8510@gmail.com

Fixes Issue #304

Changed the way that the options is serialized/deserialized, now options does not touch the yaml structure on an update.

This is similar to Freeform type, but it has internally a method for "flat" options, so this support both types of properties, condensed form and normal structure, but not a mix of them.

may be we can/should merge this type with Freeform ?

@rubenvp8510 rubenvp8510 force-pushed the Issue-304 branch 3 times, most recently from c454cfd to 67d7d88 Compare July 12, 2019 20:03
@codecov
Copy link

codecov bot commented Jul 12, 2019

Codecov Report

Merging #523 into master will decrease coverage by 0.16%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #523      +/-   ##
=========================================
- Coverage   91.96%   91.8%   -0.17%     
=========================================
  Files          65      65              
  Lines        3300    3307       +7     
=========================================
+ Hits         3035    3036       +1     
- Misses        185     188       +3     
- Partials       80      83       +3
Impacted Files Coverage Δ
pkg/apis/jaegertracing/v1/options.go 88.88% <33.33%> (-11.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77c4a0d...67d7d88. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 12, 2019

Codecov Report

Merging #523 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
+ Coverage   91.96%   91.97%   +<.01%     
==========================================
  Files          65       65              
  Lines        3300     3304       +4     
==========================================
+ Hits         3035     3039       +4     
  Misses        185      185              
  Partials       80       80
Impacted Files Coverage Δ
pkg/apis/jaegertracing/v1/options.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77c4a0d...e71a66e. Read the comment docs.

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@rubenvp8510 rubenvp8510 changed the title [WIP] Avoid touching the original structure of the options Avoid touching the original structure of the options Jul 12, 2019
Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

LGTM, just need a small clarification first.

o.json = json
bytes, err := o.MarshalJSON()
assert.NoError(t, err)
assert.Equal(t, bytes, json)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the behavior before this change? {"cassandra.servers": "cassandra:9042"}?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The change this PR does is on marshal and unmarshall, previously it flats all options into condensed form, now I don't do that, because it could produce Jaeger resources with mixed condensed and structured form of options, I just leave the options intact.

So for this case will return the JSON in the way it is, this is: {"cassandra": {"servers": "cassandra:9042"}} , but from code perspective you can still access to a map with condensed form of properties.

I did in this way trying to preserve backwards compatibility, if someone is already using condensed form, it will work, same for users using the structured form of options.

Other option is to change this to map[string]string, but that breaks the compatibility for users that uses structured form

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