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

dry-run: validate required fields #507

Merged
merged 8 commits into from
Jun 16, 2020
Merged

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Jun 15, 2020

Changes:

  • while loading new dataset validate required fields (also in dry-run)

@mtojek mtojek requested a review from ruflin June 15, 2020 08:51
@mtojek mtojek self-assigned this Jun 15, 2020
@elasticmachine
Copy link

elasticmachine commented Jun 15, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Started by upstream project "Beats/package-storage/master" build number 26]

  • Start Time: 2020-06-15T14:38:57.588+0000

  • Duration: 9 min 35 sec

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

I'm ok with keeping it as is for now to keep us moving but should be cleaned up later (see PR review comment).

Could you add a changelog entry?

util/package.go Outdated
}

// validateRequiredFields method loads fields from all files and checks if required fields are present.
func validateRequiredFields(datasetPath string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be part of the Dataset validation. Like this also now datasetBasePath has to be passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

BTW I removed the constraint for not having - (dash) in dataset names. We have some in the aws integration.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, this is not good because it means the - will end up in the index name which breaks the indexing strategy. Or do I miss something here?

Copy link
Contributor Author

@mtojek mtojek Jun 15, 2020

Choose a reason for hiding this comment

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

aws integration:

ec2-logs
ec2-metrics
elb-logs
elb-metrics
s3_daily_storage
s3_request

I understand that we need to rename ones with - (dash). Is the underscore safe? Should we switch from dash to underscore in integrations?

Also, I didn't get the point why does - breaks the indexing strategy and _ doesn't. Both looks like same special characters. Is the indexing strategy correctly defined?

Copy link
Member

Choose a reason for hiding this comment

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

_ are allowed. The indexing strategy uses the following patterns: logs-*-*. Because of this if there is a - in the dataset name, it will assume it is the namespace. All other chars except - are allowed.

Copy link
Member

Choose a reason for hiding this comment

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

To add a bit more flavour to this: A package could be allowed to have a -. It is only the dataset that is not allowed to have one. But as in most cases (not all) we autogenerate the dataset name (currently id) out of the package name, it is better they don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reference to docs. I will prepare a set of PRs to rename all invalid datasets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mtojek mtojek requested a review from ruflin June 15, 2020 09:54
@ruflin
Copy link
Member

ruflin commented Jun 15, 2020

@mtojek You also need to update the test packages :-(

@mtojek mtojek merged commit a501181 into elastic:master Jun 16, 2020
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