Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Removed redundant tags from log data
Browse files Browse the repository at this point in the history
  • Loading branch information
Serkan ÖZAL committed May 10, 2019
1 parent 714f8ea commit c0aff0b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
23 changes: 0 additions & 23 deletions src/plugins/Log.ts
Expand Up @@ -60,37 +60,14 @@ class Log {
this.logData.traceId = this.pluginContext.traceId;

this.logData.tags = {};
this.logData.tags['aws.region'] = this.pluginContext.applicationRegion;
this.logData.tags['aws.lambda.name'] = this.originalContext.functionName;
this.logData.tags['aws.lambda.arn'] = this.originalContext.invokedFunctionArn;
this.logData.tags['aws.lambda.memory_limit'] = parseInt(this.originalContext.memoryLimitInMB, 10);
this.logData.tags['aws.lambda.log_group_name'] = this.originalContext.logGroupName;
this.logData.tags['aws.lambda.log_stream_name'] = this.originalContext.logStreamName;
this.logData.tags['aws.lambda.invocation.request_id'] = this.originalContext.awsRequestId;

if (Utils.getConfiguration(envVariableKeys.THUNDRA_LAMBDA_LOG_CONSOLE_DISABLE) !== 'true') {
this.shimConsole();
}
}

afterInvocation = (data: any) => {
if (data.error) {
const error = Utils.parseError(data.error);
this.logData.tags['error.message'] = error.errorMessage;
this.logData.tags['error.kind'] = error.errorType;
this.logData.tags['error.stack'] = error.stack;
if (error.code) {
this.logData.tags['error.code'] = error.code;
}
if (error.stack) {
this.logData.tags['error.stack'] = error.stack;
}
}

for (const log of this.logs) {
if (data.error) {
log.addErrorTags(this.logData);
}
const logReportData = Utils.generateReport(log, this.apiKey);
this.report(logReportData);
}
Expand Down
12 changes: 0 additions & 12 deletions src/plugins/data/log/LogData.ts
Expand Up @@ -30,18 +30,6 @@ class LogData extends BaseMonitoringData {
this.logContextName = logInfo.logContextName;
this.tags = {};
}

addErrorTags(data: LogData) {
this.tags['error.message'] = data.tags['error.message'];
this.tags['error.kind'] = data.tags['error.kind'];
this.tags['error.stack'] = data.tags['error.stack'];
if (data.tags['error.code']) {
this.tags['error.code'] = data.tags['error.code'];
}
if (data.tags['error.stack']) {
this.tags['error.stack'] = data.tags['error.stack'];
}
}
}

export default LogData;

0 comments on commit c0aff0b

Please sign in to comment.