-
Notifications
You must be signed in to change notification settings - Fork 528
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
Wire agent config #4486
Wire agent config #4486
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
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.
Looks good functionally, just a few minor things I'd like to see tidied up
beater/config/integration.go
Outdated
|
||
import "github.com/elastic/beats/v7/libbeat/common" | ||
|
||
func NewIntegrationConfig() *IntegrationConfig { |
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.
func NewIntegrationConfig() *IntegrationConfig { | |
func NewIntegrationConfig(rootConfig *common.Config) *IntegrationConfig { |
And then do the unpack here, like we do in config.New
?
beater/beater.go
Outdated
if integrationConfig.DataStream != nil { | ||
bt.namespace = integrationConfig.DataStream.Namespace | ||
} | ||
if bt.namespace == "" { | ||
bt.namespace = "default" | ||
} |
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.
Can we encapsulate this in NewIntegrationConfig (passing in the root config), so there's always a namespace defined when NewIntegrationConfig returns? Then if other code ends up using that function, the logic is in one place.
publish/pub.go
Outdated
@@ -81,7 +81,7 @@ var ( | |||
// newPublisher creates a new publisher instance. | |||
//MaxCPU new go-routines are started for forwarding events to libbeat. | |||
//Stop must be called to close the beat.Client and free resources. | |||
func NewPublisher(pipeline beat.Pipeline, tracer *apm.Tracer, cfg *PublisherConfig) (*Publisher, error) { | |||
func NewPublisher(pipeline beat.Pipeline, namespace string, tracer *apm.Tracer, cfg *PublisherConfig) (*Publisher, 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.
Add namespace as a field of PublisherConfig?
} | ||
|
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.
If you add the following (untested), you can remove the TODO above. This addresses the issue I mentioned on Slack, where the data streams config will be defined for the initial static config, but not for the dynamic input coming from Agent:
apmServerCommonConfig.Merge(common.MustNewConfigFrom(`{"apm-server.data_streams.enabled": true}`))
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.
Not sure I follow, when agent starts the server it does it with -E apm-server.data_streams.enabled=true
, right?
Codecov Report
@@ Coverage Diff @@
## master #4486 +/- ##
==========================================
- Coverage 76.06% 75.96% -0.10%
==========================================
Files 160 161 +1
Lines 9775 9790 +15
==========================================
+ Hits 7435 7437 +2
- Misses 2340 2353 +13
|
Read configuration from Elastic Agent and use the namespace for the indices
Following on from #4228 (comment), I sent a transaction to APM Server and checked that a new "traces" data stream was created with the namespace "default":
I then edited the integration to set the namespace to "nondefault", restarted elastic-agent, and send another transaction. A new data stream was created:
|
Motivation/summary
Read configuration from Elastic Agent and use the namespace for the indices
Checklist
I have considered changes for:
How to test these changes
Related issues