Skip to content
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
3 changes: 1 addition & 2 deletions packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@
"AWS.appcomposer.explorerTitle": "Infrastructure Composer",
"AWS.cdk.explorerTitle": "CDK",
"AWS.codecatalyst.explorerTitle": "CodeCatalyst",
"AWS.cwl.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs (max 10000)",
"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)",
"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)",
"AWS.samcli.deploy.bucket.recentlyUsed": "Buckets recently used for SAM deployments",
"AWS.submenu.amazonqEditorContextSubmenu.title": "Amazon Q",
"AWS.submenu.auth.title": "Authentication",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/awsService/cloudWatchLogs/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

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

context.subscriptions.push(
vscode.workspace.registerTextDocumentContentProvider(CLOUDWATCH_LOGS_LIVETAIL_SCHEME, liveTailDocumentProvider)
vscode.workspace.registerTextDocumentContentProvider(cloudwatchLogsLiveTailScheme, liveTailDocumentProvider)
)

context.subscriptions.push(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,4 @@ function createURIFromArgs(args: CloudWatchLogsArgs): vscode.Uri {
}
export const cwlUriSchema = new UriSchema<CloudWatchLogsArgs>(parseCloudWatchLogsUri, createURIFromArgs)

export class CloudWatchLogsSettings extends fromExtensionManifest('aws.cwl', {
limit: Number,
liveTailMaxEvents: Number,
}) {}
export class CloudWatchLogsSettings extends fromExtensionManifest('aws.cwl', { limit: Number }) {}
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,15 @@ async function handleSessionStream(
document: vscode.TextDocument,
session: LiveTailSession
) {
try {
for await (const event of stream) {
if (event.sessionUpdate !== undefined && event.sessionUpdate.sessionResults !== undefined) {
const formattedLogEvents = event.sessionUpdate.sessionResults.map<string>((logEvent) =>
formatLogEvent(logEvent)
)
if (formattedLogEvents.length !== 0) {
await updateTextDocumentWithNewLogEvents(formattedLogEvents, document, session.maxLines)
}
for await (const event of stream) {
if (event.sessionUpdate !== undefined && event.sessionUpdate.sessionResults !== undefined) {
const formattedLogEvents = event.sessionUpdate.sessionResults.map<string>((logEvent) =>
formatLogEvent(logEvent)
)
if (formattedLogEvents.length !== 0) {
await updateTextDocumentWithNewLogEvents(formattedLogEvents, document, session.maxLines)
}
}
} catch (err) {
throw new ToolkitError('Caught on-stream exception')
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class LiveTailSession {
}),
abortController: new AbortController(),
}
this._maxLines = LiveTailSession.settings.get('liveTailMaxEvents', 10000)
this._maxLines = LiveTailSession.settings.get('limit', 10000)
this._uri = createLiveTailURIFromArgs(configuration)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import * as vscode from 'vscode'
import { CLOUDWATCH_LOGS_LIVETAIL_SCHEME } from '../../../shared/constants'
import { cloudwatchLogsLiveTailScheme } from '../../../shared/constants'
import { LiveTailSession, LiveTailSessionConfiguration } from './liveTailSession'

export class LiveTailSessionRegistry extends Map<vscode.Uri, LiveTailSession> {
Expand All @@ -19,7 +19,7 @@ export class LiveTailSessionRegistry extends Map<vscode.Uri, LiveTailSession> {
}

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

if (sessionData.logStreamFilter) {
if (sessionData.logStreamFilter.type !== 'all') {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const ecsIamPermissionsUrl = vscode.Uri.parse(
* URI scheme for CloudWatch Logs Virtual Documents
*/
export const CLOUDWATCH_LOGS_SCHEME = 'aws-cwl' // eslint-disable-line @typescript-eslint/naming-convention
export const CLOUDWATCH_LOGS_LIVETAIL_SCHEME = 'aws-cwl-lt' // eslint-disable-line @typescript-eslint/naming-convention
export const cloudwatchLogsLiveTailScheme = 'aws-cwl-lt'

export const AWS_SCHEME = 'aws' // eslint-disable-line @typescript-eslint/naming-convention
export const ec2LogsScheme = 'aws-ec2'
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/shared/settings-toolkit.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const toolkitSettings = {
"aws.stepfunctions.asl.maxItemsComputed": {},
"aws.ssmDocument.ssm.maxItemsComputed": {},
"aws.cwl.limit": {},
"aws.cwl.liveTailMaxEvents": {},
"aws.samcli.manuallySelectedBuckets": {},
"aws.samcli.enableCodeLenses": {},
"aws.suppressPrompts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import * as vscode from 'vscode'
import assert from 'assert'
import { LiveTailSessionConfiguration } from '../../../../awsService/cloudWatchLogs/registry/liveTailSession'
import { createLiveTailURIFromArgs } from '../../../../awsService/cloudWatchLogs/registry/liveTailSessionRegistry'
import { CLOUDWATCH_LOGS_LIVETAIL_SCHEME } from '../../../../shared/constants'
import { cloudwatchLogsLiveTailScheme } from '../../../../shared/constants'

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

it('is correct with no logStream filter, no filter pattern', function () {
const config: LiveTailSessionConfiguration = {
Expand Down
7 changes: 0 additions & 7 deletions packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@
"description": "%AWS.cwl.limit.desc%",
"maximum": 10000
},
"aws.cwl.liveTailMaxEvents": {
"type": "number",
"default": 10000,
"description": "%AWS.cwl.liveTailMaxEvents.desc%",
"minimum": 1000,
"maximum": 10000
},
"aws.samcli.manuallySelectedBuckets": {
"type": "object",
"description": "%AWS.samcli.deploy.bucket.recentlyUsed%",
Expand Down
Loading