forked from megaproaktiv/Lambda-Telemetry-API-Loki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gernot Glawe
committed
Feb 12, 2023
1 parent
c50b5c9
commit 966eae3
Showing
45 changed files
with
7,994 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Loki logs: { | ||
shape: sequence_diagram | ||
Lambda Service: { | ||
Extensions API : { | ||
|
||
} | ||
Telemetry API: { | ||
|
||
} | ||
} | ||
Telemetry Extension: { | ||
main : { | ||
|
||
} | ||
Extension API Client: { | ||
|
||
} | ||
Listener: { | ||
|
||
} | ||
Telemetry API Client: { | ||
|
||
} | ||
Telemetry Dispatcher: { | ||
|
||
} | ||
} | ||
|
||
Loki: { | ||
|
||
} | ||
Step 1: { | ||
Telemetry Extension.main -> Telemetry Extension.Extension API Client | ||
} | ||
|
||
bob: Bobby | ||
awkward small talk: { | ||
alice -> bob: uhm, hi | ||
bob -> alice: oh, hello | ||
icebreaker attempt: { | ||
alice -> bob: what did you have for lunch? | ||
} | ||
unfortunate outcome: { | ||
bob -> alice: that's personal | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.js | ||
!jest.config.js | ||
*.d.ts | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.ts | ||
!*.d.ts | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Lambda Test Setup using Loki Telemtry API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# https://taskfile.dev | ||
|
||
version: '3' | ||
|
||
vars: | ||
CDK_VER: 2.59.0 | ||
|
||
includes: | ||
go: | ||
taskfile: ./lambda/go/Taskfile.yml | ||
dir: ./lambda/go | ||
typescript: | ||
taskfile: ./lambda/ts/Taskfile.yml | ||
dir: ./lambda/ts | ||
python: | ||
taskfile: ./lambda/py/Taskfile.yml | ||
dir: ./lambda/py | ||
|
||
tasks: | ||
|
||
bootstrap: | ||
desc: CDK bootstrap (for beginners) | ||
vars: | ||
ALIAS: | ||
sh: aws iam list-account-aliases --query "AccountAliases[0]" --output=text | ||
|
||
cmds: | ||
- npx cdk@{{.CDK_VER}} bootstrap | ||
|
||
build: | ||
desc: Build lambdas | ||
cmds: | ||
- task: typescript:build | ||
- task: python:build | ||
- task: go:build | ||
|
||
deploy: | ||
desc: 1) Deploy cdk without asking - needs docker | ||
deps: [build] | ||
cmds: | ||
- npx cdk@{{.CDK_VER}} deploy --require-approval never | ||
silent: true | ||
|
||
diff: | ||
desc: 2) cdk diff | ||
cmds: | ||
- npx cdk@{{.CDK_VER}} diff --require-approval never | ||
silent: true | ||
|
||
destroy: | ||
desc: 3) Destroy cdk without asking - needs docker | ||
cmds: | ||
- npx cdk@{{.CDK_VER}} deploy --require-approval never | ||
silent: true | ||
|
||
|
||
|
||
traffic: | ||
desc: Create traffic on S3 bucket | ||
cmds: | ||
- test/traffic.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
import 'source-map-support/register'; | ||
import * as cdk from 'aws-cdk-lib'; | ||
import { LambdaTelementryApiStack } from '../lib/lambda_telementry_api-stack'; | ||
|
||
const app = new cdk.App(); | ||
new LambdaTelementryApiStack(app, 'LambdaTelementryApiStack', { | ||
/* If you don't specify 'env', this stack will be environment-agnostic. | ||
* Account/Region-dependent features and context lookups will not work, | ||
* but a single synthesized template can be deployed anywhere. */ | ||
|
||
/* Uncomment the next line to specialize this stack for the AWS Account | ||
* and Region that are implied by the current CLI configuration. */ | ||
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION }, | ||
|
||
/* Uncomment the next line if you know exactly what Account and Region you | ||
* want to deploy the stack to. */ | ||
// env: { account: '123456789012', region: 'us-east-1' }, | ||
|
||
/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"app": "npx ts-node --prefer-ts-exts bin/lambda_telementry_api.ts", | ||
"watch": { | ||
"include": [ | ||
"**" | ||
], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"**/*.d.ts", | ||
"**/*.js", | ||
"tsconfig.json", | ||
"package*.json", | ||
"yarn.lock", | ||
"node_modules", | ||
"test" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk/aws-lambda:recognizeLayerVersion": true, | ||
"@aws-cdk/core:checkSecretUsage": true, | ||
"@aws-cdk/core:target-partitions": [ | ||
"aws", | ||
"aws-cn" | ||
], | ||
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, | ||
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, | ||
"@aws-cdk/aws-iam:minimizePolicies": true, | ||
"@aws-cdk/core:validateSnapshotRemovalPolicy": true, | ||
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, | ||
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, | ||
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, | ||
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true, | ||
"@aws-cdk/core:enablePartitionLiterals": true, | ||
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, | ||
"@aws-cdk/aws-iam:standardizedServicePrincipals": true, | ||
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/test'], | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# https://taskfile.dev | ||
|
||
## Build Management only for go | ||
|
||
version: '3' | ||
|
||
|
||
|
||
|
||
env: | ||
AWS_DEFAULT_REGION: eu-central-1 | ||
|
||
tasks: | ||
default: | ||
deps: [build] | ||
|
||
build: | ||
desc: build go | ||
cmds: | ||
- env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/main main/main.go | ||
- chmod +x dist/main | ||
- cd dist && zip main.zip main | ||
silent: true | ||
|
||
fastdeploy: | ||
desc: Deploy only lambda | ||
deps: [build] | ||
vars: | ||
FN: | ||
sh: aws cloudformation list-exports --query "Exports[?Name == 'telemetry-api-starter-GO-name'].Value" --output text | ||
cmds: | ||
- aws lambda update-function-code --function-name {{.FN}} --zip-file fileb://dist/main.zip | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module lambda-go | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/aws/aws-lambda-go v1.34.1 | ||
github.com/aws/aws-sdk-go v1.25.48 // indirect | ||
github.com/aws/aws-sdk-go-v2 v1.17.1 | ||
github.com/aws/aws-sdk-go-v2/config v1.17.10 | ||
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.3 | ||
github.com/aws/aws-xray-sdk-go v1.8.0 | ||
github.com/aws/smithy-go v1.13.4 | ||
) |
Oops, something went wrong.