Skip to content

Commit

Permalink
Merge branch 'main' into fix/exporter-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc committed Mar 12, 2024
2 parents 02dc846 + 1b4999f commit 11d923d
Show file tree
Hide file tree
Showing 37 changed files with 79 additions and 73 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ An entry into `CHANGELOG.md` or `experimental/CHANGELOG.md` is required for the
- Changes to default settings
- New components being added

It is reasonable to omit an entry to the changelog under these circuimstances:
It is reasonable to omit an entry to the changelog under these circumstances:

- Updating test to remove flakiness or improve coverage
- Updates to the CI/CD process
Expand Down
2 changes: 1 addition & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install @opentelemetry/api @opentelemetry/sdk-trace-base

### Trace Your Application

In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [sdk registration methods][docs-sdk-registration].
In order to get started with tracing, you will need to first register an SDK. The SDK you are using may provide a convenience method which calls the registration methods for you, but if you would like to call them directly they are documented here: [SDK registration methods][docs-sdk-registration].

Once you have registered an SDK, you can start and end spans. A simple example of basic SDK registration and tracing a simple operation is below. The example should export spans to the console once per second. For more information, see the [tracing documentation][docs-tracing].

Expand Down
6 changes: 3 additions & 3 deletions api/test/common/metrics/Metric.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Metric', () => {
const counter: Counter<Attributes> = {
add(_value: number, _attribute: Attributes) {},
};
// @ts-expect-error Expacting the type of Attributes
// @ts-expect-error Expecting the type of Attributes
counter.add(1, { 'another-attribute': 'value' });
});
});
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Metric', () => {
const counter: UpDownCounter<Attributes> = {
add(_value: number, _attribute: Attributes) {},
};
// @ts-expect-error Expacting the type of Attributes
// @ts-expect-error Expecting the type of Attributes
counter.add(1, { 'another-attribute': 'value' });
});
});
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('Metric', () => {
const counter: Histogram<Attributes> = {
record(_value: number, _attribute: Attributes) {},
};
// @ts-expect-error Expacting the type of Attributes
// @ts-expect-error Expecting the type of Attributes
counter.record(1, { 'another-attribute': 'value' });
});
});
Expand Down
4 changes: 2 additions & 2 deletions doc/upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Collector exporter packages and types are renamed:

- All plugins have been removed in favor of instrumentations.

- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header endcoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [readme][otel-propagator-b3] for full details and usage.
- The `@opentelemetry/propagator-b3` package previously exported three propagators: `B3Propagator`,`B3SinglePropagator`, and `B3MultiPropagator`, but now only exports the `B3Propagator`. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header encoding during construction: `new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })`. If you were previously using the `B3SinglePropagator` or `B3MultiPropagator` directly, you should update your code to use the `B3Propagator` with the appropriate configuration. See the [README][otel-propagator-b3] for full details and usage.

- Sampling configuration via environment variable has changed. If you were using `OTEL_SAMPLING_PROBABILITY` then you should replace it with `OTEL_TRACES_SAMPLER=parentbased_traceidratio` and `OTEL_TRACES_SAMPLER_ARG=<number>` where `<number>` is a number in the [0..1] range, e.g. "0.25". Default is 1.0 if unset.

Expand Down Expand Up @@ -232,7 +232,7 @@ Some types exported from `"@opentelemetry/api"` have been changed to be more spe

## 0.15.0 to 0.16.0

[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from nodejs `CollectorTraceExporter` and `CollectorMetricExporter`
[PR-1863](https://github.com/open-telemetry/opentelemetry-js/pull/1863) removed public attributes `keepAlive` and `httpAgentOptions` from Node.js `CollectorTraceExporter` and `CollectorMetricExporter`

## 0.14.0 to 0.15.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ start().then(()=> console.log("Instrumentation started"));

The browser identification attributes will be added to the resource spans when traces are created.
These attributes include platform, brands, mobile, language if the browser supports
the userAgentData api, otherwise it will contain only the user_agent informations
the userAgentData api, otherwise it will contain only the user_agent information
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type UserAgentData = {
};

export const BROWSER_ATTRIBUTES = {
PLATFORM: 'browser.platform', //TODO replace with SemantecConventions attribute when available
PLATFORM: 'browser.platform', //TODO replace with SemanticConventions attribute when available
BRANDS: 'browser.brands',
MOBILE: 'browser.mobile',
LANGUAGE: 'browser.language',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ describe('fetch', () => {
clearData();
});

it('applies attributes when the request is succesful', async () => {
it('applies attributes when the request is successful', async () => {
await prepare(url, span => {
span.setAttribute(CUSTOM_ATTRIBUTE_KEY, 'custom value');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function patchResponseStreamEvents(span: Span, call: EventEmitter) {
}

/**
* Execute grpc client call. Apply completitionspan properties and end the
* Execute grpc client call. Apply completion span properties and end the
* span on callback or receiving an emitted event.
*/
export function makeGrpcClientRemoteCall(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export async function startServer(proto: any, port: number) {
server.addService(proto.GrpcTester.service, {
// An error is emitted every time
// request.num <= MAX_ERROR_STATUS = (status.UNAUTHENTICATED)
// in those cases, erro.code = request.num
// in those cases, error.code = request.num

// This method returns the request
// This method returns the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The following options are deprecated:
| Options | Type | Description |
| ------- | ---- | ----------- |
| `ignoreIncomingPaths` | `IgnoreMatcher[]` | Http instrumentation will not trace all incoming requests that match paths |
| `ignoreOutgoingUrls` | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match urls |
| `ignoreOutgoingUrls` | `IgnoreMatcher[]` | Http instrumentation will not trace all outgoing requests that match URLs |

## Useful links

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export const getOutgoingRequestMetricAttributes = (
spanAttributes[SemanticAttributes.HTTP_METHOD];
metricAttributes[SemanticAttributes.NET_PEER_NAME] =
spanAttributes[SemanticAttributes.NET_PEER_NAME];
//TODO: http.url attribute, it should susbtitute any parameters to avoid high cardinality.
//TODO: http.url attribute, it should substitute any parameters to avoid high cardinality.
return metricAttributes;
};

Expand Down Expand Up @@ -514,7 +514,7 @@ export const getIncomingRequestMetricAttributes = (
spanAttributes[SemanticAttributes.NET_HOST_NAME];
metricAttributes[SemanticAttributes.HTTP_FLAVOR] =
spanAttributes[SemanticAttributes.HTTP_FLAVOR];
//TODO: http.target attribute, it should susbtitute any parameters to avoid high cardinality.
//TODO: http.target attribute, it should substitute any parameters to avoid high cardinality.
return metricAttributes;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ describe('HttpInstrumentation', () => {
});

for (const arg of ['string', {}, new Date()]) {
it(`should be tracable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
it(`should be traceable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
arg
)}`, async () => {
try {
Expand Down Expand Up @@ -1101,10 +1101,10 @@ describe('HttpInstrumentation', () => {

it('should set rpc metadata for incoming http request', async () => {
server = http.createServer((request, response) => {
const rpcMemadata = getRPCMetadata(context.active());
assert(typeof rpcMemadata !== 'undefined');
assert(rpcMemadata.type === RPCType.HTTP);
assert(rpcMemadata.span.setAttribute('key', 'value'));
const rpcMetadata = getRPCMetadata(context.active());
assert(typeof rpcMetadata !== 'undefined');
assert(rpcMetadata.type === RPCType.HTTP);
assert(rpcMetadata.span.setAttribute('key', 'value'));
response.end('Test Server Response');
});
await new Promise<void>(resolve => server.listen(serverPort, resolve));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ describe('HttpsInstrumentation', () => {
});

for (const arg of ['string', {}, new Date()]) {
it(`should be tracable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
it(`should be traceable and not throw exception in ${protocol} instrumentation when passing the following argument ${JSON.stringify(
arg
)}`, async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe('Utility', () => {
);
});

it('should succesfully process without middleware stack', () => {
it('should successfully process without middleware stack', () => {
const request = {
socket: {},
} as IncomingMessage;
Expand Down
8 changes: 4 additions & 4 deletions experimental/packages/opentelemetry-instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ registerInstrumentations({
The `registerInstrumentations()` API allows to specify which `TracerProvider` and/or `MeterProvider` to use by the given options object.
If nothing is specified the global registered provider is used. Usually this is what most users want therefore it's recommended to keep this default.

There might be usecase where someone has the need for more providers within an application. Please note that special care must be takes in such setups
There might be use case where someone has the need for more providers within an application. Please note that special care must be takes in such setups
to avoid leaking information from one provider to the other because there are a lot places where e.g. the global `ContextManager` or `Propagator` is used.

## Instrumentation for ES Modules In NodeJS (experimental)
## Instrumentation for ES Modules In Node.js (experimental)

As the module loading mechanism for ESM is different than CJS, you need to select a custom loader so instrumentation can load hook on the esm module it want to patch. To do so, you must provide the `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` flag to the `node` binary. Alternatively you can set the `NODE_OPTIONS` environment variable to `NODE_OPTIONS="--experimental-loader=@opentelemetry/instrumentation/hook.mjs"`.
As the ESM module loader from NodeJS is experimental, so is our support for it. Feel free to provide feedback or report issues about it.
As the module loading mechanism for ESM is different than CJS, you need to select a custom loader so instrumentation can load hook on the ESM module it want to patch. To do so, you must provide the `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` flag to the `node` binary. Alternatively you can set the `NODE_OPTIONS` environment variable to `NODE_OPTIONS="--experimental-loader=@opentelemetry/instrumentation/hook.mjs"`.
As the ESM module loader from Node.js is experimental, so is our support for it. Feel free to provide feedback or report issues about it.

**Note**: ESM Instrumentation is not yet supported for Node 20.

Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/opentelemetry-sdk-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ An array of span processors to register to the tracer provider.

### traceExporter

Configure a trace exporter. If an exporter is configured, it will be used with a [BatchSpanProcessor](../../../packages/opentelemetry-sdk-trace-base/src/platform/node/export/BatchSpanProcessor.ts). If an exporter OR span processor is not configured programatically, this package will auto setup the default `otlp` exporter with `http/protobuf` protocol with a `BatchSpanProcessor`.
Configure a trace exporter. If an exporter is configured, it will be used with a [BatchSpanProcessor](../../../packages/opentelemetry-sdk-trace-base/src/platform/node/export/BatchSpanProcessor.ts). If an exporter OR span processor is not configured programmatically, this package will auto setup the default `otlp` exporter with `http/protobuf` protocol with a `BatchSpanProcessor`.

### spanLimits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('set up trace exporter with env exporters', () => {
assert(listOfProcessors === undefined);
delete env.OTEL_TRACES_EXPORTER;
});
it('log warning that sdk will not be initalized when exporter is set to none', async () => {
it('log warning that sdk will not be initialized when exporter is set to none', async () => {
env.OTEL_TRACES_EXPORTER = 'none';
new TracerProviderWithEnvExporters();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ describe('setup exporter from env', () => {
assert(activeProcessor instanceof NoopSpanProcessor);
delete env.OTEL_TRACES_EXPORTER;
});
it('log warning that sdk will not be initalized when exporter is set to none', async () => {
it('log warning that sdk will not be initialized when exporter is set to none', async () => {
env.OTEL_TRACES_EXPORTER = 'none';
const sdk = new NodeSDK();
sdk.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('utils', () => {
const finalUrl = appendResourcePathToUrl(url, resourcePath);
assert.strictEqual(finalUrl, url + '/' + resourcePath);
});
it('should append resourse path even when url already contains path ', () => {
it('should append resource path even when url already contains path ', () => {
const url = 'http://foo.bar/v1/traces';
const resourcePath = 'v1/traces';

Expand All @@ -82,7 +82,7 @@ describe('utils', () => {
});

// only invoked with signal specific endpoint
describe('appendRootPathToUrlIfNeeded - specifc signal http endpoint', () => {
describe('appendRootPathToUrlIfNeeded - specific signal http endpoint', () => {
it('should append root path when missing', () => {
const url = 'http://foo.bar';

Expand Down Expand Up @@ -110,7 +110,7 @@ describe('utils', () => {
}
});

it('should not change string when url is not parseable', () => {
it('should not change string when url is not parsable', () => {
const url = 'this is not a URL';

const finalUrl = appendRootPathToUrlIfNeeded(url);
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/shim-opencensus/src/ShimTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class ShimTracer implements oc.Tracer {
onStartSpan(): void {}
onEndSpan(): void {}
setCurrentRootSpan() {
// This can't be correctly overriden since OTel context does not provide a way to set
// This can't be correctly overridden since OTel context does not provide a way to set
// context without a callback. Leave noop for now.
}

Expand Down
34 changes: 20 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class AsyncHooksContextManager extends AbstractAsyncHooksContextManager {
private _init(uid: number, type: string) {
// ignore TIMERWRAP as they combine timers with same timeout which can lead to
// false context propagation. TIMERWRAP has been removed in node 11
// every timer has it's own `Timeout` resource anyway which is used to propagete
// every timer has it's own `Timeout` resource anyway which is used to propagate
// context.
if (type === 'TIMERWRAP') return;

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/src/internal/exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface Exporter<T> {

/**
* @internal
* Shared functionality used by Exporters while exporting data, including suppresion of Traces.
* Shared functionality used by Exporters while exporting data, including suppression of Traces.
*/
export function _export<T>(
exporter: Exporter<T>,
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/test/common/time.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('time', () => {
});
});

describe('#hrTimeToMicroeconds', () => {
describe('#hrTimeToMicroseconds', () => {
it('should return microseconds', () => {
const output = hrTimeToMicroseconds([1, 200000000]);
assert.deepStrictEqual(output, 1200000);
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-jaeger/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ExporterConfig {
/** Time to wait for an onShutdown flush to finish before closing the sender */
flushTimeout?: number; // default: 2000
//The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces
//If setten will override host and port
//If set, will override host and port
endpoint?: string;
//Username to send as part of "Basic" authentication to the collector endpoint
username?: string;
Expand Down
Loading

0 comments on commit 11d923d

Please sign in to comment.