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

Allow users to select the cloud metadata providers #13812

Merged
merged 4 commits into from
Sep 26, 2019

Conversation

urso
Copy link

@urso urso commented Sep 26, 2019

Resolves: #11145

We introduce a new setting 'providers' to the add_cloud_metadata
processor.

By now all the implementation for metadata providers requires developers
to mark a provider as 'local'. The alibaba and tencent providers are not
marked as local by now.

If the 'providers' setting is not used, then no all providers marked as
'local' are applied. This is a breaking change, because alibaba and
tencent providers will not be enabled anymore by default.

Although it's a breaking change, I prefered to disable non-local providers by default. (I epxect the fix to go into 7.4.0).

If the providers setting is used, only the selected providers will be
used.

The change supports alises for different providers. But the setup will only initialized a provider twice if the alias is used.

// specific language governing permissions and limitations
// under the License.

package add_cloud_metadata

Choose a reason for hiding this comment

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

don't use an underscore in package name

// specific language governing permissions and limitations
// under the License.

package add_cloud_metadata

Choose a reason for hiding this comment

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

don't use an underscore in package name

// specific language governing permissions and limitations
// under the License.

package add_cloud_metadata

Choose a reason for hiding this comment

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

don't use an underscore in package name

// specific language governing permissions and limitations
// under the License.

package add_cloud_metadata

Choose a reason for hiding this comment

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

don't use an underscore in package name

@urso urso added :Processors libbeat in progress Pull request is currently in progress. review and removed in progress Pull request is currently in progress. labels Sep 26, 2019
@urso urso marked this pull request as ready for review September 26, 2019 18:48
@urso
Copy link
Author

urso commented Sep 26, 2019

Jenkins is under maintenance right now. Let's rely on Travis for now.

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing this issue!


func (c *config) Validate() error {
// XXX: remove this check. A bug in go-ucfg prevents the correct validation
// on providerList
Copy link
Member

Choose a reason for hiding this comment

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

Is there a bug we can reference so that we know when it's ok to remove the check.

Copy link
Author

Choose a reason for hiding this comment

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

Not yet. The bug is quite bad I'd say, so I will adress this tomorrow.

Copy link
Author

Choose a reason for hiding this comment

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

go-ucfg issue: elastic/go-ucfg#133

urso added 3 commits September 26, 2019 21:36
We introduce a new setting 'providers' to the add_cloud_metadata
processor.

By now all the implementation for metadata providers requires developers
to mark a provider as 'local'. The alibaba and tencent providers are not
marked as local by now.

If the 'providers' setting is not used, then no all providers marked as
'local' are applied. This is a breaking change, because alibaba and
tencent providers will not be enabled anymore by default.

If the providers setting is used, only the selected providers will be
used.
@urso
Copy link
Author

urso commented Sep 26, 2019

The libbeat testsuite fails in the elasticsearch output. But required unit tests succeed. There are no system tests in libbeat that test add_cloud_metadata.
The fix for the ES output is in: #13813

Copy link
Contributor

@faec faec left a comment

Choose a reason for hiding this comment

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

Looks good, a much nicer design this way as well. A few nits but nothing concerning.

libbeat/processors/add_cloud_metadata/providers.go Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/providers.go Outdated Show resolved Hide resolved
visited := map[string]bool{}

for name, ff := range providers {
if visited[ff.Name] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is "visited" to account for the redundant short names like "alibaba" and "ecs"? A clarifying comment would be nice

Copy link
Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Author

Choose a reason for hiding this comment

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

I did add a comment to the loop.

libbeat/docs/processors-using.asciidoc Outdated Show resolved Hide resolved
libbeat/docs/processors-using.asciidoc Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/config.go Outdated Show resolved Hide resolved
@urso
Copy link
Author

urso commented Sep 26, 2019

CI is as green as it currently gets. All related tests passed.

@urso urso merged commit dc99773 into elastic:master Sep 26, 2019
@urso urso deleted the cloud_metadata_selector branch September 26, 2019 23:00
urso pushed a commit to urso/beats that referenced this pull request Sep 26, 2019
* Allow users to select the cloud metadata providers

We introduce a new setting 'providers' to the add_cloud_metadata
processor.

By now all the implementation for metadata providers requires developers
to mark a provider as 'local'. The alibaba and tencent providers are not
marked as local by now.

If the 'providers' setting is not used, then no all providers marked as
'local' are applied. This is a breaking change, because alibaba and
tencent providers will not be enabled anymore by default.

If the providers setting is used, only the selected providers will be
used.

(cherry picked from commit dc99773)
@urso urso added the v7.4.0 label Sep 26, 2019
urso pushed a commit that referenced this pull request Sep 27, 2019
* Allow users to select the cloud metadata providers (#13812)

* Allow users to select the cloud metadata providers

We introduce a new setting 'providers' to the add_cloud_metadata
processor.

By now all the implementation for metadata providers requires developers
to mark a provider as 'local'. The alibaba and tencent providers are not
marked as local by now.

If the 'providers' setting is not used, then no all providers marked as
'local' are applied. This is a breaking change, because alibaba and
tencent providers will not be enabled anymore by default.

If the providers setting is used, only the selected providers will be
used.

(cherry picked from commit dc99773)
@alastairs
Copy link

Thanks so much @urso! 🚀

@cwurm
Copy link
Contributor

cwurm commented Oct 7, 2019

Something has gone wrong the list of providers in the docs, I think the list item symbol is * not -.

https://www.elastic.co/guide/en/beats/filebeat/master/add-cloud-metadata.html:
Screen Shot 2019-10-07 at 09 23 07

leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
elastic#13815)

* Allow users to select the cloud metadata providers (elastic#13812)

* Allow users to select the cloud metadata providers

We introduce a new setting 'providers' to the add_cloud_metadata
processor.

By now all the implementation for metadata providers requires developers
to mark a provider as 'local'. The alibaba and tencent providers are not
marked as local by now.

If the 'providers' setting is not used, then no all providers marked as
'local' are applied. This is a breaking change, because alibaba and
tencent providers will not be enabled anymore by default.

If the providers setting is used, only the selected providers will be
used.

(cherry picked from commit fa6d344)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow user to disable certain cloud metadata providers
6 participants