This file contains hidden or 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
from typing import Dict | |
import boto3 | |
def lambda_handler(event: Dict, context): | |
try: | |
path: str = event['path'] | |
if path.startswith('/api/token/revoked/'): | |
token_id: str = path.split('/')[4] |
This file contains hidden or 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
/** | |
* Broadly inspired by https://blog.risingstack.com/measuring-http-timings-node-js/ | |
* And https://github.com/RisingStack/example-http-timings | |
*/ | |
import {IncomingHttpHeaders} from "http"; | |
const https = require('https'); | |
const http = require('http'); | |
const url_lib = require('url'); | |
const NS_PER_SEC = 1e9; |
This file contains hidden or 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
{ | |
"schemaVersion": "0.3", | |
"description": "AWSSupport-SetupIPMonitoringFromVPC creates an EC2 instance in the specified subnet and monitors selected target IPs by continuously running ping, MTR, traceroute and tracetcp tests. The results are stored in CloudWatch logs, and metric filters are applied to quickly visualize latency and packet loss statistics in a CloudWatch dashboard.", | |
"assumeRole": "{{ AutomationAssumeRole }}", | |
"parameters": { | |
"SubnetId": { | |
"type": "String", | |
"description": "(Required) The subnet ID for the monitor instance. NOTE: If you specify a private subnet, make sure there is Internet access to allow the monitor instance to setup the test (i.e. install the CloudWatch Logs agent, interact with AWS Systems Manager and Amazon CloudWatch).", | |
"allowedPattern": "^subnet-[a-z0-9]{8,17}$" | |
}, |
This file contains hidden or 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
const child_process = require('child_process') | |
function run_script(command, args, realtimeCallback = (log, type) => {console.log(log)}) { | |
return new Promise((resolve) => { | |
let child = child_process.spawn(command, args) | |
let scriptOutput = "" | |
child.stdout.setEncoding('utf8') | |
child.stdout.on('data', function (data) { |
This file contains hidden or 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
FROM node:14.7.0 | |
#Install K6 | |
WORKDIR /tmp | |
ADD https://github.com/loadimpact/k6/releases/download/v0.27.1/k6-v0.27.1-linux64.tar.gz /tmp/k6-v0.27.1-linux64.tar.gz | |
RUN tar -xzf k6-v0.27.1-linux64.tar.gz | |
RUN mv k6-v0.27.1-linux64/k6 /usr/bin/k6 | |
#Install NPM dependencies | |
COPY loadtest-home /loadtest-home |
This file contains hidden or 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
version: '3.4' | |
networks: | |
k6: | |
grafana: | |
services: | |
influxdb: | |
image: influxdb:latest | |
networks: | |
- k6 | |
- grafana |
This file contains hidden or 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
apiVersion: 1 | |
datasources: | |
- name: k6influxdb | |
type: influxdb | |
access: proxy | |
database: k6 | |
url: http://influxdb:8086 | |
isDefault: true |
This file contains hidden or 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
apiVersion: 1 | |
providers: | |
- name: 'default' | |
org_id: 1 | |
folder: '' | |
type: 'file' | |
options: | |
path: /var/lib/grafana/dashboards |
This file contains hidden or 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
import http from 'k6/http'; | |
import { check } from "k6"; | |
export let options = { | |
stages: [ | |
// Ramp-up from 1 to 5 VUs in 5s | |
{ duration: "5s", target: 5 }, | |
// Stay at rest on 5 VUs for 10s | |
{ duration: "10s", target: 5 }, | |
// Ramp-down from 5 to 0 VUs for 5s | |
{ duration: "5s", target: 0 } |
This file contains hidden or 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
import javax.net.ssl.SSLSocket; | |
import javax.net.ssl.SSLSocketFactory; | |
import java.io.*; | |
import java.net.InetSocketAddress; | |
import java.nio.charset.StandardCharsets; | |
import java.time.Instant; | |
import java.time.ZoneOffset; | |
import java.time.ZonedDateTime; | |
/** |