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

[Ingest Manager] Expose processes and their metrics #24788

Merged
merged 30 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9da49c
processes exposed
michalpristas Mar 25, 2021
cb72c8d
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Mar 26, 2021
1beb18c
lint
michalpristas Mar 26, 2021
03a58cb
notice
michalpristas Mar 26, 2021
f89a02e
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Mar 29, 2021
482a141
http
michalpristas Mar 29, 2021
cfce22d
disabled by default
michalpristas Mar 31, 2021
3798b74
config update
michalpristas Mar 31, 2021
2d3ee37
fixed tests
michalpristas Mar 31, 2021
07e3ff1
allow specify enabled/host/port
michalpristas Mar 31, 2021
ff2791d
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Mar 31, 2021
2cc17ba
basic status codes
michalpristas Apr 1, 2021
f4145ee
200-ok;404-process not found;500-unexpected error
michalpristas Apr 1, 2021
ed2b1f8
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Apr 1, 2021
74504cc
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Apr 6, 2021
af36c9a
Add status subcommand to report status of running daemon. (#24856)
blakerouse Apr 1, 2021
965db5e
Add ability to destroy indices with wildcards in testing (#24915)
Apr 2, 2021
5677082
[Elastic Agent]: Reduce allowed socket path length (#24914)
simitt Apr 2, 2021
d763189
[Elastic Agent] Cloud container legacy apm files. (#24896)
simitt Apr 2, 2021
46ab666
Add baseline ECS 1.9.0 upgrade (#24909)
Apr 2, 2021
d85b239
Fix error in Journalbeat commands (#24880)
dedemorton Apr 3, 2021
31156c8
feat: stage execution cache (#24780)
kuisathaverat Apr 5, 2021
556dc82
[Elastic Agent] Add check for URL set when cert and cert key. (#24904)
blakerouse Apr 5, 2021
2873c4f
[libbeat] Add wineventlog schema to decode_xml processor (#24726)
marc-gr Apr 6, 2021
085b63c
status related to error
michalpristas Apr 7, 2021
8730c4c
Merge branch 'expose-processes' of github.com:michalpristas/beats int…
michalpristas Apr 7, 2021
6fbf8a9
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Apr 7, 2021
4bdca73
lint
michalpristas Apr 7, 2021
6e190ae
test
michalpristas Apr 7, 2021
f83d7b7
Merge branch 'master' of github.com:elastic/beats into expose-processes
michalpristas Apr 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10242,6 +10242,43 @@ Contents of probable licence file $GOMODCACHE/github.com/gorhill/[email protected]
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/gorilla/mux
Version: v1.7.2
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gorilla/[email protected]/LICENSE:

Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/h2non/filetype
Version: v1.1.1-0.20201130172452-f60988ab73d5
Expand Down Expand Up @@ -31247,43 +31284,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/gorilla/mux
Version: v1.7.2
Licence type (autodetected): BSD-3-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gorilla/[email protected]/LICENSE:

Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
Dependency : github.com/gorilla/websocket
Version: v1.4.1
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ require (
github.com/google/gopacket v1.1.18-0.20191009163724-0ad7f2610e34
github.com/google/uuid v1.1.2
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
github.com/gorilla/mux v1.7.2 // indirect
github.com/gorilla/mux v1.7.2
github.com/grpc-ecosystem/grpc-gateway v1.13.0 // indirect
github.com/h2non/filetype v1.1.1-0.20201130172452-f60988ab73d5
github.com/hashicorp/go-multierror v1.1.0
Expand Down
9 changes: 9 additions & 0 deletions x-pack/elastic-agent/_meta/config/common.p2.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ inputs:
# logs: true
# # enables metrics monitoring
# metrics: true
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ inputs:
# logs: false
# # enables metrics monitoring
# metrics: false
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ inputs:
# logs: false
# # enables metrics monitoring
# metrics: false
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0
Copy link
Contributor

Choose a reason for hiding this comment

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

As we have enabled / disabled now, do we still need the support for 0 ?


# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
9 changes: 9 additions & 0 deletions x-pack/elastic-agent/_meta/elastic-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ inputs:
# logs: false
# # enables metrics monitoring
# metrics: false
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload his configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
9 changes: 9 additions & 0 deletions x-pack/elastic-agent/elastic-agent.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ inputs:
# logs: false
# # enables metrics monitoring
# metrics: false
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
9 changes: 9 additions & 0 deletions x-pack/elastic-agent/elastic-agent.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ inputs:
# logs: false
# # enables metrics monitoring
# metrics: false
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
9 changes: 9 additions & 0 deletions x-pack/elastic-agent/elastic-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ inputs:
# logs: true
# # enables metrics monitoring
# metrics: true
# # exposes agent metrics using http, by default sockets and named pipes are used
# http:
# # enables http endpoint
# enabled: false
# # The HTTP endpoint will bind to this hostname, IP address, unix socket or named pipe.
# # When using IP addresses, it is recommended to only use localhost.
# host: localhost
# # Port on which the HTTP endpoint will bind. Default is 0 meaning feature is disabled.
# port: 0

# # Allow fleet to reload its configuration locally on disk.
# # Notes: Only specific process configuration will be reloaded.
Expand Down
2 changes: 2 additions & 0 deletions x-pack/elastic-agent/pkg/agent/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/errors"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/storage"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/status"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"

"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/info"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths"
Expand All @@ -26,6 +27,7 @@ type Application interface {
Start() error
Stop() error
AgentInfo() *info.AgentInfo
Routes() *sorted.Set
}

type reexecManager interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/program"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/transpiler"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"
"github.com/elastic/go-sysinfo"

"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/filters"
Expand Down Expand Up @@ -113,6 +114,11 @@ func newFleetServerBootstrap(
return bootstrapApp, nil
}

// Routes returns a list of routes handled by server.
func (b *FleetServerBootstrap) Routes() *sorted.Set {
return b.router.Routes()
}

// Start starts a managed elastic-agent.
func (b *FleetServerBootstrap) Start() error {
b.log.Info("Agent is starting")
Expand Down
6 changes: 6 additions & 0 deletions x-pack/elastic-agent/pkg/agent/application/local_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
acker "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/fleetapi/acker/noop"
reporting "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter"
logreporter "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter/log"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"
)

type discoverFunc func() ([]string, error)
Expand Down Expand Up @@ -157,6 +158,11 @@ func newLocal(
return localApplication, nil
}

// Routes returns a list of routes handled by agent.
func (l *Local) Routes() *sorted.Set {
return l.router.Routes()
}

// Start starts a local agent.
func (l *Local) Start() error {
l.log.Info("Agent is starting")
Expand Down
6 changes: 6 additions & 0 deletions x-pack/elastic-agent/pkg/agent/application/managed_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
reporting "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter"
fleetreporter "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter/fleet"
logreporter "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/reporter/log"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"
)

type stateStore interface {
Expand Down Expand Up @@ -278,6 +279,11 @@ func newManaged(
return managedApplication, nil
}

// Routes returns a list of routes handled by agent.
func (m *Managed) Routes() *sorted.Set {
return m.router.Routes()
}

// Start starts a managed elastic-agent.
func (m *Managed) Start() error {
m.log.Info("Agent is starting")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/config"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/fleetapi"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"
)

// ConfigHandler is capable of handling configrequest.
Expand All @@ -30,6 +31,7 @@ type RoutingKey = string

// Router is an interace routes programs to correspongind stream
type Router interface {
Routes() *sorted.Set
Route(id string, grpProg map[RoutingKey][]program.Program) error
Shutdown()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func New(log *logger.Logger, factory pipeline.StreamFunc) (pipeline.Router, erro
return &router{log: log, streamFactory: factory, routes: sorted.NewSet()}, nil
}

func (r *router) Routes() *sorted.Set {
return r.routes
}

func (r *router) Route(id string, grpProg map[pipeline.RoutingKey][]program.Program) error {
s := sorted.NewSet()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,30 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/pipeline"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/configrequest"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/state"
)

type operatorStream struct {
configHandler pipeline.ConfigHandler
log *logger.Logger
}

type stater interface {
State() map[string]state.State
}

func (b *operatorStream) Close() error {
return b.configHandler.Close()
}

func (b *operatorStream) State() map[string]state.State {
if s, ok := b.configHandler.(stater); ok {
return s.State()
}

return nil
}

func (b *operatorStream) Execute(cfg configrequest.Request) error {
return b.configHandler.HandleConfig(cfg)
}
Expand Down
5 changes: 5 additions & 0 deletions x-pack/elastic-agent/pkg/agent/cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/logger"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/monitoring/noop"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/status"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/sorted"
"github.com/elastic/go-sysinfo"
)

Expand Down Expand Up @@ -299,6 +300,10 @@ type inmemRouter struct {
programs map[string][]program.Program
}

func (r *inmemRouter) Routes() *sorted.Set {
return nil
}

func (r *inmemRouter) Route(id string, grpProg map[pipeline.RoutingKey][]program.Program) error {
r.programs = grpProg
return nil
Expand Down
Loading