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

feat!: Remove old metrics collection and REST endpoint for all services #4311

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions internal/core/command/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/edgexfoundry/edgex-go/internal/core/command/config"
"github.com/edgexfoundry/edgex-go/internal/core/command/container"
"github.com/edgexfoundry/edgex-go/internal/core/command/controller/messaging"
"github.com/edgexfoundry/edgex-go/internal/pkg/telemetry"

"github.com/edgexfoundry/go-mod-core-contracts/v3/common"

Expand Down Expand Up @@ -76,7 +75,6 @@ func Main(ctx context.Context, cancel context.CancelFunc, router *mux.Router) {
MessagingBootstrapHandler,
handlers.NewServiceMetrics(common.CoreCommandServiceKey).BootstrapHandler, // Must be after Messaging
NewBootstrap(router, common.CoreCommandServiceKey).BootstrapHandler,
telemetry.BootstrapHandler,
httpServer.BootstrapHandler,
handlers.NewStartMessage(common.CoreCommandServiceKey, edgex.Version).BootstrapHandler,
})
Expand Down
1 change: 0 additions & 1 deletion internal/core/command/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func LoadRestRoutes(r *mux.Router, dic *di.Container, serviceName string) {
r.HandleFunc(common.ApiPingRoute, cc.Ping).Methods(http.MethodGet)
r.HandleFunc(common.ApiVersionRoute, cc.Version).Methods(http.MethodGet)
r.HandleFunc(common.ApiConfigRoute, cc.Config).Methods(http.MethodGet)
r.HandleFunc(common.ApiMetricsRoute, cc.Metrics).Methods(http.MethodGet)

// Command
cmd := commandController.NewCommandController(dic)
Expand Down
2 changes: 0 additions & 2 deletions internal/core/data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/edgexfoundry/edgex-go/internal/core/data/config"
"github.com/edgexfoundry/edgex-go/internal/core/data/container"
pkgHandlers "github.com/edgexfoundry/edgex-go/internal/pkg/bootstrap/handlers"
"github.com/edgexfoundry/edgex-go/internal/pkg/telemetry"
)

func Main(ctx context.Context, cancel context.CancelFunc, router *mux.Router) {
Expand Down Expand Up @@ -76,7 +75,6 @@ func Main(ctx context.Context, cancel context.CancelFunc, router *mux.Router) {
handlers.NewServiceMetrics(common.CoreDataServiceKey).BootstrapHandler, // Must be after Messaging
application.BootstrapHandler, // Must be after Service Metrics and before next handler
NewBootstrap(router, common.CoreDataServiceKey).BootstrapHandler,
telemetry.BootstrapHandler,
httpServer.BootstrapHandler,
handlers.NewStartMessage(common.CoreDataServiceKey, edgex.Version).BootstrapHandler,
},
Expand Down
1 change: 0 additions & 1 deletion internal/core/data/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func LoadRestRoutes(r *mux.Router, dic *di.Container, serviceName string) {
r.HandleFunc(common.ApiPingRoute, cc.Ping).Methods(http.MethodGet)
r.HandleFunc(common.ApiVersionRoute, cc.Version).Methods(http.MethodGet)
r.HandleFunc(common.ApiConfigRoute, cc.Config).Methods(http.MethodGet)
r.HandleFunc(common.ApiMetricsRoute, cc.Metrics).Methods(http.MethodGet)

// Events
ec := dataController.NewEventController(dic)
Expand Down
2 changes: 0 additions & 2 deletions internal/core/metadata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/edgexfoundry/edgex-go/internal/core/metadata/container"
"github.com/edgexfoundry/edgex-go/internal/core/metadata/uom"
pkgHandlers "github.com/edgexfoundry/edgex-go/internal/pkg/bootstrap/handlers"
"github.com/edgexfoundry/edgex-go/internal/pkg/telemetry"

"github.com/gorilla/mux"

Expand Down Expand Up @@ -76,7 +75,6 @@ func Main(ctx context.Context, cancel context.CancelFunc, router *mux.Router) {
handlers.MessagingBootstrapHandler,
handlers.NewServiceMetrics(common.CoreMetaDataServiceKey).BootstrapHandler, // Must be after Messaging
NewBootstrap(router, common.CoreMetaDataServiceKey).BootstrapHandler,
telemetry.BootstrapHandler,
httpServer.BootstrapHandler,
})

Expand Down
1 change: 0 additions & 1 deletion internal/core/metadata/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func LoadRestRoutes(r *mux.Router, dic *di.Container, serviceName string) {
r.HandleFunc(common.ApiPingRoute, cc.Ping).Methods(http.MethodGet)
r.HandleFunc(common.ApiVersionRoute, cc.Version).Methods(http.MethodGet)
r.HandleFunc(common.ApiConfigRoute, cc.Config).Methods(http.MethodGet)
r.HandleFunc(common.ApiMetricsRoute, cc.Metrics).Methods(http.MethodGet)

// Units of Measure
uc := metadataController.NewUnitOfMeasureController(dic)
Expand Down
19 changes: 0 additions & 19 deletions internal/pkg/controller/http/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http"

"github.com/edgexfoundry/edgex-go"
"github.com/edgexfoundry/edgex-go/internal/pkg/telemetry"

"github.com/edgexfoundry/go-mod-bootstrap/v3/bootstrap/container"
"github.com/edgexfoundry/go-mod-bootstrap/v3/di"
Expand Down Expand Up @@ -56,24 +55,6 @@ func (c *CommonController) Config(writer http.ResponseWriter, request *http.Requ
c.sendResponse(writer, request, common.ApiVersionRoute, response, http.StatusOK)
}

// Metrics handles the request to the /metrics endpoint, memory and cpu utilization stats
// It returns a response as specified by the V2 API swagger in openapi/v2
func (c *CommonController) Metrics(writer http.ResponseWriter, request *http.Request) {
telem := telemetry.NewSystemUsage()
metrics := commonDTO.Metrics{
MemAlloc: telem.Memory.Alloc,
MemFrees: telem.Memory.Frees,
MemLiveObjects: telem.Memory.LiveObjects,
MemMallocs: telem.Memory.Mallocs,
MemSys: telem.Memory.Sys,
MemTotalAlloc: telem.Memory.TotalAlloc,
CpuBusyAvg: uint8(telem.CpuBusyAvg),
}

response := commonDTO.NewMetricsResponse(metrics, c.serviceName)
c.sendResponse(writer, request, common.ApiMetricsRoute, response, http.StatusOK)
}

// sendResponse puts together the response packet for the V2 API
func (c *CommonController) sendResponse(
writer http.ResponseWriter,
Expand Down
54 changes: 0 additions & 54 deletions internal/pkg/telemetry/linux_cpu.go

This file was deleted.

108 changes: 0 additions & 108 deletions internal/pkg/telemetry/telemetry.go

This file was deleted.

43 changes: 0 additions & 43 deletions internal/pkg/telemetry/telemetry_test.go

This file was deleted.

40 changes: 0 additions & 40 deletions internal/pkg/telemetry/unimplemented_cpu.go

This file was deleted.

Loading