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

STAC-21654: Add data regarding to how many nodes an agent lease count… #87

Merged
merged 1 commit into from
Sep 10, 2024
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
9 changes: 5 additions & 4 deletions cmd/agent/agent_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func RunListCommand(cmd *cobra.Command, cli *di.Deps, api *stackstate_api.APICli
for _, agent := range agentList {
switch agent.Lease {
case stackstate_api.AGENTLEASE_ACTIVE:
active++
active += int(agent.NodeBudgetCount)
case stackstate_api.AGENTLEASE_LIMITED:
limited++
limited += int(agent.NodeBudgetCount)
case stackstate_api.AGENTLEASE_STALE:
stale++
stale += int(agent.NodeBudgetCount)
default:
}
}
Expand All @@ -81,10 +81,11 @@ func RunListCommand(cmd *cobra.Command, cli *di.Deps, api *stackstate_api.APICli
fmt.Sprintf("%vMB", info.MemoryBytes/toMB),
info.Platform,
info.KernelVersion,
agent.NodeBudgetCount,
}
}
cli.Printer.Table(printer.TableData{
Header: []string{"Host", "Lease", "Registered", "Last Lease", "CPUS", "Memory", "Platform", "Kernel"},
Header: []string{"Host", "Lease", "Registered", "Last Lease", "CPUS", "Memory", "Platform", "Kernel", "# Nodes"},
Data: data,
})

Expand Down
8 changes: 5 additions & 3 deletions cmd/agent/agent_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ var (
MemoryBytes: 16 * 1024 * 1024,
KernelVersion: "5.15",
},
NodeBudgetCount: 1,
}, {
AgentId: "id2",
Lease: stackstate_api.AGENTLEASE_LIMITED,
LeaseUntilEpochMs: 0,
RegisteredEpochMs: 0,
AgentData: nil,
NodeBudgetCount: 2,
},
}
)
Expand All @@ -49,10 +51,10 @@ func TestAgentList(t *testing.T) {

expectedTable := []printer.TableData{
{
Header: []string{"Host", "Lease", "Registered", "Last Lease", "CPUS", "Memory", "Platform", "Kernel"},
Header: []string{"Host", "Lease", "Registered", "Last Lease", "CPUS", "Memory", "Platform", "Kernel", "# Nodes"},
Data: [][]interface{}{
{"id1", stackstate_api.AGENTLEASE_ACTIVE, nulTime, nulTime, "4", "16MB", "platform", "5.15"},
{"id2", stackstate_api.AGENTLEASE_LIMITED, nulTime, nulTime, "0", "0MB", "", ""},
{"id1", stackstate_api.AGENTLEASE_ACTIVE, nulTime, nulTime, "4", "16MB", "platform", "5.15", int32(1)},
{"id2", stackstate_api.AGENTLEASE_LIMITED, nulTime, nulTime, "0", "0MB", "", "", int32(2)},
},
},
}
Expand Down
34 changes: 34 additions & 0 deletions generated/stackstate_api/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6890,6 +6890,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand All @@ -6910,6 +6911,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -6940,6 +6942,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -6987,6 +6990,8 @@ components:
$ref: '#/components/schemas/MonitorStatusValue'
runtimeStatus:
$ref: '#/components/schemas/MonitorRuntimeStatusValue'
dummy:
type: boolean
lastUpdateTimestamp:
format: int64
type: integer
Expand Down Expand Up @@ -7245,6 +7250,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -7743,6 +7749,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -7787,6 +7794,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -7841,6 +7849,7 @@ components:
tags:
- tags
- tags
dummy: true
functionId: 6
lastUpdateTimestamp: 5
name: name
Expand Down Expand Up @@ -8736,13 +8745,18 @@ components:
example:
identifier: identifier
lastUpdateTimestamp: 6
systemNotificationsRead:
- systemNotificationsRead
- systemNotificationsRead
starredViews:
- 1
- 1
name: name
description: description
hideUnavailableMonitors: true
id: 0
ownedBy: ownedBy
hideUnavailableMetrics: true
properties:
id:
format: int64
Expand All @@ -8763,10 +8777,21 @@ components:
format: int64
type: integer
type: array
systemNotificationsRead:
items:
type: string
type: array
hideUnavailableMonitors:
type: boolean
hideUnavailableMetrics:
type: boolean
ownedBy:
type: string
required:
- hideUnavailableMetrics
- hideUnavailableMonitors
- name
- systemNotificationsRead
type: object
ApiToken:
example:
Expand Down Expand Up @@ -12670,6 +12695,7 @@ components:
AgentRegistration:
example:
agentId: agentId
nodeBudgetCount: 5
leaseUntilEpochMs: 0
registeredEpochMs: 6
lease: null
Expand All @@ -12691,10 +12717,15 @@ components:
type: integer
agentData:
$ref: '#/components/schemas/AgentData'
nodeBudgetCount:
description: "The registration might count for more than one standard (4CPU,\
\ 16Gb) node"
type: integer
required:
- agentId
- lease
- leaseUntilEpochMs
- nodeBudgetCount
- registeredEpochMs
type: object
AgentLease:
Expand Down Expand Up @@ -12729,6 +12760,7 @@ components:
example:
agents:
- agentId: agentId
nodeBudgetCount: 5
leaseUntilEpochMs: 0
registeredEpochMs: 6
lease: null
Expand All @@ -12738,6 +12770,7 @@ components:
coreCount: 1
platform: platform
- agentId: agentId
nodeBudgetCount: 5
leaseUntilEpochMs: 0
registeredEpochMs: 6
lease: null
Expand Down Expand Up @@ -13194,6 +13227,7 @@ components:
enum:
- DEVIATING
- CRITICAL
- UNKNOWN
type: string
ArgumentPromQLMetricVal:
properties:
Expand Down
23 changes: 22 additions & 1 deletion generated/stackstate_api/docs/AgentRegistration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ Name | Type | Description | Notes
**LeaseUntilEpochMs** | **int64** | |
**RegisteredEpochMs** | **int64** | |
**AgentData** | Pointer to [**AgentData**](AgentData.md) | | [optional]
**NodeBudgetCount** | **int32** | The registration might count for more than one standard (4CPU, 16Gb) node |

## Methods

### NewAgentRegistration

`func NewAgentRegistration(agentId string, lease AgentLease, leaseUntilEpochMs int64, registeredEpochMs int64, ) *AgentRegistration`
`func NewAgentRegistration(agentId string, lease AgentLease, leaseUntilEpochMs int64, registeredEpochMs int64, nodeBudgetCount int32, ) *AgentRegistration`

NewAgentRegistration instantiates a new AgentRegistration object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -134,6 +135,26 @@ SetAgentData sets AgentData field to given value.

HasAgentData returns a boolean if a field has been set.

### GetNodeBudgetCount

`func (o *AgentRegistration) GetNodeBudgetCount() int32`

GetNodeBudgetCount returns the NodeBudgetCount field if non-nil, zero value otherwise.

### GetNodeBudgetCountOk

`func (o *AgentRegistration) GetNodeBudgetCountOk() (*int32, bool)`

GetNodeBudgetCountOk returns a tuple with the NodeBudgetCount field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetNodeBudgetCount

`func (o *AgentRegistration) SetNodeBudgetCount(v int32)`

SetNodeBudgetCount sets NodeBudgetCount field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 2 additions & 0 deletions generated/stackstate_api/docs/FailingHealthStateValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

* `CRITICAL` (value: `"CRITICAL"`)

* `UNKNOWN` (value: `"UNKNOWN"`)


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
26 changes: 26 additions & 0 deletions generated/stackstate_api/docs/Monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Name | Type | Description | Notes
**CanClone** | **bool** | |
**Status** | [**MonitorStatusValue**](MonitorStatusValue.md) | |
**RuntimeStatus** | [**MonitorRuntimeStatusValue**](MonitorRuntimeStatusValue.md) | |
**Dummy** | Pointer to **bool** | | [optional]
**LastUpdateTimestamp** | **int64** | |

## Methods
Expand Down Expand Up @@ -360,6 +361,31 @@ and a boolean to check if the value has been set.
SetRuntimeStatus sets RuntimeStatus field to given value.


### GetDummy

`func (o *Monitor) GetDummy() bool`

GetDummy returns the Dummy field if non-nil, zero value otherwise.

### GetDummyOk

`func (o *Monitor) GetDummyOk() (*bool, bool)`

GetDummyOk returns a tuple with the Dummy field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetDummy

`func (o *Monitor) SetDummy(v bool)`

SetDummy sets Dummy field to given value.

### HasDummy

`func (o *Monitor) HasDummy() bool`

HasDummy returns a boolean if a field has been set.

### GetLastUpdateTimestamp

`func (o *Monitor) GetLastUpdateTimestamp() int64`
Expand Down
65 changes: 64 additions & 1 deletion generated/stackstate_api/docs/UserProfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ Name | Type | Description | Notes
**Description** | Pointer to **string** | | [optional]
**Identifier** | Pointer to **string** | | [optional]
**StarredViews** | Pointer to **[]int64** | | [optional]
**SystemNotificationsRead** | **[]string** | |
**HideUnavailableMonitors** | **bool** | |
**HideUnavailableMetrics** | **bool** | |
**OwnedBy** | Pointer to **string** | | [optional]

## Methods

### NewUserProfile

`func NewUserProfile(name string, ) *UserProfile`
`func NewUserProfile(name string, systemNotificationsRead []string, hideUnavailableMonitors bool, hideUnavailableMetrics bool, ) *UserProfile`

NewUserProfile instantiates a new UserProfile object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -176,6 +179,66 @@ SetStarredViews sets StarredViews field to given value.

HasStarredViews returns a boolean if a field has been set.

### GetSystemNotificationsRead

`func (o *UserProfile) GetSystemNotificationsRead() []string`

GetSystemNotificationsRead returns the SystemNotificationsRead field if non-nil, zero value otherwise.

### GetSystemNotificationsReadOk

`func (o *UserProfile) GetSystemNotificationsReadOk() (*[]string, bool)`

GetSystemNotificationsReadOk returns a tuple with the SystemNotificationsRead field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetSystemNotificationsRead

`func (o *UserProfile) SetSystemNotificationsRead(v []string)`

SetSystemNotificationsRead sets SystemNotificationsRead field to given value.


### GetHideUnavailableMonitors

`func (o *UserProfile) GetHideUnavailableMonitors() bool`

GetHideUnavailableMonitors returns the HideUnavailableMonitors field if non-nil, zero value otherwise.

### GetHideUnavailableMonitorsOk

`func (o *UserProfile) GetHideUnavailableMonitorsOk() (*bool, bool)`

GetHideUnavailableMonitorsOk returns a tuple with the HideUnavailableMonitors field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetHideUnavailableMonitors

`func (o *UserProfile) SetHideUnavailableMonitors(v bool)`

SetHideUnavailableMonitors sets HideUnavailableMonitors field to given value.


### GetHideUnavailableMetrics

`func (o *UserProfile) GetHideUnavailableMetrics() bool`

GetHideUnavailableMetrics returns the HideUnavailableMetrics field if non-nil, zero value otherwise.

### GetHideUnavailableMetricsOk

`func (o *UserProfile) GetHideUnavailableMetricsOk() (*bool, bool)`

GetHideUnavailableMetricsOk returns a tuple with the HideUnavailableMetrics field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetHideUnavailableMetrics

`func (o *UserProfile) SetHideUnavailableMetrics(v bool)`

SetHideUnavailableMetrics sets HideUnavailableMetrics field to given value.


### GetOwnedBy

`func (o *UserProfile) GetOwnedBy() string`
Expand Down
2 changes: 1 addition & 1 deletion generated/stackstate_api/docs/UserProfileApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import (
)

func main() {
userProfile := *openapiclient.NewUserProfile("Name_example") // UserProfile |
userProfile := *openapiclient.NewUserProfile("Name_example", []string{"SystemNotificationsRead_example"}, false, false) // UserProfile |

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
Expand Down
Loading
Loading