Skip to content

Commit 218df2f

Browse files
authored
Merge pull request #93 from StackVista/stac-22163-embed-platform-info-in-connection-validation-log
STAC-22163: print platform version on connection success
2 parents ea4007d + 85d16fe commit 218df2f

40 files changed

+3576
-22
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
# Require: The version of golangci-lint to use.
4040
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
4141
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
42-
version: v1.54
42+
version: v1.64.4
4343

4444
check-license:
4545
name: License scan

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ linters-settings:
2121
- github.com/stackvista
2222
lll:
2323
line-length: 250
24-
gomnd:
24+
mnd:
2525
checks:
2626
- argument
2727
- case
@@ -47,15 +47,15 @@ linters:
4747
- dupl
4848
- errcheck
4949
- exhaustive
50-
- exportloopref
50+
- copyloopvar
5151
- funlen
5252
- gochecknoinits
5353
- goconst
5454
- gocritic
5555
- gocyclo
5656
- gofmt
5757
- goimports
58-
- gomnd
58+
- mnd
5959
- goprintffuncname
6060
# - gosec TODO: enable when fixed
6161
- gosimple

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" >> ~
2121
4. Enter development shell `nix develop`
2222
5. Run `go run main.go`
2323

24-
It also possible to use nix phases to test `nix develop --check` and build the application `nix develop --build`, as specified in the Makefile, without entering the shell.
24+
It's also possible to use nix phases to test `nix develop --check` and build the application `nix develop --build`, as specified in the Makefile, without entering the shell.
2525

2626
6. Read the [command development guide](CMD_DEVELOPMENT.md).
2727

cmd/context/common.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,22 @@ import (
1313
)
1414

1515
func PrintConnectionSuccess(pr printer.Printer, apiUrl string, serverInfo *stackstate_api.ServerInfo) {
16-
pr.Success(
17-
fmt.Sprintf("Connection verified to %s (StackState version: %s)",
18-
apiUrl,
19-
client.VersionToString(serverInfo.Version),
20-
),
21-
)
16+
if serverInfo.PlatformVersion != nil {
17+
pr.Success(
18+
fmt.Sprintf("Connection verified to %s (Platform version: %s)",
19+
apiUrl,
20+
*serverInfo.PlatformVersion,
21+
),
22+
)
23+
} else {
24+
// Fallback to serverInfo.Version if platformVersion is not present (an updated client could interact with a server not supporting PlatformVersion yet).
25+
pr.Success(
26+
fmt.Sprintf("Connection verified to %s (StackState version: %s)",
27+
apiUrl,
28+
client.VersionToString(serverInfo.Version),
29+
),
30+
)
31+
}
2232
}
2333

2434
func ValidateContext(cli *di.Deps, cmd *cobra.Command, cfg *config.StsContext) (*stackstate_api.ServerInfo, common.CLIError) {

cmd/health/health_status.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func metricBucketToJson(name string, bucket []stackstate_api.MetricBucketValue,
129129
return map[string]interface{}{
130130
"name": name,
131131
fmt.Sprintf("now-%d", size): metricValueOrDash(bucket, 0),
132-
fmt.Sprintf("%d-%d", size, 2*size): metricValueOrDash(bucket, 1), //nolint:gomnd
133-
fmt.Sprintf("%d-%d", 2*size, 3*size): metricValueOrDash(bucket, 2), //nolint:gomnd
132+
fmt.Sprintf("%d-%d", size, 2*size): metricValueOrDash(bucket, 1), //nolint:mnd
133+
fmt.Sprintf("%d-%d", 2*size, 3*size): metricValueOrDash(bucket, 2), //nolint:mnd
134134
}
135135
}
136136

@@ -150,14 +150,14 @@ func metricBucketToRow(name string, bucket []stackstate_api.MetricBucketValue) [
150150
name,
151151
metricValueOrDash(bucket, 0),
152152
metricValueOrDash(bucket, 1),
153-
metricValueOrDash(bucket, 2), //nolint:gomnd
153+
metricValueOrDash(bucket, 2), //nolint:mnd
154154
}
155155
}
156156

157157
func streamMetricsToTable(metrics stackstate_api.HealthStreamMetrics) printer.TableData {
158158
size := metrics.BucketSizeSeconds
159159
return printer.TableData{
160-
Header: []string{"Metric", fmt.Sprintf("%ds ago", size), fmt.Sprintf("%d-%ds ago", size, 2*size), fmt.Sprintf("%d-%ds ago", 2*size, 3*size)}, //nolint:gomnd
160+
Header: []string{"Metric", fmt.Sprintf("%ds ago", size), fmt.Sprintf("%d-%ds ago", size, 2*size), fmt.Sprintf("%d-%ds ago", 2*size, 3*size)}, //nolint:mnd
161161
Data: [][]interface{}{
162162
metricBucketToRow("latency seconds", metrics.LatencySeconds),
163163
metricBucketToRow("messages per seconds", metrics.MessagePerSecond),

generated/stackstate_api/.openapi-generator/FILES

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ api_stackpack.go
3131
api_subject.go
3232
api_subscription.go
3333
api_system_notifications.go
34+
api_timeline.go
3435
api_topic.go
3536
api_topology_synchronization.go
3637
api_traces.go
38+
api_user_authorization.go
3739
api_user_profile.go
3840
api_user_session.go
3941
client.go
@@ -81,6 +83,7 @@ docs/ComponentHighlightMetricSection.md
8183
docs/ComponentHighlightMetricSectionAllOf.md
8284
docs/ComponentNotFoundError.md
8385
docs/ComponentQuery.md
86+
docs/ComponentViewArguments.md
8487
docs/CreateSubject.md
8588
docs/DataUnavailable.md
8689
docs/DependencyDirection.md
@@ -100,6 +103,7 @@ docs/EventCategoryBucket.md
100103
docs/EventComponent.md
101104
docs/EventCursor.md
102105
docs/EventElement.md
106+
docs/EventFilters.md
103107
docs/EventItemsWithTotal.md
104108
docs/EventListRequest.md
105109
docs/EventNotFoundError.md
@@ -297,6 +301,7 @@ docs/PromSeriesEnvelope.md
297301
docs/PromVector.md
298302
docs/PromVectorResult.md
299303
docs/ProvisionResponse.md
304+
docs/QueryViewArguments.md
300305
docs/ReleaseStatus.md
301306
docs/RequestError.md
302307
docs/RequestValidationError.md
@@ -359,6 +364,13 @@ docs/TeamsChannelRefId.md
359364
docs/TeamsChannelWriteSchema.md
360365
docs/TeamsNotificationChannel.md
361366
docs/TeamsNotificationChannelAllOf.md
367+
docs/TimelineApi.md
368+
docs/TimelineSummary.md
369+
docs/TimelineSummaryError.md
370+
docs/TimelineSummaryEventBucket.md
371+
docs/TimelineSummaryHealthChange.md
372+
docs/TimelineSummaryRequest.md
373+
docs/TimelineSummaryRequestArguments.md
362374
docs/TooManyActiveQueries.md
363375
docs/TooManyTopologyResults.md
364376
docs/Topic.md
@@ -391,6 +403,7 @@ docs/Traces.md
391403
docs/TracesApi.md
392404
docs/UnlicensedSubscription.md
393405
docs/UnmatchedCheckState.md
406+
docs/UserAuthorizationApi.md
394407
docs/UserNameMismatchError.md
395408
docs/UserNotFoundError.md
396409
docs/UserNotLoggedInError.md
@@ -444,6 +457,7 @@ model_component_highlight_metric_section.go
444457
model_component_highlight_metric_section_all_of.go
445458
model_component_not_found_error.go
446459
model_component_query.go
460+
model_component_view_arguments.go
447461
model_create_subject.go
448462
model_data_unavailable.go
449463
model_dependency_direction.go
@@ -461,6 +475,7 @@ model_event_category_bucket.go
461475
model_event_component.go
462476
model_event_cursor.go
463477
model_event_element.go
478+
model_event_filters.go
464479
model_event_items_with_total.go
465480
model_event_list_request.go
466481
model_event_not_found_error.go
@@ -644,6 +659,7 @@ model_prom_series_envelope.go
644659
model_prom_vector.go
645660
model_prom_vector_result.go
646661
model_provision_response.go
662+
model_query_view_arguments.go
647663
model_release_status.go
648664
model_request_error.go
649665
model_request_validation_error.go
@@ -699,6 +715,12 @@ model_teams_channel_ref_id.go
699715
model_teams_channel_write_schema.go
700716
model_teams_notification_channel.go
701717
model_teams_notification_channel_all_of.go
718+
model_timeline_summary.go
719+
model_timeline_summary_error.go
720+
model_timeline_summary_event_bucket.go
721+
model_timeline_summary_health_change.go
722+
model_timeline_summary_request.go
723+
model_timeline_summary_request_arguments.go
702724
model_too_many_active_queries.go
703725
model_too_many_topology_results.go
704726
model_topic.go

generated/stackstate_api/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Class | Method | HTTP request | Description
211211
*SubscriptionApi* | [**GetSubscription**](docs/SubscriptionApi.md#getsubscription) | **Get** /subscription | Get subscription info
212212
*SubscriptionApi* | [**PostSubscription**](docs/SubscriptionApi.md#postsubscription) | **Post** /subscription | Submit a new license to update the subscription
213213
*SystemNotificationsApi* | [**AllSystemNotifications**](docs/SystemNotificationsApi.md#allsystemnotifications) | **Get** /system/notifications | Overview of system notifications
214+
*TimelineApi* | [**GetTimelineSummary**](docs/TimelineApi.md#gettimelinesummary) | **Post** /timeline/summary | Timeline summary
214215
*TopicApi* | [**Describe**](docs/TopicApi.md#describe) | **Get** /topic/{topic} | Describe a topic
215216
*TopicApi* | [**List**](docs/TopicApi.md#list) | **Get** /topic | List topics
216217
*TopologySynchronizationApi* | [**GetTopologySynchronizationStreamById**](docs/TopologySynchronizationApi.md#gettopologysynchronizationstreambyid) | **Get** /synchronization/topology/streams/sync | Overview of a specific Topology Stream, queried by node id or sync identifier
@@ -225,6 +226,7 @@ Class | Method | HTTP request | Description
225226
*TracesApi* | [**SuggestionsAttributeName**](docs/TracesApi.md#suggestionsattributename) | **Get** /traces/spans/fields/attributes | Suggestions for attribute names
226227
*TracesApi* | [**SuggestionsAttributeValue**](docs/TracesApi.md#suggestionsattributevalue) | **Get** /traces/spans/fields/attributes/{attributeName}/values | Suggestions for attribute values
227228
*TracesApi* | [**SuggestionsFieldValues**](docs/TracesApi.md#suggestionsfieldvalues) | **Get** /traces/spans/fields/{field}/values | Suggestions for span fields
229+
*UserAuthorizationApi* | [**GetUserAuthorizationFor**](docs/UserAuthorizationApi.md#getuserauthorizationfor) | **Get** /user/authorization/for | Is the current user authorized for the provided permission
228230
*UserProfileApi* | [**GetCurrentUserProfile**](docs/UserProfileApi.md#getcurrentuserprofile) | **Get** /user/profile | Get current user profile
229231
*UserProfileApi* | [**SaveCurrentUserProfile**](docs/UserProfileApi.md#savecurrentuserprofile) | **Put** /user/profile | Save current user profile
230232
*UserSessionApi* | [**GetUserSessionAssumedRole**](docs/UserSessionApi.md#getusersessionassumedrole) | **Get** /user/session/assumedRole | Get the assumed a role for the current session
@@ -272,6 +274,7 @@ Class | Method | HTTP request | Description
272274
- [ComponentHighlightMetricSectionAllOf](docs/ComponentHighlightMetricSectionAllOf.md)
273275
- [ComponentNotFoundError](docs/ComponentNotFoundError.md)
274276
- [ComponentQuery](docs/ComponentQuery.md)
277+
- [ComponentViewArguments](docs/ComponentViewArguments.md)
275278
- [CreateSubject](docs/CreateSubject.md)
276279
- [DataUnavailable](docs/DataUnavailable.md)
277280
- [DependencyDirection](docs/DependencyDirection.md)
@@ -289,6 +292,7 @@ Class | Method | HTTP request | Description
289292
- [EventComponent](docs/EventComponent.md)
290293
- [EventCursor](docs/EventCursor.md)
291294
- [EventElement](docs/EventElement.md)
295+
- [EventFilters](docs/EventFilters.md)
292296
- [EventItemsWithTotal](docs/EventItemsWithTotal.md)
293297
- [EventListRequest](docs/EventListRequest.md)
294298
- [EventNotFoundError](docs/EventNotFoundError.md)
@@ -472,6 +476,7 @@ Class | Method | HTTP request | Description
472476
- [PromVector](docs/PromVector.md)
473477
- [PromVectorResult](docs/PromVectorResult.md)
474478
- [ProvisionResponse](docs/ProvisionResponse.md)
479+
- [QueryViewArguments](docs/QueryViewArguments.md)
475480
- [ReleaseStatus](docs/ReleaseStatus.md)
476481
- [RequestError](docs/RequestError.md)
477482
- [RequestValidationError](docs/RequestValidationError.md)
@@ -527,6 +532,12 @@ Class | Method | HTTP request | Description
527532
- [TeamsChannelWriteSchema](docs/TeamsChannelWriteSchema.md)
528533
- [TeamsNotificationChannel](docs/TeamsNotificationChannel.md)
529534
- [TeamsNotificationChannelAllOf](docs/TeamsNotificationChannelAllOf.md)
535+
- [TimelineSummary](docs/TimelineSummary.md)
536+
- [TimelineSummaryError](docs/TimelineSummaryError.md)
537+
- [TimelineSummaryEventBucket](docs/TimelineSummaryEventBucket.md)
538+
- [TimelineSummaryHealthChange](docs/TimelineSummaryHealthChange.md)
539+
- [TimelineSummaryRequest](docs/TimelineSummaryRequest.md)
540+
- [TimelineSummaryRequestArguments](docs/TimelineSummaryRequestArguments.md)
530541
- [TooManyActiveQueries](docs/TooManyActiveQueries.md)
531542
- [TooManyTopologyResults](docs/TooManyTopologyResults.md)
532543
- [Topic](docs/Topic.md)

0 commit comments

Comments
 (0)