12.1.1 • Published 1 year ago
aft-reporting-aws-kinesis-firehose v12.1.1
AFT-reporting-AWSKinesis
an Automated Functional Testing (AFT) library providing logging to an AWS Kinesis Firehose endpoint for any TestResult objects logged via the aft-core.ReportingManager
Installation
> npm i aft-reporting-awskinesis
Configuration
to send values to AWS Kinesis Firehose endpoints you must specify the AWS Credentials, the AWS Region Endpoint and the AWS Kinesis Delivery Stream. These take the following form in your aftconfig.json:
{
"plugins": [
{"name": "kinesis-reporting-plugin", "searchDir": "./node_modules/"}
],
"KinesisReportingPluginConfig": {
"logLevel": "info",
"region": "us-west-1",
"deliveryStream": "your-frehose-delivery-stream",
"batch": true,
"batchSize": 10,
"sendStrategy": "logsandresults",
"assumeRoleArn": "optional-iam-role-needed-for-sending-to-firehose",
"assumeRoleDuration": 900
}
}- logLevel - an optional
LogLevelto be used by this plugin (defaults to value set inAftConfig.logLevelorwarnif unset) - region - a
stringcontaining the AWS region where the Kinesis Firehose stream is located. values likeeu-west-1orus-west-2are expected. - deliveryStream - a
stringcontaining the name of the Kinesis Firehose stream to send through. If using Elasticsearch as your back-end storage, this would be the Elasticsearch index to use. - batch - an optional
booleanindicating whether logs should be batched before forwarding to Kinesis Firehose (defaults totrue) - batchSize - an optional
numberrepresenting the number of log records to batch before sending (defaults to 10) - sendStrategy - an optional
stringoflogsandresults,logsonlyorresultsonlythat controls sending of log messages and results (defaults tologsandresults) - assumeRoleArn - an optional
stringcontaining a valid AWS IAM Role ARN that should be assumed following acquring the AWS Credentials so that the plugin can send to the Firehose stream - assumeRoleDuration - an optional
numbercontaining the number of seconds the assumed role should remain valid (defaults to900)
NOTE:
the AWS Credentials are first attempted to be read from AFT Configuration and if no value is specified then the following are checked:
- Environment Variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
- EC2 Metadata: also known as instance profile credentials
- Shared Ini File: read from the host system
- ECS Credentials: similar to the EC2 Metadata, but on ECS
- Process Credentials: any credentials set on the current process
Format of log records
the log record that is sent to your AWS Kinesis Firehose endpoint will have the following format:
message logs
{
"created": 1655289028279,
"version": "11.2.1",
"machineInfo": {
"ip": "234.9.10.11",
"name": "CETH-ARG-WIN10",
"user": "SYSTEM"
},
"log": {
"name": "if used with an AftTest this will be the 'description' or 'Test IDs' or a GUID",
"level": "warn",
"message": "this is the actual message being logged",
"data": [
"an array of optional values",
{"foo": "bar", "baz": true}
]
}
}- created - the elapsed milliseconds since the epoch representing when this log record was created
- version - the current version of the
KinesisReportingPlugin - machineInfo - an
aft-core.MachineInfoDataobject containing the following:- ip - a
stringof the machine's IP address - name - a
stringof the machine's name - user - a
stringof the currently logged in user who executed the tests
- ip - a
- log - the
LogMessageDataobject- name - the
namepassed to this plugin when loaded from theReportingManager - level - a
stringvalue from one of theaft-core.LoggingLevelvalues based on the level of the message being logged - message - the
stringbeing logged by some component - data - an
arrayof anything added to the log function call after the message
- name - the
TestResult logs
{
"created": 1655289028279,
"version": "11.2.1",
"machineInfo": {
"ip": "234.9.10.11",
"name": "CETH-ARG-WIN10",
"user": "SYSTEM"
},
"result": {
"created": 1655289028270,
"testName": "this is the description from your test",
"testId": "1234",
"resultMessage": "the final result was a SUCCESS!",
"status": "passed",
"resultId": "dbbf6fce-14db-4bd2-ba31-e3fa68d719e4",
"metadata": {
"durationMs": 12345,
"buildName": "Test Build",
"buildNumber": "23",
}
}
}- created - the elapsed milliseconds since the epoch representing when this log record was created
- version - the current version of the
KinesisReportingPlugin - machineInfo - an
aft-core.MachineInfoDataobject containing the following:- ip - a
stringof the machine's IP address - name - a
stringof the machine's name - user - a
stringof the currently logged in user who executed the tests
- ip - a
- result - an
TestResultobject containing the following:- created - a
numberrepresenting the elapsed milliseconds since the epoch for when this result was created - testId - a
stringcontaining any unique ID for the test result being recorded - resultMessage - a
stringmessage of the final result - status - a
stringrepresenting theaft-core.TestStatusvalue - resultId - a
stringcontaining a unique identifier for theTestResult - created - a
numbercontaining the date and time theTestResultwas created as milliseconds since the epoch - metadata - an
objectthat can contain additional data for theTestResult
- created - a