From 76dd559ef9a7088bd3750aeb8f1885c07036108a Mon Sep 17 00:00:00 2001 From: Paulo Prestes Date: Mon, 25 Sep 2023 17:19:44 +1000 Subject: [PATCH] chore(deps): upgrade @types/koa__router dependency (#1670) * move type to dev dependencies * chore(deps): upgrade @types/koa__router dependency * move types to internal-types * fix formatting * formatting * Revert "formatting" This reverts commit b3484061b9120f22a528ade70c3109dc0eb9fd0a. * Revert "fix formatting" This reverts commit 7c604461fe5f0c5380aa3d94e34998bb4a803324. * Revert "move types to internal-types" This reverts commit 0eea74522e32ceaa656d0e6edfaa44d897bb0c65. * moving KoaMiddleware to internal-types * fix formatting * fix formatting * fix formatting --------- Co-authored-by: Amir Blum --- .../opentelemetry-instrumentation-koa/package.json | 2 +- .../src/instrumentation.ts | 13 ++++++------- .../src/internal-types.ts | 8 +++++++- .../opentelemetry-instrumentation-koa/src/types.ts | 5 ----- .../opentelemetry-instrumentation-koa/src/utils.ts | 8 ++------ 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json index 641986de72..44f74612f8 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/package.json +++ b/plugins/node/opentelemetry-instrumentation-koa/package.json @@ -71,7 +71,7 @@ "@opentelemetry/instrumentation": "^0.43.0", "@opentelemetry/semantic-conventions": "^1.0.0", "@types/koa": "2.13.8", - "@types/koa__router": "8.0.11" + "@types/koa__router": "12.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-koa#readme" } diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts index df359e9c3b..9e38ea2618 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/src/instrumentation.ts @@ -23,16 +23,15 @@ import { } from '@opentelemetry/instrumentation'; import type * as koa from 'koa'; -import { - KoaMiddleware, - KoaContext, - KoaLayerType, - KoaInstrumentationConfig, -} from './types'; +import { KoaContext, KoaLayerType, KoaInstrumentationConfig } from './types'; import { VERSION } from './version'; import { getMiddlewareMetadata, isLayerIgnored } from './utils'; import { getRPCMetadata, RPCType } from '@opentelemetry/core'; -import { kLayerPatched, KoaPatchedMiddleware } from './internal-types'; +import { + kLayerPatched, + KoaMiddleware, + KoaPatchedMiddleware, +} from './internal-types'; /** Koa instrumentation for OpenTelemetry */ export class KoaInstrumentation extends InstrumentationBase { diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/internal-types.ts b/plugins/node/opentelemetry-instrumentation-koa/src/internal-types.ts index 05557e938a..58c7bcf5a3 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/src/internal-types.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/src/internal-types.ts @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { KoaMiddleware } from './types'; +import type { Middleware, DefaultState } from 'koa'; +import { KoaContext } from './types'; +import type * as Router from '@koa/router'; + +export type KoaMiddleware = Middleware & { + router?: Router; +}; /** * This symbol is used to mark a Koa layer as being already instrumented diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/types.ts b/plugins/node/opentelemetry-instrumentation-koa/src/types.ts index 83e59389ca..3c249e3a6a 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/src/types.ts @@ -15,7 +15,6 @@ */ import type { Middleware, ParameterizedContext, DefaultState } from 'koa'; import type { RouterParamContext } from '@koa/router'; -import type * as Router from '@koa/router'; import { Span } from '@opentelemetry/api'; import { InstrumentationConfig } from '@opentelemetry/instrumentation'; @@ -26,10 +25,6 @@ export enum KoaLayerType { export type KoaContext = ParameterizedContext; -export type KoaMiddleware = Middleware & { - router?: Router; -}; - export type KoaRequestInfo = { context: KoaContext; middlewareLayer: Middleware; diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts b/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts index e1d92d8abe..6de3e1f3e2 100644 --- a/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts +++ b/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts @@ -13,12 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { - KoaContext, - KoaMiddleware, - KoaLayerType, - KoaInstrumentationConfig, -} from './types'; +import { KoaContext, KoaLayerType, KoaInstrumentationConfig } from './types'; +import { KoaMiddleware } from './internal-types'; import { AttributeNames } from './enums/AttributeNames'; import { SpanAttributes } from '@opentelemetry/api'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions';