Skip to content

Commit d68910d

Browse files
author
Keegan Irby
committed
Address PR Feedback
1 parent d885a99 commit d68910d

File tree

10 files changed

+14
-24
lines changed

10 files changed

+14
-24
lines changed

packages/core/package.nls.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@
232232
"AWS.appcomposer.explorerTitle": "Infrastructure Composer",
233233
"AWS.cdk.explorerTitle": "CDK",
234234
"AWS.codecatalyst.explorerTitle": "CodeCatalyst",
235-
"AWS.cwl.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs (max 10000)",
236-
"AWS.cwl.liveTailMaxEvents.desc": "Maximum amount of log entries that can be kept in a single live tail session. When the limit is reached, the oldest events will be removed to accomodate new events (min 1000; max 10000)",
235+
"AWS.cwl.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs. For LiveTail, when the limit is reached, the oldest events will be removed to accomodate new events. (max 10000)",
237236
"AWS.samcli.deploy.bucket.recentlyUsed": "Buckets recently used for SAM deployments",
238237
"AWS.submenu.amazonqEditorContextSubmenu.title": "Amazon Q",
239238
"AWS.submenu.auth.title": "Authentication",

packages/core/src/awsService/cloudWatchLogs/activation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import { CLOUDWATCH_LOGS_LIVETAIL_SCHEME, CLOUDWATCH_LOGS_SCHEME } from '../../shared/constants'
7+
import { cloudwatchLogsLiveTailScheme, CLOUDWATCH_LOGS_SCHEME } from '../../shared/constants'
88
import { Settings } from '../../shared/settings'
99
import { addLogEvents } from './commands/addLogEvents'
1010
import { copyLogResource } from './commands/copyLogResource'
@@ -45,7 +45,7 @@ export async function activate(context: vscode.ExtensionContext, configuration:
4545
)
4646

4747
context.subscriptions.push(
48-
vscode.workspace.registerTextDocumentContentProvider(CLOUDWATCH_LOGS_LIVETAIL_SCHEME, liveTailDocumentProvider)
48+
vscode.workspace.registerTextDocumentContentProvider(cloudwatchLogsLiveTailScheme, liveTailDocumentProvider)
4949
)
5050

5151
context.subscriptions.push(

packages/core/src/awsService/cloudWatchLogs/cloudWatchLogsUtils.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,4 @@ function createURIFromArgs(args: CloudWatchLogsArgs): vscode.Uri {
111111
}
112112
export const cwlUriSchema = new UriSchema<CloudWatchLogsArgs>(parseCloudWatchLogsUri, createURIFromArgs)
113113

114-
export class CloudWatchLogsSettings extends fromExtensionManifest('aws.cwl', {
115-
limit: Number,
116-
liveTailMaxEvents: Number,
117-
}) {}
114+
export class CloudWatchLogsSettings extends fromExtensionManifest('aws.cwl', { limit: Number }) {}

packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { CancellationError } from '../../../shared/utilities/timeoutUtils'
99
import { LiveTailSession, LiveTailSessionConfiguration } from '../registry/liveTailSession'
1010
import { LiveTailSessionRegistry } from '../registry/liveTailSessionRegistry'
1111
import { LiveTailSessionLogEvent, StartLiveTailResponseStream } from '@aws-sdk/client-cloudwatch-logs'
12-
import { ToolkitError } from '../../../shared'
12+
import { formatLocalized, ToolkitError } from '../../../shared'
1313

1414
export async function tailLogGroup(
1515
registry: LiveTailSessionRegistry,
@@ -83,7 +83,9 @@ async function handleSessionStream(
8383
}
8484
}
8585
} catch (err) {
86-
throw new ToolkitError('Caught on-stream exception')
86+
throw new ToolkitError(
87+
`Encountered LiveTail on-stream failure for session ${session.uri}: ${(err as Error).message}`
88+
)
8789
}
8890
}
8991

packages/core/src/awsService/cloudWatchLogs/registry/liveTailSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class LiveTailSession {
4646
}),
4747
abortController: new AbortController(),
4848
}
49-
this._maxLines = LiveTailSession.settings.get('liveTailMaxEvents', 10000)
49+
this._maxLines = LiveTailSession.settings.get('limit', 10000)
5050
this._uri = createLiveTailURIFromArgs(configuration)
5151
}
5252

packages/core/src/awsService/cloudWatchLogs/registry/liveTailSessionRegistry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import * as vscode from 'vscode'
6-
import { CLOUDWATCH_LOGS_LIVETAIL_SCHEME } from '../../../shared/constants'
6+
import { cloudwatchLogsLiveTailScheme } from '../../../shared/constants'
77
import { LiveTailSession, LiveTailSessionConfiguration } from './liveTailSession'
88

99
export class LiveTailSessionRegistry extends Map<vscode.Uri, LiveTailSession> {
@@ -19,7 +19,7 @@ export class LiveTailSessionRegistry extends Map<vscode.Uri, LiveTailSession> {
1919
}
2020

2121
export function createLiveTailURIFromArgs(sessionData: LiveTailSessionConfiguration): vscode.Uri {
22-
let uriStr = `${CLOUDWATCH_LOGS_LIVETAIL_SCHEME}:${sessionData.region}:${sessionData.logGroupName}`
22+
let uriStr = `${cloudwatchLogsLiveTailScheme}:${sessionData.region}:${sessionData.logGroupName}`
2323

2424
if (sessionData.logStreamFilter) {
2525
if (sessionData.logStreamFilter.type !== 'all') {

packages/core/src/shared/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ecsIamPermissionsUrl = vscode.Uri.parse(
128128
* URI scheme for CloudWatch Logs Virtual Documents
129129
*/
130130
export const CLOUDWATCH_LOGS_SCHEME = 'aws-cwl' // eslint-disable-line @typescript-eslint/naming-convention
131-
export const CLOUDWATCH_LOGS_LIVETAIL_SCHEME = 'aws-cwl-lt' // eslint-disable-line @typescript-eslint/naming-convention
131+
export const cloudwatchLogsLiveTailScheme = 'aws-cwl-lt'
132132

133133
export const AWS_SCHEME = 'aws' // eslint-disable-line @typescript-eslint/naming-convention
134134
export const ec2LogsScheme = 'aws-ec2'

packages/core/src/shared/settings-toolkit.gen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export const toolkitSettings = {
2222
"aws.stepfunctions.asl.maxItemsComputed": {},
2323
"aws.ssmDocument.ssm.maxItemsComputed": {},
2424
"aws.cwl.limit": {},
25-
"aws.cwl.liveTailMaxEvents": {},
2625
"aws.samcli.manuallySelectedBuckets": {},
2726
"aws.samcli.enableCodeLenses": {},
2827
"aws.suppressPrompts": {

packages/core/src/test/awsService/cloudWatchLogs/registry/liveTailRegistry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import * as vscode from 'vscode'
66
import assert from 'assert'
77
import { LiveTailSessionConfiguration } from '../../../../awsService/cloudWatchLogs/registry/liveTailSession'
88
import { createLiveTailURIFromArgs } from '../../../../awsService/cloudWatchLogs/registry/liveTailSessionRegistry'
9-
import { CLOUDWATCH_LOGS_LIVETAIL_SCHEME } from '../../../../shared/constants'
9+
import { cloudwatchLogsLiveTailScheme } from '../../../../shared/constants'
1010

1111
describe('LiveTailSession URI', async function () {
1212
const testLogGroupName = 'test-log-group'
1313
const testRegion = 'test-region'
14-
const expectedUriBase = `${CLOUDWATCH_LOGS_LIVETAIL_SCHEME}:${testRegion}:${testLogGroupName}`
14+
const expectedUriBase = `${cloudwatchLogsLiveTailScheme}:${testRegion}:${testLogGroupName}`
1515

1616
it('is correct with no logStream filter, no filter pattern', function () {
1717
const config: LiveTailSessionConfiguration = {

packages/toolkit/package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,6 @@
162162
"description": "%AWS.cwl.limit.desc%",
163163
"maximum": 10000
164164
},
165-
"aws.cwl.liveTailMaxEvents": {
166-
"type": "number",
167-
"default": 10000,
168-
"description": "%AWS.cwl.liveTailMaxEvents.desc%",
169-
"minimum": 1000,
170-
"maximum": 10000
171-
},
172165
"aws.samcli.manuallySelectedBuckets": {
173166
"type": "object",
174167
"description": "%AWS.samcli.deploy.bucket.recentlyUsed%",

0 commit comments

Comments
 (0)