Skip to content

Commit

Permalink
Adding spec version to dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldecheverz-split committed May 4, 2024
1 parent 00c9951 commit a1d87c7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions splitio/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Options struct {
Snapshotter cstorage.Snapshotter
TLS *tls.Config
FullConfig interface{}
SpecVersion string
}

type AdminServer struct {
Expand Down Expand Up @@ -66,6 +67,7 @@ func NewServer(options *Options) (*AdminServer, error) {
options.EventsEvCalc,
options.Runtime,
options.HcAppMonitor,
options.SpecVersion,
)
if err != nil {
return nil, fmt.Errorf("error instantiating dashboard controller: %w", err)
Expand Down
4 changes: 4 additions & 0 deletions splitio/admin/controllers/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type DashboardController struct {
eventsEvCalc evcalc.Monitor
runtime common.Runtime
appMonitor application.MonitorIterface
specVersion string
}

// NewDashboardController instantiates a new dashboard controller
Expand All @@ -41,6 +42,7 @@ func NewDashboardController(
eventsEvCalc evcalc.Monitor,
runtime common.Runtime,
appMonitor application.MonitorIterface,
specVersion string,
) (*DashboardController, error) {

toReturn := &DashboardController{
Expand All @@ -52,6 +54,7 @@ func NewDashboardController(
eventsEvCalc: eventsEvCalc,
impressionsEvCalc: impressionEvCalc,
appMonitor: appMonitor,
specVersion: specVersion,
}

var err error
Expand Down Expand Up @@ -110,6 +113,7 @@ func (c *DashboardController) renderDashboard() ([]byte, error) {
RefreshTime: 30000,
Stats: *c.gatherStats(),
Health: c.appMonitor.GetHealthStatus(),
SpecVersion: c.specVersion,
})

if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion splitio/admin/views/dashboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const main = `
{{template "SplitLogo" .}}
</div>
<div class="pull-right" style="text-align: center; padding-right: 10px;">
<p style="padding-top: 8px; color: white; margin: 0px; font-weight: bold; text-align: right"><span>{{.Version}}</span></p>
<p style="padding-top: 8px; color: white; margin: 0px; font-weight: bold; text-align: right"><span>{{.Version}}</span> | s=<span>{{.SpecVersion}}</span></p>
<p class="navbar-text navbar-right" style="padding-top: 0px;margin-bottom: 15px;margin-top: 0px;color:white;min-width: 175px;height: 10px;">
<a href="#" onclick="javascript:sendSignal('graceful'); return false;" class="navbar-link">
<span class="label label-success">Graceful stop</span>
Expand Down Expand Up @@ -83,6 +83,7 @@ type RootObject struct {
Stats GlobalStats `json:"stats"`
Health application.HealthDto `json:"health"`
ServicesHealth services.HealthDto `json:"servicesHealth"`
SpecVersion string
}

// GlobalStats runtime stats used to render the dashboard
Expand Down
2 changes: 1 addition & 1 deletion splitio/commitversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This file is created automatically, please do not edit
*/

// CommitVersion is the version of the last commit previous to release
const CommitVersion = "eb1a57b"
const CommitVersion = "00c9951"
1 change: 1 addition & 0 deletions splitio/producer/initialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ func Start(logger logging.LoggerInterface, cfg *conf.Main) error {
HcServicesMonitor: servicesMonitor,
FullConfig: cfgForAdmin,
TLS: adminTLSConfig,
SpecVersion: cfg.SpecVersion,
})
if err != nil {
panic(err.Error())
Expand Down
1 change: 1 addition & 0 deletions splitio/proxy/initialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func Start(logger logging.LoggerInterface, cfg *pconf.Main) error {
HcServicesMonitor: servicesMonitor,
FullConfig: cfgForAdmin,
TLS: adminTLSConfig,
SpecVersion: cfg.SpecVersion,
})
if err != nil {
return common.NewInitError(fmt.Errorf("error starting admin server: %w", err), common.ExitAdminError)
Expand Down

0 comments on commit a1d87c7

Please sign in to comment.