Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rauno56 authored Oct 14, 2021
2 parents ac7574a + f3400f0 commit 49b2190
Show file tree
Hide file tree
Showing 57 changed files with 457 additions and 249 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[up-for-grabs-issues]: https://github.com/open-telemetry/opentelemetry-js-contrib/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs
[good-first-issues]: https://github.com/open-telemetry/openTelemetry-js-contrib/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22

[otel-instrumentation-fetch]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-fetch
[otel-instrumentation-grpc]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-grpc
[otel-instrumentation-http]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-http
[otel-instrumentation-xml-http-request]: https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-xml-http-request
[otel-instrumentation-fetch]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch
[otel-instrumentation-grpc]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc
[otel-instrumentation-http]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-http
[otel-instrumentation-xml-http-request]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-xml-http-request

[otel-contrib-instrumentation-aws-lambda]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-lambda
[otel-contrib-instrumentation-bunyan]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-bunyan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@opentelemetry/api": "^1.0.2"
},
"dependencies": {
"@opentelemetry/resources": "^0.25.0",
"@opentelemetry/semantic-conventions": "^0.25.0"
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/semantic-conventions": "^1.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"@opentelemetry/api": "^1.0.2"
},
"dependencies": {
"@opentelemetry/core": "^0.25.0",
"@opentelemetry/resources": "^0.25.0",
"@opentelemetry/semantic-conventions": "^0.25.0"
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/semantic-conventions": "^1.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"devDependencies": {
"@opentelemetry/api": "1.0.2",
"@opentelemetry/contrib-test-utils": "^0.25.0",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/core": "1.0.0",
"@types/mocha": "8.2.3",
"@types/node": "14.17.9",
"@types/semver": "7.3.8",
Expand All @@ -62,8 +62,8 @@
"@opentelemetry/api": "^1.0.2"
},
"dependencies": {
"@opentelemetry/resources": "^0.25.0",
"@opentelemetry/semantic-conventions": "^0.25.0",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/semantic-conventions": "^1.0.0",
"gcp-metadata": "^4.1.4",
"semver": "7.3.5"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/resources": "^0.25.0"
"@opentelemetry/resources": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/express/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function filterSampler(filterFn, parent) {
if (!filterFn(spanName, spanKind, attr)) {
return { decision: opentelemetry.SamplingDecision.NOT_RECORD };
}
return parent.shouldSample(ctx, tid, name, kind, attr, links);
return parent.shouldSample(ctx, tid, spanName, spanKind, attr, links);
},
toString() {
return `FilterSampler(${parent.toString()})`;
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const api = require('@opentelemetry/api');
// eslint-disable-next-line import/order
const tracer = require('./tracer')('postgres-server-service');
const { SpanKind, StatusCode } = require('@opentelemetry/api');
const { SpanKind, SpanStatusCode } = require('@opentelemetry/api');
const express = require('express');
const setupPg = require('./setupPsql');

Expand Down Expand Up @@ -41,7 +41,7 @@ app.get('/:cmd', (req, res) => {
});
} catch (e) {
res.status(400).send({ message: e.message });
span.setStatus(StatusCode.ERROR);
span.setStatus(SpanStatusCode.ERROR);
}
span.end();
});
Expand Down
6 changes: 3 additions & 3 deletions metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.25.0",
"@opentelemetry/instrumentation": "^0.26.0",
"@opentelemetry/instrumentation-dns": "^0.25.0",
"@opentelemetry/instrumentation-express": "^0.25.0",
"@opentelemetry/instrumentation-graphql": "^0.25.0",
"@opentelemetry/instrumentation-grpc": "^0.25.0",
"@opentelemetry/instrumentation-http": "^0.25.0",
"@opentelemetry/instrumentation-grpc": "^0.26.0",
"@opentelemetry/instrumentation-http": "^0.26.0",
"@opentelemetry/instrumentation-ioredis": "^0.25.0",
"@opentelemetry/instrumentation-koa": "^0.25.0",
"@opentelemetry/instrumentation-mongodb": "^0.25.0",
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 @@ -60,10 +60,10 @@
"webpack-merge": "5.8.0"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.25.0",
"@opentelemetry/instrumentation": "^0.26.0",
"@opentelemetry/instrumentation-document-load": "^0.25.0",
"@opentelemetry/instrumentation-fetch": "^0.25.0",
"@opentelemetry/instrumentation-fetch": "^0.26.0",
"@opentelemetry/instrumentation-user-interaction": "^0.25.0",
"@opentelemetry/instrumentation-xml-http-request": "^0.25.0"
"@opentelemetry/instrumentation-xml-http-request": "^0.26.0"
}
}
22 changes: 11 additions & 11 deletions packages/opentelemetry-browser-extension-autoinjection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@
"@material-ui/core": "4.12.3",
"@material-ui/icons": "4.11.2",
"@material-ui/lab": "4.0.0-alpha.60",
"@opentelemetry/context-zone": "0.25.0",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-collector": "0.25.0",
"@opentelemetry/exporter-zipkin": "0.25.0",
"@opentelemetry/instrumentation": "0.25.0",
"@opentelemetry/context-zone": "1.0.0",
"@opentelemetry/core": "1.0.0",
"@opentelemetry/exporter-otlp-http": "0.26.0",
"@opentelemetry/exporter-zipkin": "1.0.0",
"@opentelemetry/instrumentation": "0.26.0",
"@opentelemetry/instrumentation-document-load": "^0.25.0",
"@opentelemetry/instrumentation-fetch": "0.25.0",
"@opentelemetry/instrumentation-xml-http-request": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0",
"@opentelemetry/sdk-trace-web": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
"@opentelemetry/instrumentation-fetch": "0.26.0",
"@opentelemetry/instrumentation-xml-http-request": "0.26.0",
"@opentelemetry/resources": "1.0.0",
"@opentelemetry/sdk-trace-base": "1.0.0",
"@opentelemetry/sdk-trace-web": "1.0.0",
"@opentelemetry/semantic-conventions": "1.0.0",
"change-case": "4.1.2",
"json5": "2.2.0",
"react": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xm
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
import {
BatchSpanProcessor,
ConsoleSpanExporter,
Expand Down Expand Up @@ -72,7 +72,7 @@ export class WebInstrumentation {
if (this.exporters[ExporterType.COLLECTOR_TRACE].enabled) {
this.provider.addSpanProcessor(
new BatchSpanProcessor(
new CollectorTraceExporter({
new OTLPTraceExporter({
url: this.exporters[ExporterType.COLLECTOR_TRACE].url,
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class App extends React.Component<AppProps, AppState> {
onToggle={this.toggleExporter}
onValueChange={this.handleUrlChange}
placeholderValue={PlaceholderValues.COLLECTOR_TRACE_URL}
exporterPackageUrl="https://www.npmjs.com/package/@opentelemetry/exporter-collector"
exporterPackageUrl="https://www.npmjs.com/package/@opentelemetry/exporter-otlp-http"
value={exporters[ExporterType.COLLECTOR_TRACE].url}
/>
</Grid>
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-host-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/api-metrics": "^0.25.0",
"@opentelemetry/core": "^0.25.0",
"@opentelemetry/sdk-metrics-base": "^0.25.0",
"@opentelemetry/api-metrics": "^0.26.0",
"@opentelemetry/core": "^1.0.0",
"@opentelemetry/sdk-metrics-base": "^0.26.0",
"systeminformation": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
"webpack": "4.46.0"
},
"dependencies": {
"@opentelemetry/core": "^0.25.0"
"@opentelemetry/core": "^1.0.0"
}
}
14 changes: 7 additions & 7 deletions packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-jaeger": "0.25.0",
"@opentelemetry/instrumentation": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0"
"@opentelemetry/core": "1.0.0",
"@opentelemetry/exporter-jaeger": "1.0.0",
"@opentelemetry/instrumentation": "0.26.0",
"@opentelemetry/sdk-trace-node": "1.0.0",
"@opentelemetry/resources": "1.0.0",
"@opentelemetry/sdk-trace-base": "1.0.0",
"@opentelemetry/semantic-conventions": "1.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
},
"devDependencies": {
"@opentelemetry/api": "1.0.2",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/core": "1.0.0",
"@opentelemetry/sdk-trace-base": "1.0.0",
"@opentelemetry/sdk-trace-node": "1.0.0",
"@types/mocha": "7.0.2",
"@types/node": "14.17.9",
"codecov": "3.8.3",
Expand All @@ -61,10 +61,10 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.25.0",
"@opentelemetry/instrumentation": "^0.26.0",
"@opentelemetry/propagator-aws-xray": "^0.24.0",
"@opentelemetry/resources": "^0.25.0",
"@opentelemetry/semantic-conventions": "^0.24.0",
"@opentelemetry/resources": "^1.0.0",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@types/aws-lambda": "8.10.81"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
TextMapGetter,
TraceFlags,
TracerProvider,
ROOT_CONTEXT,
} from '@opentelemetry/api';
import {
AWSXRAY_TRACE_ID_HEADER,
Expand Down Expand Up @@ -375,7 +376,7 @@ export class AwsLambdaInstrumentation extends InstrumentationBase {
}
if (!parent) {
// No context in Lambda environment or HTTP headers.
return otelContext.active();
return ROOT_CONTEXT;
}
return parent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ import {
SpanKind,
SpanStatusCode,
TextMapPropagator,
ROOT_CONTEXT,
} from '@opentelemetry/api';
import { AWSXRayPropagator } from '@opentelemetry/propagator-aws-xray';
import { HttpTraceContextPropagator } from '@opentelemetry/core';
import { W3CTraceContextPropagator } from '@opentelemetry/core';

const memoryExporter = new InMemorySpanExporter();
const provider = new NodeTracerProvider();
Expand Down Expand Up @@ -143,7 +144,7 @@ describe('lambda handler', () => {
};
const sampledHttpHeader = serializeSpanContext(
sampledHttpSpanContext,
new HttpTraceContextPropagator()
new W3CTraceContextPropagator()
);

const unsampledAwsSpanContext: SpanContext = {
Expand All @@ -165,7 +166,7 @@ describe('lambda handler', () => {
};
const unsampledHttpHeader = serializeSpanContext(
unsampledHttpSpanContext,
new HttpTraceContextPropagator()
new W3CTraceContextPropagator()
);

const sampledGenericSpanContext: SpanContext = {
Expand All @@ -176,7 +177,7 @@ describe('lambda handler', () => {
};
const sampledGenericSpan = serializeSpanContext(
sampledGenericSpanContext,
new HttpTraceContextPropagator()
new W3CTraceContextPropagator()
);

beforeEach(() => {
Expand Down Expand Up @@ -624,6 +625,37 @@ describe('lambda handler', () => {
);
assert.strictEqual(span.parentSpanId, sampledGenericSpanContext.spanId);
});

it('creates trace from ROOT_CONTEXT when "disableAwsContextPropagation" is true, eventContextExtractor is provided, and no custom context is found', async () => {
process.env[traceContextEnvironmentKey] = sampledAwsHeader;
const customExtractor = (event: any): OtelContext => {
if (!event.contextCarrier) {
return ROOT_CONTEXT;
}

return propagation.extract(context.active(), event.contextCarrier);
};

initializeHandler('lambda-test/async.handler', {
disableAwsContextPropagation: true,
eventContextExtractor: customExtractor,
});

const testSpan = provider.getTracer('test').startSpan('random_span');
await context.with(
trace.setSpan(context.active(), testSpan),
async () => {
await lambdaRequire('lambda-test/async').handler(
{ message: 'event with no context' },
ctx
);
}
);

const spans = memoryExporter.getFinishedSpans();
const [span] = spans;
assert.strictEqual(span.parentSpanId, undefined);
});
});

describe('hooks', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
},
"devDependencies": {
"@opentelemetry/api": "1.0.2",
"@opentelemetry/context-async-hooks": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/context-async-hooks": "1.0.0",
"@opentelemetry/sdk-trace-base": "1.0.0",
"@opentelemetry/sdk-trace-node": "1.0.0",
"@types/mocha": "7.0.2",
"@types/node": "14.17.9",
"@types/sinon": "10.0.2",
Expand All @@ -65,7 +65,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.25.0",
"@opentelemetry/instrumentation": "^0.26.0",
"@types/bunyan": "1.8.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
},
"devDependencies": {
"@opentelemetry/api": "1.0.2",
"@opentelemetry/context-async-hooks": "0.25.0",
"@opentelemetry/context-async-hooks": "1.0.0",
"@opentelemetry/contrib-test-utils": "^0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/sdk-trace-base": "1.0.0",
"@opentelemetry/sdk-trace-node": "1.0.0",
"@types/mocha": "7.0.2",
"@types/node": "14.17.9",
"@types/semver": "7.3.8",
Expand All @@ -67,7 +67,7 @@
"typescript": "4.3.5"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.25.0",
"@opentelemetry/semantic-conventions": "^0.25.0"
"@opentelemetry/instrumentation": "^0.26.0",
"@opentelemetry/semantic-conventions": "^1.0.0"
}
}
Loading

0 comments on commit 49b2190

Please sign in to comment.