Add cloudfoundry common client into x-pack/common#16527
Add cloudfoundry common client into x-pack/common#16527blakerouse merged 6 commits intoelastic:masterfrom
Conversation
exekias
left a comment
There was a problem hiding this comment.
I did a quick pass and left some comments, nothing major
…didn't expose overriding the TLSConfig. Add comment for location of documentation for event types.
|
@exekias Ready for another look. |
exekias
left a comment
There was a problem hiding this comment.
This is looking good, I left some minor comments. Also CI found some issues, this is ready to go once CI is happy.
| } | ||
|
|
||
| // InitDefaults initialize the defaults for the configuration. | ||
| func (c *Config) InitDefaults() { |
There was a problem hiding this comment.
Not a strong opinion, but we normally use this pattern:
beats/metricbeat/helper/config.go
Line 35 in 837279a
so you can get defaults on a single call, this way you don't risk forgetting to call InitDefaults
There was a problem hiding this comment.
I think this is a new way of initializing defaults 🙂 elastic/go-ucfg#141
There was a problem hiding this comment.
Awesome, I missed this change 👍
| // EventType defines the different event types that can be raised from RPLClient. | ||
| type EventType uint | ||
|
|
||
| // EventTypes from loggregator documented here: https://github.com/cloudfoundry/loggregator-api |
There was a problem hiding this comment.
thanks for adding this, really helpful! It would look like we are using V1 types?
There was a problem hiding this comment.
Yes the code always converts from V2 types to V1. V2 doesn't have any more events then V1 just a different structure.
| } | ||
|
|
||
| // InitDefaults initialize the defaults for the configuration. | ||
| func (c *Config) InitDefaults() { |
There was a problem hiding this comment.
I think this is a new way of initializing defaults 🙂 elastic/go-ucfg#141
| THE SOFTWARE. | ||
|
|
||
| -------------------------------------------------------------------- | ||
| Dependency: github.com/cloudfoundry/sonde-go |
There was a problem hiding this comment.
Looking at this dependecy, we might need to copy a few files manually to make it work. But that's not a problem.
|
I am sorry, I just wanted to comment. But I accidentally clicked on approve. |
…ead of the kubernetes ttl cache. Fix other suggestions.
|
LGTM once @jsoriano is 👍 |
| // Stop receiving events | ||
| func (c *RlpListener) Stop() { | ||
| c.log.Debugw("Stopping RLP listener.", "rlpAddress", c.rlpAddress) | ||
| c.log.Debugw("stopping RLP listener.", "rlpAddress", c.rlpAddress) |
There was a problem hiding this comment.
Logged messages can start with uppercase 🙂
| c.log.Debugw("stopping RLP listener.", "rlpAddress", c.rlpAddress) | |
| c.log.Debugw("Stopping RLP listener.", "rlpAddress", c.rlpAddress) |
|
|
||
| jsonData := make(map[string]interface{}) | ||
| decoder := json.NewDecoder(resp.Body) | ||
| err = decoder.Decode(&jsonData) |
* Add cloudfoundry common client into x-pack/common. * Run mage fmt. * Add support for tlscommon.Config, removing the uaago depedency as it didn't expose overriding the TLSConfig. Add comment for location of documentation for event types. * Use common.Cache with addition of not updated expiration on get, instead of the kubernetes ttl cache. Fix other suggestions. * Fix cache_test and new test for not updated access time. * Handle error sooner in getAuthTokenWithExpiresIn. (cherry picked from commit f4c71b4)
* Add cloudfoundry common client into x-pack/common. * Run mage fmt. * Add support for tlscommon.Config, removing the uaago depedency as it didn't expose overriding the TLSConfig. Add comment for location of documentation for event types. * Use common.Cache with addition of not updated expiration on get, instead of the kubernetes ttl cache. Fix other suggestions. * Fix cache_test and new test for not updated access time. * Handle error sooner in getAuthTokenWithExpiresIn. (cherry picked from commit f4c71b4)
What does this PR do?
Prerequisite to adding an input for filebeat and a module for metricbeat. Contains the required clients and code to use Cloud Foundry loggregator API to collect logs and metrics.
Worry is in the size increase of the binary for the included Cloud Foundry dependencies. Once the filebeat input is enabled in a later PR the size increase is only 3M. Increases from 119M to 122M.
Why is it important?
To support Cloud Foundry.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesAuthor's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs