Skip to content

Commit

Permalink
Merge branch 'main' into aws-lambda-fix-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm authored May 11, 2021
2 parents 2671116 + da42d01 commit f79954c
Show file tree
Hide file tree
Showing 47 changed files with 752 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
},
"devDependencies": {
"@types/mocha": "8.2.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
Expand Down
51 changes: 51 additions & 0 deletions examples/network/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
const { NodeTracerProvider } = require('@opentelemetry/node');
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net');
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/tracing');
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');

const provider = new NodeTracerProvider();

provider.addSpanProcessor(new SimpleSpanProcessor(new JaegerExporter({
serviceName: 'http-client',
})));

provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

provider.register();

diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);

registerInstrumentations({
instrumentations: [
new NetInstrumentation(),
new HttpInstrumentation(),
new DnsInstrumentation({
// Avoid dns lookup loop with http zipkin calls
ignoreHostnames: ['localhost'],
}),
],
tracerProvider: provider,
});

require('net');
require('dns');
const https = require('https');
const http = require('http');

http.get('http://opentelemetry.io/', () => {}).on('error', (e) => {
console.error(e);
});

https.get('https://opentelemetry.io/', () => {}).on('error', (e) => {
console.error(e);
});

https.get('https://opentelemetry.io/', { ca: [] }, () => {}).on('error', (e) => {
console.error(e);
});
44 changes: 44 additions & 0 deletions examples/network/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "tls-example",
"private": true,
"version": "0.15.0",
"description": "Example of NET & TLS integration with OpenTelemetry",
"main": "index.js",
"scripts": {
"zipkin:client": "cross-env EXPORTER=zipkin node ./client.js",
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/open-telemetry/opentelemetry-js-contrib.git"
},
"keywords": [
"opentelemetry",
"net",
"tls",
"tracing"
],
"engines": {
"node": ">=8.5.0"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues"
},
"dependencies": {
"@opentelemetry/api": "^0.18.1",
"@opentelemetry/exporter-jaeger": "^0.18.2",
"@opentelemetry/exporter-zipkin": "^0.18.2",
"@opentelemetry/instrumentation": "^0.18.2",
"@opentelemetry/instrumentation-net": "file:../../plugins/node/opentelemetry-instrumentation-net",
"@opentelemetry/instrumentation-http": "^0.19.0",
"@opentelemetry/instrumentation-dns": "^0.15.0",
"@opentelemetry/node": "^0.18.2",
"@opentelemetry/tracing": "^0.18.2"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib#readme",
"devDependencies": {
"cross-env": "^6.0.3"
}
}
4 changes: 2 additions & 2 deletions examples/postgres/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"@opentelemetry/exporter-zipkin": "^0.19.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/instrumentation-http": "^0.19.0",
"@opentelemetry/instrumentation-pg": "^0.15.0",
"@opentelemetry/instrumentation-pg": "^0.16.0",
"@opentelemetry/node": "^0.19.0",
"@opentelemetry/tracing": "^0.19.0",
"express": "^4.17.1",
"pg": "^7.12.1"
"pg": "^8.6.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/restify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@opentelemetry/exporter-zipkin": "^0.19.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/instrumentation-http": "^0.19.0",
"@opentelemetry/instrumentation-restify": "^0.16.0",
"@opentelemetry/node": "^0.19.0",
"@opentelemetry/tracing": "^0.19.0",
"restify": "^4.3.4"
Expand Down
6 changes: 2 additions & 4 deletions metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@
},
"devDependencies": {
"@types/mocha": "7.0.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"devDependencies": {
"@babel/core": "7.14.0",
"@types/mocha": "8.2.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"@types/webpack-env": "1.16.0",
"babel-loader": "8.2.2",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.2.3",
Expand All @@ -51,7 +51,7 @@
"ts-mocha": "8.0.0",
"typescript": "4.2.4",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-cli": "4.7.0",
"webpack-merge": "5.7.3"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"eslint": "7.25.0",
"@typescript-eslint/eslint-plugin": "4.22.1",
"@typescript-eslint/parser": "4.22.1",
"eslint": "7.26.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.22.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
},
"devDependencies": {
"@types/mocha": "8.2.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
],
"devDependencies": {
"@types/mocha": "8.2.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"@types/webpack-env": "1.16.0",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.2.3",
Expand Down
4 changes: 1 addition & 3 deletions packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"devDependencies": {
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"gts": "3.1.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
Expand Down
18 changes: 15 additions & 3 deletions packages/opentelemetry-test-utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import * as childProcess from 'child_process';
import {
SpanKind,
SpanAttributes,
HrTime,
Span,
SpanAttributes,
SpanKind,
SpanStatus,
TimedEvent,
} from '@opentelemetry/api';
import * as assert from 'assert';
import { ReadableSpan } from '@opentelemetry/tracing';
Expand Down Expand Up @@ -126,3 +126,15 @@ export const assertPropagation = (
);
assert.notStrictEqual(targetSpanContext.spanId, sourceSpanContext.spanId);
};

/**
* Represents a timed event.
* A timed event is an event with a timestamp.
*/
export interface TimedEvent {
time: HrTime;
/** The name of the event. */
name: string;
/** The attributes of the event. */
attributes?: SpanAttributes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,22 @@
},
"devDependencies": {
"@opentelemetry/node": "0.19.0",
"@types/aws-lambda": "8.10.76",
"@types/mocha": "7.0.2",
"@types/node": "14.14.43",
"codecov": "3.8.1",
"@types/node": "14.14.44",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/resources": "^0.19.0",
"@opentelemetry/semantic-conventions": "^0.19.0",
"@opentelemetry/tracing": "^0.19.0"
"@opentelemetry/tracing": "^0.19.0",
"@types/aws-lambda": "8.10.76"
}
}
10 changes: 4 additions & 6 deletions plugins/node/opentelemetry-instrumentation-bunyan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,22 @@
"@opentelemetry/context-async-hooks": "0.19.0",
"@opentelemetry/node": "0.19.0",
"@opentelemetry/tracing": "0.19.0",
"@types/bunyan": "1.8.6",
"@types/mocha": "7.0.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/sinon": "9.0.11",
"bunyan": "1.8.15",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "9.2.4",
"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/instrumentation": "^0.19.0"
"@opentelemetry/instrumentation": "^0.19.0",
"@types/bunyan": "1.8.6"
}
}
6 changes: 2 additions & 4 deletions plugins/node/opentelemetry-instrumentation-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,17 @@
"@opentelemetry/node": "0.19.0",
"@opentelemetry/tracing": "0.19.0",
"@types/mocha": "7.0.2",
"@types/node": "14.14.43",
"@types/node": "14.14.44",
"@types/semver": "7.3.5",
"@types/shimmer": "1.0.1",
"@types/sinon": "9.0.11",
"codecov": "3.8.1",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "10.0.0",
"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For automatic instrumentation see the

## Installation

This instrumentation relies on HTTP calls to also be instrumented. Make sure you install and enable both.
This instrumentation relies on HTTP calls to also be instrumented. Make sure you install and enable both, otherwise you will not see any spans being exported from the instrumentation.

```bash
npm install --save @opentelemetry/instrumentation-http @opentelemetry/instrumentation-express
Expand Down
10 changes: 4 additions & 6 deletions plugins/node/opentelemetry-instrumentation-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,22 @@
"@opentelemetry/context-async-hooks": "0.19.0",
"@opentelemetry/node": "0.19.0",
"@opentelemetry/tracing": "0.19.0",
"@types/express": "4.17.11",
"@types/mocha": "7.0.2",
"@types/node": "14.14.43",
"codecov": "3.8.1",
"@types/node": "14.14.44",
"codecov": "3.8.2",
"express": "4.17.1",
"gts": "3.1.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "4.2.4"
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/core": "^0.19.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/semantic-conventions": "^0.19.0"
"@opentelemetry/semantic-conventions": "^0.19.0",
"@types/express": "4.17.11"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
},
"devDependencies": {
"@opentelemetry/tracing": "0.19.0",
"@types/graphql": "14.5.0",
"@types/mocha": "8.2.2",
"@types/node": "14.14.43",
"codecov": "3.8.1",
"@types/node": "14.14.44",
"codecov": "3.8.2",
"graphql": "15.5.0",
"gts": "3.1.0",
"mocha": "7.2.0",
Expand All @@ -58,6 +57,7 @@
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/instrumentation": "^0.19.0"
"@opentelemetry/instrumentation": "^0.19.0",
"@types/graphql": "14.5.0"
}
}
Loading

0 comments on commit f79954c

Please sign in to comment.