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

refactor: Removed client monitoring #2595

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion api/raml/system-agent.raml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ schemas:
body:
application/json:
schema: config
example: '{"Service":"edgex-support-notifications","Config":{"Clients":{"Logging":{"Host":"localhost","Port":48061,"Protocol":"http"}},"Databases":{"Primary":{"Host":"localhost","Name":"notifications","Password":"","Port":27017,"Timeout":5000,"Type":"mongodb","Username":""}},"Logging":{"EnableRemote":false,"File":"./logs/edgex-support-notifications.log"},"Registry":{"Host":"localhost","Port":8500,"Type":"consul"},"ResendLimit":2,"Service":{"BootTimeout":30000,"CheckInterval":"10s","ClientMonitor":15000,"Host":"localhost","Port":48060,"Protocol":"http","MaxResultCount":1000,"StartupMsg":"This is the Support Notifications Microservice","Timeout":5000},"Smtp":{"Host":"smtp.gmail.com","Password":"mypassword","Port":587,"Sender":"jdoe@gmail.com","Subject":"EdgeX Notification"}}}'
example: '{"Service":"edgex-support-notifications","Config":{"Clients":{"Logging":{"Host":"localhost","Port":48061,"Protocol":"http"}},"Databases":{"Primary":{"Host":"localhost","Name":"notifications","Password":"","Port":27017,"Timeout":5000,"Type":"mongodb","Username":""}},"Logging":{"EnableRemote":false,"File":"./logs/edgex-support-notifications.log"},"Registry":{"Host":"localhost","Port":8500,"Type":"consul"},"ResendLimit":2,"Service":{"BootTimeout":30000,"CheckInterval":"10s","Host":"localhost","Port":48060,"Protocol":"http","MaxResultCount":1000,"StartupMsg":"This is the Support Notifications Microservice","Timeout":5000},"Smtp":{"Host":"smtp.gmail.com","Password":"mypassword","Port":587,"Sender":"jdoe@gmail.com","Subject":"EdgeX Notification"}}}'
"500":
description: for unknown or unanticipated issues.
/v1/metrics/{services}:
Expand Down
1 change: 0 additions & 1 deletion cmd/core-command/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48082
Expand Down
1 change: 0 additions & 1 deletion cmd/core-data/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ChecksumAlgo = 'xxHash'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48080
Expand Down
1 change: 0 additions & 1 deletion cmd/core-metadata/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ EnableValueDescriptorManagement = false

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48081
Expand Down
1 change: 0 additions & 1 deletion cmd/support-logging/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48061
Expand Down
1 change: 0 additions & 1 deletion cmd/support-notifications/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48060
Expand Down
1 change: 0 additions & 1 deletion cmd/support-scheduler/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48085
Expand Down
1 change: 0 additions & 1 deletion cmd/sys-mgmt-agent/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ LogLevel = 'INFO'

[Service]
BootTimeout = 30000
ClientMonitor = 15000
CheckInterval = '10s'
Host = 'localhost'
Port = 48090
Expand Down
1 change: 0 additions & 1 deletion internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const (
BootTimeoutDefault = BootTimeoutSecondsDefault * 1000
BootTimeoutSecondsDefault = 30
BootRetrySecondsDefault = 1
ClientMonitorDefault = 15000
ConfigFileName = "configuration.toml"
ConfigStemCore = "edgex/core/"
ConfigStemSecurity = "edgex/security/"
Expand Down
22 changes: 6 additions & 16 deletions internal/core/command/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ import (
"context"
"sync"

"github.com/edgexfoundry/edgex-go/internal/core/command/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"
"github.com/edgexfoundry/edgex-go/internal/pkg/urlclient"
"github.com/edgexfoundry/go-mod-core-contracts/clients/urlclient/local"

bootstrapContainer "github.com/edgexfoundry/go-mod-bootstrap/bootstrap/container"
"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/startup"
"github.com/edgexfoundry/go-mod-bootstrap/di"

"github.com/edgexfoundry/edgex-go/internal/core/command/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"

"github.com/edgexfoundry/go-mod-core-contracts/clients"
"github.com/edgexfoundry/go-mod-core-contracts/clients/metadata"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -56,24 +57,13 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
// than the configured client time out would still be present.
// Until that problem is addressed by larger architectural changes, if you are experiencing a bug similar to
// https://github.com/edgexfoundry/edgex-go/issues/2421, the correct fix is to bump up the client timeout.
registryClient := bootstrapContainer.RegistryFrom(dic.Get)
configuration := container.ConfigurationFrom(dic.Get)
lc := bootstrapContainer.LoggingClientFrom(dic.Get)

// initialize clients required by the service
dic.Update(di.ServiceConstructorMap{
container.MetadataDeviceClientName: func(get di.Get) interface{} {
return metadata.NewDeviceClient(
urlclient.New(
ctx,
wg,
registryClient,
clients.CoreMetaDataServiceKey,
clients.ApiDeviceRoute,
configuration.Service.ClientMonitor,
configuration.Clients["Metadata"].Url()+clients.ApiDeviceRoute,
),
)
return metadata.NewDeviceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute))
},
errorContainer.ErrorHandlerName: func(get di.Get) interface{} {
return errorconcept.NewErrorHandler(lc)
Expand Down
34 changes: 7 additions & 27 deletions internal/core/data/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ import (
"fmt"
"sync"

dataContainer "github.com/edgexfoundry/edgex-go/internal/core/data/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"
"github.com/edgexfoundry/edgex-go/internal/pkg/urlclient"
"github.com/edgexfoundry/go-mod-core-contracts/clients/urlclient/local"

"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/container"
"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/startup"
"github.com/edgexfoundry/go-mod-bootstrap/di"

dataContainer "github.com/edgexfoundry/edgex-go/internal/core/data/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"

"github.com/edgexfoundry/go-mod-core-contracts/clients"
"github.com/edgexfoundry/go-mod-core-contracts/clients/metadata"
"github.com/edgexfoundry/go-mod-messaging/messaging"
Expand All @@ -53,31 +54,10 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
loadRestRoutes(b.router, dic)

configuration := dataContainer.ConfigurationFrom(dic.Get)
registryClient := container.RegistryFrom(dic.Get)
lc := container.LoggingClientFrom(dic.Get)

mdc := metadata.NewDeviceClient(
urlclient.New(
ctx,
wg,
registryClient,
clients.CoreMetaDataServiceKey,
clients.ApiDeviceRoute,
configuration.Service.ClientMonitor,
configuration.Clients["Metadata"].Url()+clients.ApiDeviceRoute,
),
)
msc := metadata.NewDeviceServiceClient(
urlclient.New(
ctx,
wg,
registryClient,
clients.CoreMetaDataServiceKey,
clients.ApiDeviceServiceRoute,
configuration.Service.ClientMonitor,
configuration.Clients["Metadata"].Url()+clients.ApiDeviceRoute,
),
)
mdc := metadata.NewDeviceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute))
msc := metadata.NewDeviceServiceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute))

// Create the messaging client
msgClient, err := messaging.NewMessageClient(
Expand Down
33 changes: 8 additions & 25 deletions internal/core/metadata/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import (
"context"
"sync"

"github.com/edgexfoundry/edgex-go/internal/core/metadata/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"
"github.com/edgexfoundry/edgex-go/internal/pkg/urlclient"
"github.com/edgexfoundry/go-mod-core-contracts/clients/urlclient/local"

bootstrapContainer "github.com/edgexfoundry/go-mod-bootstrap/bootstrap/container"
"github.com/edgexfoundry/go-mod-bootstrap/bootstrap/startup"
Expand All @@ -30,6 +27,10 @@ import (
"github.com/edgexfoundry/go-mod-core-contracts/clients/coredata"
"github.com/edgexfoundry/go-mod-core-contracts/clients/notifications"
"github.com/gorilla/mux"

"github.com/edgexfoundry/edgex-go/internal/core/metadata/container"
errorContainer "github.com/edgexfoundry/edgex-go/internal/pkg/container"
"github.com/edgexfoundry/edgex-go/internal/pkg/errorconcept"
)

// Bootstrap contains references to dependencies required by the BootstrapHandler.
Expand All @@ -56,7 +57,6 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
// Until that problem is addressed by larger architectural changes, if you are experiencing a bug similar to
// https://github.com/edgexfoundry/edgex-go/issues/2421, the correct fix is to bump up the client timeout.
configuration := container.ConfigurationFrom(dic.Get)
registryClient := bootstrapContainer.RegistryFrom(dic.Get)

// add dependencies to container
dic.Update(di.ServiceConstructorMap{
Expand All @@ -65,29 +65,12 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
},
container.CoreDataValueDescriptorClientName: func(get di.Get) interface{} {
return coredata.NewValueDescriptorClient(
urlclient.New(
ctx,
wg,
registryClient,
clients.CoreDataServiceKey,
clients.ApiValueDescriptorRoute,
configuration.Service.ClientMonitor,
configuration.Clients["CoreData"].Url()+clients.ApiValueDescriptorRoute,
),
)
local.New(configuration.Clients["CoreData"].Url() + clients.ApiValueDescriptorRoute))
},
container.NotificationsClientName: func(get di.Get) interface{} {
return notifications.NewNotificationsClient(
urlclient.New(
ctx,
wg,
registryClient,
clients.SupportNotificationsServiceKey,
clients.ApiNotificationRoute,
configuration.Service.ClientMonitor,
configuration.Clients["Notifications"].Url()+clients.ApiNotificationRoute,
),
)
local.New(configuration.Clients["Notifications"].Url() + clients.ApiNotificationRoute))

},
})

Expand Down
88 changes: 0 additions & 88 deletions internal/pkg/endpoint/endpoint.go

This file was deleted.

56 changes: 0 additions & 56 deletions internal/pkg/urlclient/factory.go

This file was deleted.

Loading