-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[AGTHEAL-115] refactor(core): migrate comp/core/flare to V2 component architecture #49769
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
Draft
louis-cqrl
wants to merge
1
commit into
main
Choose a base branch
from
louis-cqrl/refactor-core-flare-to-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| # gazelle:ignore | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "flare", | ||
| srcs = ["doc.go"], | ||
| importpath = "github.com/DataDog/datadog-agent/comp/core/flare", | ||
| visibility = ["//visibility:public"], | ||
| ) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "def", | ||
| srcs = ["component.go"], | ||
| importpath = "github.com/DataDog/datadog-agent/comp/core/flare/def", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//comp/core/flare/types"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed | ||
| // under the Apache License Version 2.0. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2016-present Datadog, Inc. | ||
|
|
||
| // Package flare implements a component to generate flares from the agent. | ||
| // | ||
| // A flare is a archive containing all the information necessary to troubleshoot the Agent. When openeing a support | ||
| // ticket a flare might be requested. Flares contain the Agent logs, configurations and much more. | ||
| package flare | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| "github.com/DataDog/datadog-agent/comp/core/flare/types" | ||
| ) | ||
|
|
||
| // team: agent-configuration | ||
|
|
||
| // Component is the component type. | ||
| type Component interface { | ||
| // Create creates a new flare locally and returns the path to the flare file. | ||
| // | ||
| // If providerTimeout is 0 or negative, the timeout from the configuration will be used. | ||
| Create(pdata types.ProfileData, providerTimeout time.Duration, ipcError error, diagnoseResult []byte) (string, error) | ||
| // CreateWithArgs creates a new flare locally and returns the path to the flare file. | ||
| // This function is used to create a flare with specific arguments. | ||
| CreateWithArgs(flareArgs types.FlareArgs, providerTimeout time.Duration, ipcError error, diagnoseResult []byte) (string, error) | ||
| // Send sends a flare archive to Datadog. The local archive is removed after a successful upload unless the component was created with KeepArchiveAfterSend (e.g. CLI --keep-archive). | ||
| Send(flarePath string, caseID string, email string, source types.FlareSource) (string, error) | ||
| } | ||
|
|
||
| // Params defines the parameters for the flare component. | ||
| type Params struct { | ||
| // Local is set to true when we could not contact a running Agent and the flare is created directly from the | ||
| // CLI. | ||
| Local bool | ||
|
|
||
| // KeepArchiveAfterSend when true keeps the local flare archive file after a successful upload (e.g. for CLI --keep-archive). | ||
| KeepArchiveAfterSend bool | ||
|
|
||
| // DistPath is the fully qualified path to the 'dist' directory | ||
| DistPath string | ||
|
|
||
| // PythonChecksPath is the path to the python checks shipped with the agent | ||
| PythonChecksPath string | ||
|
|
||
| // DefaultLogFile the path to the default log file | ||
| DefaultLogFile string | ||
|
|
||
| // DefaultJMXLogFile the path to the default JMX log file | ||
| DefaultJMXLogFile string | ||
|
|
||
| // DefaultDogstatsdLogFile the path to the default dogstatsd log file | ||
| DefaultDogstatsdLogFile string | ||
|
|
||
| // DefaultStreamlogsLogFile the path to the default Streamlogs log file | ||
| DefaultStreamlogsLogFile string | ||
| } | ||
|
|
||
| // NewLocalParams returns parameters for to initialize a local flare component. Local flares are meant to be created by | ||
| // the CLI process instead of the main Agent one. | ||
| func NewLocalParams(distPath string, pythonChecksPath string, defaultLogFile string, defaultJMXLogFile string, defaultDogstatsdLogFile string, defaultStreamlogsLogFile string) Params { | ||
| p := NewParams(distPath, pythonChecksPath, defaultLogFile, defaultJMXLogFile, defaultDogstatsdLogFile, defaultStreamlogsLogFile) | ||
| p.Local = true | ||
| return p | ||
| } | ||
|
|
||
| // NewParams returns parameters for to initialize a non local flare component | ||
| func NewParams(distPath string, pythonChecksPath string, defaultLogFile string, defaultJMXLogFile string, defaultDogstatsdLogFile string, defaultStreamlogsLogFile string) Params { | ||
| return Params{ | ||
| Local: false, | ||
| DistPath: distPath, | ||
| PythonChecksPath: pythonChecksPath, | ||
| DefaultLogFile: defaultLogFile, | ||
| DefaultJMXLogFile: defaultJMXLogFile, | ||
| DefaultDogstatsdLogFile: defaultDogstatsdLogFile, | ||
| DefaultStreamlogsLogFile: defaultStreamlogsLogFile, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed | ||
| // under the Apache License Version 2.0. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2016-present Datadog, Inc. | ||
|
|
||
| // Package flare implements a component to generate flares from the agent. | ||
| // Deprecated: use comp/core/flare/def instead. | ||
| package flare |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "fx", | ||
| srcs = ["fx.go"], | ||
| importpath = "github.com/DataDog/datadog-agent/comp/core/flare/fx", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//comp/core/flare/def", | ||
| "//comp/core/flare/impl", | ||
| "//pkg/util/fxutil", | ||
| "@org_uber_go_fx//:fx", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed | ||
| // under the Apache License Version 2.0. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2016-present Datadog, Inc. | ||
|
|
||
| // Package fx defines the fx options for the flare component. | ||
| package fx | ||
|
|
||
| import ( | ||
| "go.uber.org/fx" | ||
|
|
||
| flare "github.com/DataDog/datadog-agent/comp/core/flare/def" | ||
| flareimpl "github.com/DataDog/datadog-agent/comp/core/flare/impl" | ||
| "github.com/DataDog/datadog-agent/pkg/util/fxutil" | ||
| ) | ||
|
|
||
| // Module defines the fx options for this component. | ||
| func Module(params flare.Params) fxutil.Module { | ||
| return fxutil.Component( | ||
| fx.Supply(params), | ||
| fxutil.ProvideComponentConstructor(flareimpl.NewComponent), | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.