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

Merge ES default values to Sourcmeap configuration. #3355

Merged
merged 4 commits into from
Feb 21, 2020

Conversation

simitt
Copy link
Contributor

@simitt simitt commented Feb 18, 2020

Motivation/summary

When configuring an Elasticsearch instance for Sourcemap usage, Elasticsearch default values should be merged with the custom config, to avoid having to configure all settings.

At the moment default values are not merged as soon as any of the apm-server.rum.source_mapping.elasticsearch.* options is configured, which is unexpected behavior and not aligned with how other configuration options are merged with default values.

This PR changes the behavior to use default options where no dedicated configuration option is provided.

Checklist

- [ ] I have signed the Contributor License Agreement.

  • My code follows the style guidelines of this project (run make check-full for static code checks and linting)
  • I have rebased my changes on top of the latest master branch

- [ ] I have made corresponding changes to the documentation

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

How to test these changes

Configure apm-server.rum.source_mapping.elasticsearch.* without defining a host. It should be merged with the default host.
Default values are hosts: []string{"localhost:9200"}, protocol: "http", timeout: 5s.

Also configure with a different host than the default host and ensure it is applied.

Without these changes, the default values would not be set and an error would occur.

Related issues

fixes #3350

When configuring an Elasticsearch instance for Sourcemap usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes elastic#3350
return nil
}

type tmpSourceMapping SourceMapping
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps move this inside the Unpack method, and comment it to make it clear that it exists just to remove the custom "Unpack" method?

@simitt simitt merged commit efacab7 into elastic:master Feb 21, 2020
simitt added a commit to simitt/apm-server that referenced this pull request Feb 21, 2020
When configuring an Elasticsearch instance for Sourcemap usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes elastic#3350
simitt added a commit that referenced this pull request Feb 21, 2020
When configuring an Elasticsearch instance for Sourcemap usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes #3350
@simitt simitt deleted the fix-es-smap-defaults branch February 21, 2020 13:24
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.

Respect default values for ES instance when configuring for Sourcemaps
2 participants