Skip to content

Commit

Permalink
Merge branch 'main' into start-active-span
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Jun 1, 2021
2 parents 4eb9d6c + d551781 commit d5bab9b
Show file tree
Hide file tree
Showing 101 changed files with 589 additions and 749 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ To request automatic tracing support for a module not on this list, please [file

- `JaegerHttpTracePropagator` renamed to `JaegerPropagator`

- `serviceName` configuration removed from Collector exporters. Use `service.name` Resource attribute instead.

### 0.18.x to 0.19.0

- API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically.
Expand Down
2 changes: 1 addition & 1 deletion backwards-compatability/node10/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "10.17.59",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion backwards-compatability/node12/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "12.20.11",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion backwards-compatability/node8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@types/node": "8.10.66",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@opentelemetry/api": "^0.20.0",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@
"devDependencies": {
"@commitlint/cli": "12.1.1",
"@commitlint/config-conventional": "12.1.1",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"@typescript-eslint/eslint-plugin": "4.25.0",
"@typescript-eslint/parser": "4.25.0",
"beautify-benchmark": "0.2.4",
"benchmark": "2.1.4",
"eslint": "7.25.0",
"eslint": "7.27.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-import": "2.23.3",
"eslint-plugin-node": "11.1.0",
"gh-pages": "3.1.0",
"husky": "4.3.8",
"lerna": "3.22.1",
"lerna-changelog": "1.0.1",
"markdownlint-cli": "0.27.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"update-ts-references": "2.3.0"
},
"husky": {
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-api-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"nyc": "15.1.0",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
}
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-api-metrics/test/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('API', () => {
});

class TestMeterProvider extends NoopMeterProvider {
getMeter() {
override getMeter() {
return dummyMeter;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-async-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-zone-peer-dep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"zone.js": "0.11.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0",
"webpack-cli": "4.6.0",
"webpack-merge": "5.7.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4",
"typescript": "4.3.2",
"webpack": "4.46.0"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/opentelemetry-core/src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export type ENVIRONMENT = {
OTEL_EXPORTER_ZIPKIN_ENDPOINT?: string;
OTEL_LOG_LEVEL?: DiagLogLevel;
OTEL_RESOURCE_ATTRIBUTES?: string;
OTEL_SERVICE_NAME?: string;
OTEL_TRACES_EXPORTER?: string;
OTEL_TRACES_SAMPLER_ARG?: string;
OTEL_TRACES_SAMPLER?: string;
Expand Down Expand Up @@ -115,6 +116,7 @@ export const DEFAULT_ENVIRONMENT: Required<ENVIRONMENT> = {
OTEL_NO_PATCH_MODULES: [],
OTEL_PROPAGATORS: ['tracecontext', 'baggage'],
OTEL_RESOURCE_ATTRIBUTES: '',
OTEL_SERVICE_NAME: '',
OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: 128,
OTEL_SPAN_EVENT_COUNT_LIMIT: 128,
OTEL_SPAN_LINK_COUNT_LIMIT: 128,
Expand Down
10 changes: 6 additions & 4 deletions packages/opentelemetry-exporter-collector-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ This module provides exporter for web and node to be used with [opentelemetry-co
npm install --save @opentelemetry/exporter-collector-grpc
```

## Service Name

The OpenTelemetry Collector Exporter does not have a service name configuration.
In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name].

## Traces in Node - GRPC

The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`.
Expand All @@ -22,7 +27,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');

const collectorOptions = {
serviceName: 'basic-service',
// url is optional and can be omitted - default is localhost:4317
url: '<collector-hostname>:<port>',
};
Expand All @@ -47,7 +51,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');

const collectorOptions = {
serviceName: 'basic-service',
// url is optional and can be omitted - default is localhost:4317
url: '<collector-hostname>:<port>',
credentials: grpc.credentials.createSsl(),
Expand Down Expand Up @@ -88,7 +91,6 @@ const metadata = new grpc.Metadata();
metadata.set('k', 'v');

const collectorOptions = {
serviceName: 'basic-service',
// url is optional and can be omitted - default is localhost:4317
url: '<collector-hostname>:<port>',
metadata, // // an optional grpc.Metadata object to be sent with each request
Expand All @@ -114,7 +116,6 @@ The CollectorTraceExporter in Node expects the URL to only be the hostname. It w
const { MeterProvider } = require('@opentelemetry/metrics');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
const collectorOptions = {
serviceName: 'basic-service',
// url is optional and can be omitted - default is localhost:4317
url: '<collector-hostname>:<port>',
};
Expand Down Expand Up @@ -161,3 +162,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-grpc
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-grpc.svg
[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector
[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
import { getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';

const DEFAULT_SERVICE_NAME = 'collector-metric-exporter';
const DEFAULT_COLLECTOR_URL = 'localhost:4317';

/**
Expand Down Expand Up @@ -59,10 +58,6 @@ export class CollectorMetricExporter
: DEFAULT_COLLECTOR_URL;
}

getDefaultServiceName(config: CollectorExporterConfigNode): string {
return config.serviceName || DEFAULT_SERVICE_NAME;
}

getServiceClientType() {
return ServiceClientType.METRICS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types';
import { getEnv } from '@opentelemetry/core';
import { validateAndNormalizeUrl } from './util';

const DEFAULT_SERVICE_NAME = 'collector-trace-exporter';
const DEFAULT_COLLECTOR_URL = 'localhost:4317';

/**
Expand Down Expand Up @@ -52,10 +51,6 @@ export class CollectorTraceExporter
: DEFAULT_COLLECTOR_URL;
}

getDefaultServiceName(config: CollectorExporterConfigNode): string {
return config.serviceName || DEFAULT_SERVICE_NAME;
}

getServiceClientType() {
return ServiceClientType.SPANS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const testCollectorMetricExporter = (params: TestParams) =>
collectorExporter = new CollectorMetricExporter({
url: 'grpcs://' + address,
credentials,
serviceName: 'basic-service',
metadata: params.metadata,
});
// Overwrites the start time to make tests consistent
Expand Down Expand Up @@ -169,7 +168,6 @@ const testCollectorMetricExporter = (params: TestParams) =>
// Need to stub/spy on the underlying logger as the 'diag' instance is global
const spyLoggerWarn = sinon.stub(diag, 'warn');
collectorExporter = new CollectorMetricExporter({
serviceName: 'basic-service',
url: `http://${address}`,
headers: {
foo: 'bar',
Expand All @@ -181,7 +179,6 @@ const testCollectorMetricExporter = (params: TestParams) =>
it('should warn about path in url', () => {
const spyLoggerWarn = sinon.stub(diag, 'warn');
collectorExporter = new CollectorMetricExporter({
serviceName: 'basic-service',
url: `http://${address}/v1/metrics`
});
const args = spyLoggerWarn.args[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ const testCollectorExporter = (params: TestParams) =>
)
: undefined;
collectorExporter = new CollectorTraceExporter({
serviceName: 'basic-service',
url: 'grpcs://' + address,
credentials,
metadata: params.metadata,
Expand All @@ -146,7 +145,6 @@ const testCollectorExporter = (params: TestParams) =>
// Need to stub/spy on the underlying logger as the 'diag' instance is global
const spyLoggerWarn = sinon.stub(diag, 'warn');
collectorExporter = new CollectorTraceExporter({
serviceName: 'basic-service',
url: `http://${address}`,
headers: {
foo: 'bar',
Expand All @@ -158,7 +156,6 @@ const testCollectorExporter = (params: TestParams) =>
it('should warn about path in url', () => {
const spyLoggerWarn = sinon.stub(diag, 'warn');
collectorExporter = new CollectorTraceExporter({
serviceName: 'basic-service',
url: `http://${address}/v1/trace`,
});
const args = spyLoggerWarn.args[0];
Expand Down
36 changes: 29 additions & 7 deletions packages/opentelemetry-exporter-collector-grpc/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { Resource } from '@opentelemetry/resources';
import { ReadableSpan } from '@opentelemetry/tracing';
import * as assert from 'assert';
import * as grpc from '@grpc/grpc-js';
import { VERSION } from '@opentelemetry/core';

const meterProvider = new metrics.MeterProvider({
interval: 30000,
Expand Down Expand Up @@ -157,11 +158,11 @@ export const mockedReadableSpan: ReadableSpan = {
},
],
duration: [0, 8885000],
resource: new Resource({
resource: Resource.default().merge(new Resource({
service: 'ui',
version: 1,
cost: 112.12,
}),
})),
instrumentationLibrary: { name: 'default', version: '0.0.1' },
};

Expand Down Expand Up @@ -409,11 +410,32 @@ export function ensureResourceIsCorrect(
assert.deepStrictEqual(resource, {
attributes: [
{
key: 'service.name',
value: {
stringValue: 'basic-service',
value: 'stringValue',
},
"key": "service.name",
"value": {
"stringValue": `unknown_service:${process.argv0}`,
"value": "stringValue"
}
},
{
"key": "telemetry.sdk.language",
"value": {
"stringValue": "nodejs",
"value": "stringValue"
}
},
{
"key": "telemetry.sdk.name",
"value": {
"stringValue": "opentelemetry",
"value": "stringValue"
}
},
{
"key": "telemetry.sdk.version",
"value": {
"stringValue": VERSION,
"value": "stringValue"
}
},
{
key: 'service',
Expand Down
8 changes: 6 additions & 2 deletions packages/opentelemetry-exporter-collector-proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ This module provides exporter for node to be used with [opentelemetry-collector]
npm install --save @opentelemetry/exporter-collector-proto
```

## Service Name

The OpenTelemetry Collector Exporter does not have a service name configuration.
In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name].

## Traces in Node - PROTO over http

```js
const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-proto');

const collectorOptions = {
serviceName: 'basic-service',
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/traces
headers: {
foo: 'bar'
Expand All @@ -41,7 +45,6 @@ provider.register();
const { MeterProvider } = require('@opentelemetry/metrics');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-proto');
const collectorOptions = {
serviceName: 'basic-service',
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics
};
const exporter = new CollectorMetricExporter(collectorOptions);
Expand Down Expand Up @@ -84,3 +87,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-proto.svg
[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector
[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"ts-node": "9.1.1",
"typescript": "4.2.4"
"typescript": "4.3.2"
},
"peerDependencies": {
"@opentelemetry/api": "^0.20.0"
Expand Down
Loading

0 comments on commit d5bab9b

Please sign in to comment.