Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Stack Test #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

You can find example usages for zipkin.js in different scenarios:

- [web](web/)
- [web](web/), In the web you can find the http-recorder, and the aws-sqs-recorder
- [react-native](react-native-example/)

## AWS Test
In the aws folder, you have a docker-compose to get start with the zipkin-aws stack (SQS Collector, Kinesis Collector and AWS ES) and a localstack(mock AWS Services like SQS)
25 changes: 25 additions & 0 deletions aws/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "2.1"

services:
localstack:
image: localstack/localstack
ports:
- '4566-4599:4566-4599'
- '8080:8080'
environment:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
volumes:
- './localstack-init.sh:/docker-entrypoint-initaws.d/init.sh'
zipkin-aws:
image: openzipkin/zipkin-aws
ports:
- '9411:9411'
environment:
SQS_QUEUE_URL: http://localstack:4576/queue/sqs-test
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
depends_on:
- localstack
3 changes: 3 additions & 0 deletions aws/localstack-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

aws --endpoint-url=http://localhost:4576 sqs create-queue --queue-name sqs-test
24 changes: 24 additions & 0 deletions web/aws-sqs-recorder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-env browser */
const {
BatchRecorder
} = require('zipkin');
const {AwsSqsLogger} = require('zipkin-transport-aws-sqs');

let awsSqsLogger = new AwsSqsLogger({
queueUrl: "http://localhost:4576/queue/sqs-test", //mandatory
region: 'us-east-1', // optional, region string
credentialProvider: {
accessKeyId: 'test',
secretAccessKey: 'test'
},
delaySeconds: 0// optional
});


function recorder(serviceName) {
return new BatchRecorder({
logger: awsSqsLogger
});
}

module.exports.recorder = recorder;
1 change: 1 addition & 0 deletions web/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const express = require('express');
const CLSContext = require('zipkin-context-cls');
const {Tracer} = require('zipkin');
const {recorder} = require('./recorder');
//const {recorder} = require('./aws-sqs-recorder');

const ctxImpl = new CLSContext('zipkin');
const localServiceName = 'backend';
Expand Down
11 changes: 6 additions & 5 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
"express": "^4.0",
"node-fetch": "^2.6.0",
"npm": "^6.9",
"zipkin": "^0.19.1",
"zipkin": "^0.19.2",
"zipkin-context-cls": "^0.19.0",
"zipkin-instrumentation-axiosjs": "^0.19.1",
"zipkin-instrumentation-express": "^0.19.1",
"zipkin-instrumentation-fetch": "^0.19.1",
"zipkin-transport-http": "^0.19.1"
"zipkin-instrumentation-axiosjs": "^0.19.2",
"zipkin-instrumentation-express": "^0.19.2",
"zipkin-instrumentation-fetch": "^0.19.2",
"zipkin-transport-http": "^0.19.2",
"zipkin-transport-aws-sqs": "^0.21.0"
},
"devDependencies": {
"browserify": "^16.2",
Expand Down