diff --git a/docs/generated/http/full.md b/docs/generated/http/full.md index 7673d3af932d..5ef3e1a52e6a 100644 --- a/docs/generated/http/full.md +++ b/docs/generated/http/full.md @@ -1833,6 +1833,7 @@ Response object for ListSessions and ListLocalSessions. | ----- | ---- | ----- | ----------- | -------------- | | sessions | [Session](#cockroach.server.serverpb.ListSessionsResponse-cockroach.server.serverpb.Session) | repeated | A list of sessions on this node or cluster. | [reserved](#support-status) | | errors | [ListSessionsError](#cockroach.server.serverpb.ListSessionsResponse-cockroach.server.serverpb.ListSessionsError) | repeated | Any errors that occurred during fan-out calls to other nodes. | [reserved](#support-status) | +| internal_app_name_prefix | [string](#cockroach.server.serverpb.ListSessionsResponse-string) | | If set and non-empty, indicates the prefix to application_name used for statements/queries issued internally by CockroachDB. | [reserved](#support-status) | @@ -1962,6 +1963,7 @@ Response object for ListSessions and ListLocalSessions. | ----- | ---- | ----- | ----------- | -------------- | | sessions | [Session](#cockroach.server.serverpb.ListSessionsResponse-cockroach.server.serverpb.Session) | repeated | A list of sessions on this node or cluster. | [reserved](#support-status) | | errors | [ListSessionsError](#cockroach.server.serverpb.ListSessionsResponse-cockroach.server.serverpb.ListSessionsError) | repeated | Any errors that occurred during fan-out calls to other nodes. | [reserved](#support-status) | +| internal_app_name_prefix | [string](#cockroach.server.serverpb.ListSessionsResponse-string) | | If set and non-empty, indicates the prefix to application_name used for statements/queries issued internally by CockroachDB. | [reserved](#support-status) | diff --git a/docs/generated/swagger/spec.json b/docs/generated/swagger/spec.json index 7213cf361fb0..0188077a2ae3 100644 --- a/docs/generated/swagger/spec.json +++ b/docs/generated/swagger/spec.json @@ -929,6 +929,11 @@ }, "x-go-name": "Errors" }, + "internal_app_name_prefix": { + "description": "If set and non-empty, indicates the prefix to application_name\nused for statements/queries issued internally by CockroachDB.", + "type": "string", + "x-go-name": "InternalAppNamePrefix" + }, "sessions": { "description": "A list of sessions on this node or cluster.", "type": "array", @@ -1810,6 +1815,11 @@ }, "x-go-name": "Errors" }, + "internal_app_name_prefix": { + "description": "If set and non-empty, indicates the prefix to application_name\nused for statements/queries issued internally by CockroachDB.", + "type": "string", + "x-go-name": "InternalAppNamePrefix" + }, "next": { "description": "The continuation token, for use in the next paginated call in the `start`\nparameter.", "type": "string", diff --git a/pkg/server/serverpb/status.proto b/pkg/server/serverpb/status.proto index 97b680c5f134..a16f322b99c7 100644 --- a/pkg/server/serverpb/status.proto +++ b/pkg/server/serverpb/status.proto @@ -852,6 +852,9 @@ message ListSessionsResponse { repeated Session sessions = 1 [ (gogoproto.nullable) = false ]; // Any errors that occurred during fan-out calls to other nodes. repeated ListSessionsError errors = 2 [ (gogoproto.nullable) = false ]; + // If set and non-empty, indicates the prefix to application_name + // used for statements/queries issued internally by CockroachDB. + string internal_app_name_prefix = 3; } // Request object for issuing a query cancel request. diff --git a/pkg/server/status.go b/pkg/server/status.go index 2af5e03bd417..b15fe4a9e632 100644 --- a/pkg/server/status.go +++ b/pkg/server/status.go @@ -53,6 +53,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/sql" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/catconstants" "github.com/cockroachdb/cockroach/pkg/sql/contention" "github.com/cockroachdb/cockroach/pkg/sql/flowinfra" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgwirecancel" @@ -2399,8 +2400,9 @@ func (s *statusServer) listSessionsHelper( ctx context.Context, req *serverpb.ListSessionsRequest, limit int, start paginationState, ) (*serverpb.ListSessionsResponse, paginationState, error) { response := &serverpb.ListSessionsResponse{ - Sessions: make([]serverpb.Session, 0), - Errors: make([]serverpb.ListSessionsError, 0), + Sessions: make([]serverpb.Session, 0), + Errors: make([]serverpb.ListSessionsError, 0), + InternalAppNamePrefix: catconstants.InternalAppNamePrefix, } dialFn := func(ctx context.Context, nodeID roachpb.NodeID) (interface{}, error) { diff --git a/pkg/server/tenant_status.go b/pkg/server/tenant_status.go index ca51e0f9997c..d07e826a8d58 100644 --- a/pkg/server/tenant_status.go +++ b/pkg/server/tenant_status.go @@ -126,7 +126,9 @@ func (t *tenantStatusServer) ListSessions( return nil, status.Errorf(codes.Unavailable, "instanceID not set") } - response := &serverpb.ListSessionsResponse{} + response := &serverpb.ListSessionsResponse{ + InternalAppNamePrefix: catconstants.InternalAppNamePrefix, + } nodeStatement := func(ctx context.Context, client interface{}, instanceID base.SQLInstanceID) (interface{}, error) { statusClient := client.(serverpb.StatusClient) localResponse, err := statusClient.ListLocalSessions(ctx, req) @@ -177,7 +179,10 @@ func (t *tenantStatusServer) ListLocalSessions( return nil, status.Errorf(codes.Unavailable, "instanceID not set") } - return &serverpb.ListSessionsResponse{Sessions: sessions}, nil + return &serverpb.ListSessionsResponse{ + Sessions: sessions, + InternalAppNamePrefix: catconstants.InternalAppNamePrefix, + }, nil } func (t *tenantStatusServer) CancelQuery(