-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Beatless initial PR #8485
Beatless initial PR #8485
Conversation
libbeat/feature/registry.go
Outdated
// feature are grouped by namespace, a namespace is a kind of plugin like outputs, inputs, or queue. | ||
// The feature name must be unique. | ||
type registry struct { | ||
type FeatureRegistry struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type name will be used as feature.FeatureRegistry by other packages, and that stutters; consider calling this Registry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for naming the type 'Registry'. Let's replace the global 'Registry' variable with func GlobalRegistry() *Registry
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah much better, it will lead to less fragile code. :)
@@ -28,26 +28,26 @@ import ( | |||
|
|||
type mapper map[string]map[string]Featurable | |||
|
|||
// Registry implements a global registry for any kind of feature in beats. | |||
// Registry implements a global FeatureRegistry for any kind of feature in beats. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported type FeatureRegistry should be of the form "FeatureRegistry ..." (with optional leading article)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment indeed reads somewhat funny.
136c136
to
56d7d16
Compare
I think I will migrate the to the cloud formation api instead this look like a more solid way of doing it. |
"github.com/elastic/beats/x-pack/beatless/provider" | ||
) | ||
|
||
var stdinName = "stdin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
?
scanner.Split(bufio.ScanLines) | ||
|
||
for scanner.Scan() { | ||
if scanner.Err() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's enough to call scanner.Err
once, if you rewrite the code a little:
if err := scanner.Err(); err != nil {
errChan <- err
return
}
"github.com/elastic/beats/libbeat/logp" | ||
) | ||
|
||
var handlerName = "beatless" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this variable here? Although it's in the same package, but it's used in x-pack/beatless/provider/aws/cloudwatch_logs.go
.
This also could be const
.
"github.com/elastic/beats/libbeat/logp" | ||
) | ||
|
||
var errNeverRun = errors.New("executer was never executed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please group the variables together.
var (
errNeverRun = errors.New("executer was never executed")
errCannotAdd = errors.New("cannot add to an already executed executer")
errAlreadyExecuted = errors.New("executer already executed")
)
|
||
func newExecutor(log *logp.Logger, context *executorContext) *executor { | ||
if log == nil { | ||
log = logp.NewLogger("executer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be "executor"
.
} | ||
} | ||
if err == nil { | ||
e.log.Debug("all operations successful") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all operations have been successful"
?
9095553
to
908966b
Compare
metricbeat/module/php_fpm/url.go
Outdated
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package php_fpm |
There was a problem hiding this comment.
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
|
||
// +build !integration | ||
|
||
package node_stats |
There was a problem hiding this comment.
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
) | ||
} | ||
|
||
// OrderIntervalLogs, when given a log filename in the form [prefix]-[formattedDate]-n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment on exported function OrderIntervalLogs should be of the form "OrderIntervalLogs ..."
@@ -48,11 +49,14 @@ func makeURL(url, path string, params url.Values) string { | |||
return strings.Join([]string{url, path, "?", params.Encode()}, "") | |||
} | |||
|
|||
func Export(client *http.Client, conn string, dashboard string, out string) error { | |||
func Export(client *http.Client, conn string, spaceID string, dashboard string, out string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported function Export should have comment or be unexported
908966b
to
b5d6a42
Compare
b5d6a42
to
a57b46d
Compare
depends on #8573 |
@ruflin As discussed I have added the following command Also, this PR is a lot more robust when deploying, updating or removing a cloudwatch function, it require permission on cloudformation, but it will make the operation atomic, and will take into consideration the changes that you add. I have updated the configuration to correctly expose lambda specific settings: beatless.provider.aws.functions:
# Define the list of function availables, each function required to have a unique name.
- name: fn_cloudwatch_logs
type: cloudwatch_logs
# Description of the method to help identify them when you run multiples functions.
description: "listen to cloudwatch logs"
#
# Concurrency, is the reserved number of instance for that function.
# Default is unreserved.
#
# Note: There is a hard limit of 1000 of running function of any kind per account.
# concurrency: 5
#
# The maximum memory allocated for this function, the configured size must be a factor of 64.
# There is a hard limit of 3008MiB for each function. Default is 128MiB.
# memory_size: 128MiB
#
# Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue.
# dead_letter_config.target_arn:
#
# Optional fields that you can specify to add additional information to the
# output. Fields can be scalar values, arrays, dictionaries, or any nested
# combination of these.
#fields:
# env: staging
# List of cloudwatch log group registered to that function.
triggers:
- log_group_name: /aws/lambda/beatless-cloudwatch_logs
filter_pattern: mylog_
#
# Define custom processors for this function.
# processors:
# - dissect:
# tokenizer: "%{key1} %{key2}"
Once the PR #8573 is merged it will be a PR the same size that you had before. |
8a92d96
to
edd2dfa
Compare
2b8742c
to
0f84be5
Compare
I've rebased this PR on top of the feature branch you can now create artifact of beatless and push the function using theses artifacts. |
## This PR provides the following 1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. ## What it doesn't provides - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings
## This PR provides the following 1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. ## What it doesn't provides - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings
## This PR provides the following 1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs/sqs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. ## What it doesn't provides - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings
1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs/sqs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings (cherry picked from commit 3ef0b4e)
Cherry-pick of PR #8485 to 6.x branch. Original message: ## This PR provide the following 1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. ## What it doesn't provides - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings ## Vendored - aws/aws-lambda-go - aws/aws-sdk-go-v2 --- **Note:** The PR look much bigger because of the vendored files. **Notes 2:** Make sure you add this to your config YAMl, I wan't to make the following the default options but it would have been really messy to do it in this PR. ``` # Disable anything that could be send to disk path.data: /tmp path.logs: /tmp/logs logging.to_stderr: true logging.to_files: false #logging.level: debug setup.template.enabled: true queue.mem: events: 50 flush.min_events: 1 flush.timeout: 0.5s ``` ## related work - #8449 - #8443
## This PR provides the following 1. Plugin infra for developing providers and functions 2. A local stdin provider only used for testing, I will remove it in the final version. 3. AWS provider and function types for: - Cloudwatch logs - SQS - Kinesis - Api web gateway proxy 4. License checker 5. Packaging of artifact 6. Runners 7. CLI infrastructure 8. CLI to push a cloudwatch logs function. 9. CLI to delete any function 10. Processors support. 11. Types to validate value from the users and the lambda function. ## What it doesn't provides - ECS and full event extraction. (NOT for v1) - Specifying the AWS credentials in the configuration - CLI for SQS, Kinesis, API - Robust CLI interaction with the API, rollback on failure / versioning. - Removal of not supported outputs - Removal of seccomp check - Integration tests - Updated build task to produce containing the user executable beat and the linux beats. - Concurrency / memory settings
This PR provide the following
final version.
What it doesn't provides
the linux beats.
Vendored
Note: The PR look much bigger because of the vendored files.
Notes 2:
Make sure you add this to your config YAMl, I wan't to make the following the default options but it would have been really messy to do it in this PR.
related work