Skip to content

Commit

Permalink
Merge branch 'main' into fix/4115
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Oct 10, 2023
2 parents 5167f2f + c320c98 commit 3690459
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 188 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

* fix(sdk-trace-base): BatchSpanProcessor flushes when `maxExportBatchSize` is reached [#3958](https://github.com/open-telemetry/opentelemetry-js/pull/3958) @nordfjord
* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155)
* fix(sdk-metrics): prevent per-reader storages from keeping unreported accumulations in memory [#4163](https://github.com/open-telemetry/opentelemetry-js/pull/4163) @pichlermarc
* fixes a memory leak which occurred when two or more `MetricReader` instances are registered to a `MeterProvider`
Expand Down
3 changes: 0 additions & 3 deletions doc/library-author.md

This file was deleted.

2 changes: 1 addition & 1 deletion doc/metrics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metrics

This quick start is for end users of OpenTelemetry who wish to manually measure their applications. If you are a library author, please see the [Library Authors Guide](library-author.md). If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use.
This quick start is for end users of OpenTelemetry who wish to manually measure their applications. If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use.

For a high-level overview of OpenTelemetry metrics in general and definitions of some common terms, you can refer to the [OpenTelemetry Specification Overview][spec-overview]

Expand Down
147 changes: 0 additions & 147 deletions doc/processor-api.md

This file was deleted.

2 changes: 1 addition & 1 deletion doc/tracing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tracing

This quick start is for end users of OpenTelemetry who wish to manually trace their applications. If you are a library author, please see the [Library Authors Guide](library-author.md). If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use.
This quick start is for end users of OpenTelemetry who wish to manually trace their applications. If you wish to automatically instrument your application, see the automatic instrumentation documentation for the SDK you wish to use.

For a high-level overview of OpenTelemetry tracing in general and definitions of some common terms, you can refer to the [OpenTelemetry Specification Overview][spec-overview]

Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/exporter-logs-otlp-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"devDependencies": {
"@babel/core": "7.22.20",
"@grpc/proto-loader": "^0.7.3",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/api-logs": "0.43.0",
"@opentelemetry/otlp-exporter-base": "0.43.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"devDependencies": {
"@babel/core": "7.22.20",
"@grpc/proto-loader": "^0.7.3",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/otlp-exporter-base": "0.43.0",
"@types/mocha": "10.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"devDependencies": {
"@babel/core": "7.22.20",
"@grpc/proto-loader": "^0.7.3",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@bufbuild/buf": "1.21.0-1",
"@grpc/grpc-js": "^1.7.1",
"@grpc/proto-loader": "^0.7.3",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/context-async-hooks": "1.17.0",
"@opentelemetry/core": "1.17.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
private readonly _scheduledDelayMillis: number;
private readonly _exportTimeoutMillis: number;

private _isExporting = false;
private _finishedSpans: ReadableSpan[] = [];
private _timer: NodeJS.Timeout | undefined;
private _shutdownOnce: BindOnceFuture<void>;
Expand Down Expand Up @@ -216,19 +217,28 @@ export abstract class BatchSpanProcessorBase<T extends BufferConfig>
}

private _maybeStartTimer() {
if (this._timer !== undefined) return;
this._timer = setTimeout(() => {
if (this._isExporting) return;
const flush = () => {
this._isExporting = true;
this._flushOneBatch()
.then(() => {
this._isExporting = false;
if (this._finishedSpans.length > 0) {
this._clearTimer();
this._maybeStartTimer();
}
})
.catch(e => {
this._isExporting = false;
globalErrorHandler(e);
});
}, this._scheduledDelayMillis);
};
// we only wait if the queue doesn't have enough elements yet
if (this._finishedSpans.length >= this._maxExportBatchSize) {
return flush();
}
if (this._timer !== undefined) return;
this._timer = setTimeout(() => flush(), this._scheduledDelayMillis);
unrefTimer(this._timer);
}

Expand Down
Loading

0 comments on commit 3690459

Please sign in to comment.