0.0.127 • Published 3 years ago

nirsky-otel-test v0.0.127

Weekly downloads
75
License
Apache-2.0
Repository
github
Last release
3 years ago

Aspecto

Your API is critical for your success and we want to help you protect it.

Install

npm install @aspecto/opentelemetry

Usage

In the root folder create an aspecto.json file with content {"token" : "-- token goes here --"}. You can get your token from here

Add this call at the top of your app entry point:

require('@aspecto/opentelemetry')();

Configuration

You can pass the following configuration to the aspecto client: | Option | Type | Description | |---|---|---| |env|string|set environment name manually instead of using env environment variable| |aspectoAuth|UUID|set aspecto token from code instead of using aspecto.json| |packageName|string|set packageName manually instead of reading it from package.json| |packageVersion|string|set packageVersion manually instead of reading it from package.json| |local|boolean|when set to true, enable live flows| |logger|logger interface|logger to be used in this tracing library. common use for debugging logger: console| |customZipkinEndpoint|URL|Send all traces to additional Zipkin server for debug| |samplingRatio|number|How many of the traces starting in this service should be sampled. set number in range 0.0, 1.0 where 0.0 is no sampling, and 1.0 is sample all. |exportBatchSize|number|How spans to batch in a single update to the collector. default is 100 |exportBatchTimeout|number|Maximum time in ms for batching spans before sending to collector. default is 1000 (1s)

Live Flows

Live Flows captures all payloads and traces in your local environment and automatically extract the topology & dependencies between endpoints. You can activate it using local: true, like so:

require('@aspecto/opentelemetry')({
    local: true,
});

This allows you to capture flows from all the microservices that you're running locally (both on the host env and docker) with local mode enabled. Once the process starts it will output the following link:

=====================================================================================================================================
|                                                                                                                                   |
| 🕵️‍♀️See the live tracing stream at https://app.aspecto.io/app/live-flows/sessions?instanceId=14243e72-14dc-4255-87af-ef846b247578   |
|                                                                                                                                   |
=====================================================================================================================================

You only need to click the link once to see traces from all the microservices, that are running on your environment and have local mode enabled. Also this link is valid for a limited period of time (couple of days, but it may change in the future). If you don't see trace from some microservice (or none of them), please click the newly-generated link.

FaaS

AWS Lambda

Aspecto supports instrumenting AWS lambdas.
To do so, set up Aspecto as you'd usually do, and extract the returned lambda utility:

const { lambda } = require('@aspecto/opentelemetry')();

Next, wrap your function handler definition with the returned utility.

Example:

// Before
module.exports.myCallbackHandler = (event, context, callback) => { ... };
module.exports.myAsyncHandler = async (event, context) => { ... };

// After
module.exports.myCallbackHandler = lambda((event, context, callback) => { ... });
module.exports.myAsyncHandler = lambda(async (event, context) => { ... });

Notice: if your lambda is not deployed with a package.json file, make sure to provide the packageName option when initializing Aspecto.

Google Cloud Function

Aspecto supports instrumenting GCF with http trigger.
To do so, set up Aspecto as you'd usually do, and extract the gcf utility:

const { gcf } = require('@aspecto/opentelemetry')();

Next, wrap your function handler definition with the returned utility. Example:

// Before
exports.myEndpoint = (req, res) => { ... };

// After
exports.myEndpoint = gcf((req, res) => { ... });
0.0.119

3 years ago

0.0.118

3 years ago

0.0.127

3 years ago

0.0.126

3 years ago

0.0.125

3 years ago

0.0.120

3 years ago

0.0.124

3 years ago

0.0.123

3 years ago

0.0.122

3 years ago

0.0.121

3 years ago

0.0.117

3 years ago

0.0.116

3 years ago

0.0.115

3 years ago

0.0.114

3 years ago

0.0.113

3 years ago

0.0.112

3 years ago

0.0.111

3 years ago

0.0.110

3 years ago

0.0.109

3 years ago

0.0.108

3 years ago

0.0.106

3 years ago

0.0.107

3 years ago

0.0.105

3 years ago

0.0.104

3 years ago

0.0.103

3 years ago

0.0.102

3 years ago

0.0.101

3 years ago

0.0.100

3 years ago

0.0.98

3 years ago

0.0.99

3 years ago

0.0.95

3 years ago

0.0.96

3 years ago

0.0.97

3 years ago

0.0.94

3 years ago

0.0.88

3 years ago

0.0.89

3 years ago

0.0.90

3 years ago

0.0.91

3 years ago

0.0.92

3 years ago

0.0.84

3 years ago

0.0.85

3 years ago

0.0.86

3 years ago

0.0.87

3 years ago

0.0.80

3 years ago

0.0.81

3 years ago

0.0.82

3 years ago

0.0.83

3 years ago

0.0.79

3 years ago

0.0.78

3 years ago

0.0.77

3 years ago