From 74ca04f7b2253f8696013a4bf348eac905c32078 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 1 Mar 2023 09:42:01 +0100 Subject: [PATCH 1/3] fix(test): fix failing tests by preventing source-map generation (#3642) * fix(test): fix excessive memory usage by preventing source-map generation * fix(changlog): add changelog entry. --- .nycrc | 1 + CHANGELOG.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.nycrc b/.nycrc index 520f016fc2b..22383d8abab 100644 --- a/.nycrc +++ b/.nycrc @@ -1,4 +1,5 @@ { + "produceSourceMap": false, "extension": [ ".ts" ], diff --git a/CHANGELOG.md b/CHANGELOG.md index 2772fb4f785..607cb9544db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :house: (Internal) -* fix(sdk-metrics): ix flaky LastValueAggregator test by using fake timer [#3587](https://github.com/open-telemetry/opentelemetry-js/pull/3587) @pichlermarc +* fix(sdk-metrics): fix flaky LastValueAggregator test by using fake timer [#3587](https://github.com/open-telemetry/opentelemetry-js/pull/3587) @pichlermarc +* fix(test): fix failing tests by preventing source-map generation [#3642](https://github.com/open-telemetry/opentelemetry-js/pull/3642) @pichlermarc ## 1.9.1 From a457d941c20fab1a920c8eb43e47d741f02c0550 Mon Sep 17 00:00:00 2001 From: kobi-co <112798986+kobi-co@users.noreply.github.com> Date: Wed, 1 Mar 2023 23:38:13 +0200 Subject: [PATCH 2/3] fix(instrumentation-http): include query params in http.target (#3646) * fix: set http.target as path (like spec) and not pathname * fix: set http.target as path (like spec) and not pathname * fix: set http.target as path (like spec) and not pathname --- CHANGELOG.md | 1 + .../src/utils.ts | 2 +- .../test/functionals/utils.test.ts | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 607cb9544db..a5014e77373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :bug: (Bug Fix) * fix(core): added falsy check to make otel core work with browser where webpack config had process as false or null [#3613](https://github.com/open-telemetry/opentelemetry-js/issues/3613) @ravindra-dyte +* fix(instrumentation-http): include query params in http.target [#3646](https://github.com/open-telemetry/opentelemetry-js/pull/3646) @kobi-co ### :books: (Refine Doc) diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts index 7801a7626c8..a563e294715 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts @@ -484,7 +484,7 @@ export const getIncomingRequestAttributes = ( } if (requestUrl) { - attributes[SemanticAttributes.HTTP_TARGET] = requestUrl.pathname || '/'; + attributes[SemanticAttributes.HTTP_TARGET] = requestUrl.path || '/'; } if (userAgent !== undefined) { diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts index 700498cfb66..35b3c1ab5bc 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/utils.test.ts @@ -503,6 +503,23 @@ describe('Utility', () => { }); assert.strictEqual(attributes[SemanticAttributes.HTTP_ROUTE], undefined); }); + + it('should set http.target as path in http span attributes', () => { + const request = { + url: 'http://hostname/user/?q=val', + method: 'GET', + } as IncomingMessage; + request.headers = { + 'user-agent': 'chrome', + }; + const attributes = utils.getIncomingRequestAttributes(request, { + component: 'http', + }); + assert.strictEqual( + attributes[SemanticAttributes.HTTP_TARGET], + '/user/?q=val' + ); + }); }); describe('headers to span attributes capture', () => { From 31dd7b72588a2490b52577efe021445426cd7dda Mon Sep 17 00:00:00 2001 From: Altinok Darici Date: Wed, 1 Mar 2023 13:53:13 -0800 Subject: [PATCH 3/3] Rename Diag/LoggerOptions to DiagLoggerOptions (#3641) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rename LoggerOptions to DiagLoggerOptions * Change log --------- Co-authored-by: Marc Pichler Co-authored-by: Gerhard Stöbich Co-authored-by: Daniel Dyla --- api/CHANGELOG.md | 1 + api/src/diag/types.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/CHANGELOG.md b/api/CHANGELOG.md index cc96483c766..be8c623e847 100644 --- a/api/CHANGELOG.md +++ b/api/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### :bug: (Bug Fix) * fix(metrics): export `MetricsAPI` type [#3535](https://github.com/open-telemetry/opentelemetry-js/pull/3535) +* fix(api): rename `LoggerOptions` to `DiagLoggerOptions` [#3641](https://github.com/open-telemetry/opentelemetry-js/pull/3641) ## 1.4.0 diff --git a/api/src/diag/types.ts b/api/src/diag/types.ts index e861d430c1f..588b525ec65 100644 --- a/api/src/diag/types.ts +++ b/api/src/diag/types.ts @@ -97,7 +97,7 @@ export interface ComponentLoggerOptions { namespace: string; } -export interface LoggerOptions { +export interface DiagLoggerOptions { /** * The {@link DiagLogLevel} used to filter logs sent to the logger. * @@ -117,10 +117,10 @@ export interface DiagLoggerApi { * If a global diag logger is already set, this will override it. * * @param logger - The {@link DiagLogger} instance to set as the default logger. - * @param options - A {@link LoggerOptions} object. If not provided, default values will be set. + * @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set. * @returns `true` if the logger was successfully registered, else `false` */ - setLogger(logger: DiagLogger, options?: LoggerOptions): boolean; + setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean; /** *