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 a few issues with functionbeat #8713

Merged
merged 1 commit into from
Oct 24, 2018
Merged

Conversation

ph
Copy link
Contributor

@ph ph commented Oct 23, 2018

  • Allow users to define the S3 bucket used for artifact
  • Replace the log group name with valid string
  • Enforce function name to only contains some chars
  • Enforce log group name validation
  • Add better code handling when waiting for cloudformation status.

- Allow users to define the S3 bucket used for artifact
- Replace the log group name with valid string
- Enforce function name to only contains some chars
- Enforce log group name validation
- Add better code handling when waiting for cloudformation status.
@@ -11,9 +11,12 @@
# Configure functions to run on AWS Lambda, currently we assume that the credentials
# are present in the environment to correctly create the function when using the CLI.
#
# Configure which S3 bucket we should upload the lambda artifact.
functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy"

Copy link
Contributor Author

@ph ph Oct 23, 2018

Choose a reason for hiding this comment

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

I have mixed feeling about how to display to display provider options vs functions.

What would be the best way to make it clean in the YML?

Copy link

Choose a reason for hiding this comment

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

I'd say the format chosen very much fits our conventions. If there is a chance we might introduce even more settings you can write:

functionbeat.provider.aws:
  deploy_bucket: ...
  <more settings> ?

I'm in favor of having functionbeat.provider.aws.functions: top-level. This reduces the amount of indentation and copy'n paste errors.

Alternatively:

functionbeat.providers.aws:
    deploy_bucket: ...

functionbeat.functions:
- provider: aws
  type: cloudwatch_logs
  ...

I wonder if we even need to have an explicit provider on functions. Normally the provider is implicit by function type. By having providers 'implicit', we can't limit the max number of providers in a config file to 1.

@@ -22,6 +24,11 @@ import (
"github.com/elastic/beats/x-pack/functionbeat/provider/aws/transformer"
)

var (
logGroupNamePattern = "^[\\.\\-_/#A-Za-z0-9]+$"
Copy link

Choose a reason for hiding this comment

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

use backticks for raw strings. Then you don't have to escape the escapes.

"invalid characters in log group name '%s', name must match regular expression: '%s'",
s,
logGroupNamePattern,
)
Copy link

Choose a reason for hiding this comment

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

not everyone will understand the regex being printed (it even contains escapes). How about: name must consist only of upper or lowercase ascii letters, digits, or special characters "._#/"

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

LGTM, with @urso comments. haven't tested it locally but as I won't have time today I suggest to move this forward and keep testing after merge

@ph ph merged commit 95695a4 into elastic:feature-beatless Oct 24, 2018
ph added a commit that referenced this pull request Oct 24, 2018
- Allow users to define the S3 bucket used for artifact
- Replace the log group name with valid string
- Enforce function name to only contains some chars
- Enforce log group name validation
- Add better code handling when waiting for cloudformation status.
ph added a commit that referenced this pull request Oct 24, 2018
- Allow users to define the S3 bucket used for artifact
- Replace the log group name with valid string
- Enforce function name to only contains some chars
- Enforce log group name validation
- Add better code handling when waiting for cloudformation status.
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
- Allow users to define the S3 bucket used for artifact
- Replace the log group name with valid string
- Enforce function name to only contains some chars
- Enforce log group name validation
- Add better code handling when waiting for cloudformation status.
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.

3 participants