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

Fix jaeger agent embedded reporter builder bug #570

Merged
merged 2 commits into from
Nov 30, 2017
Merged

Conversation

vprithvi
Copy link
Contributor

  • When overriding the collector service name using the agent app builder's embedded
    WithCollectorServiceName, the service name is stored in the embedded struct and
    not in the outer struct.

  • When constructing an agent using createAgent, GetHttpServer reads the outer
    struct leading to different behavior when reading configuration from a file, as
    opposed to using the builder.

  • This change uses go-yaml's inline keyword to deserialize embedded structs.

Signed-off-by: Prithvi Raj p.r@uber.com

- When overriding the collector service name using the agent app builder's embedded
  `WithCollectorServiceName`, the service name is stored in the embedded struct and
  not in the outer struct.

- When constructing an agent using `createAgent`, `GetHttpServer` reads the outer
  struct leading to different behavior when reading configuration from a file, as
  opposed to using the builder.

- This change uses go-yaml's `inline` keyword to deserialize embedded structs.

Signed-off-by: Prithvi Raj <p.r@uber.com>
@@ -71,12 +68,7 @@ type Builder struct {
HTTPServer HTTPServerConfiguration `yaml:"httpServer"`
Metrics jmetrics.Builder `yaml:"metrics"`

// These 3 fields are copied from tchreporter.Builder because yaml does not parse embedded structs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 253c01b on fix-builder-bug into 77fd3d3 on master.

CollectorServiceName string `yaml:"collectorServiceName"`

tchreporter.Builder
tchreporter.Builder `yaml:",inline"`
Copy link
Member

Choose a reason for hiding this comment

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

this is awesome. Could you search the rest of the code for this though? I think there may be other examples of this copy-pasta.

btw, why comma before inline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw, why comma before inline?

It declares an empty yaml tag for tchreporter.Builder. Simply using inline doesn't work.

Could you search the rest of the code for this though? I think there may be other examples of this copy-pasta.

I wasn't able to come up with a good way of searching for anonymous structs; Nothing else seems to have similar comments.

@coveralls
Copy link

coveralls commented Nov 29, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling f45a303 on fix-builder-bug into 300f0cf on master.

@vprithvi vprithvi merged commit 972b795 into master Nov 30, 2017
@vprithvi vprithvi deleted the fix-builder-bug branch November 30, 2017 03:18
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