Skip to content

Commit

Permalink
Merge branch 'main' into tm-semconv-lint-and-changelog-play
Browse files Browse the repository at this point in the history
  • Loading branch information
trentm authored Dec 3, 2024
2 parents 955ecbe + 8bfa21f commit 7d9a8c2
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Before creating a pull request, please make sure:
- You have read the guide for contributing
- See https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md
- You signed all your commits (otherwise we won't be able to merge the PR)
- See https://github.com/open-telemetry/community/blob/main/CONTRIBUTING.md#sign-the-cla
- See https://github.com/open-telemetry/community/blob/main/guides/contributor#sign-the-cla
- You added unit tests for the new functionality
- You mention in the PR description which issue it is addressing, e.g. "Fixes #xxx". This will auto-close
the issue that your PR fixes (if such)
Expand Down
1 change: 1 addition & 0 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ components:
plugins/node/opentelemetry-instrumentation-aws-sdk:
- blumamir
- jj22ee
- trivikr
plugins/node/opentelemetry-instrumentation-bunyan:
- seemk
- trentm
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ git merge upstream/main

Remember to always work in a branch of your local copy, as you might otherwise have to contend with conflicts in main.

Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/main/CONTRIBUTING.md#github-workflow) section of general project contributing guide.
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/main/guides/contributor/processes.md#github-workflow) section of general project contributing guide.

## Development

Expand Down
2 changes: 2 additions & 0 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 @@ -3,7 +3,7 @@
[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

[component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @blumamir @jj22ee
[component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @blumamir @jj22ee @trivikr

This module provides automatic instrumentation for the [`aws-sdk` v2](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/) and [`@aws-sdk` v3](https://github.com/aws/aws-sdk-js-v3) modules, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.

Expand Down
14 changes: 10 additions & 4 deletions plugins/node/opentelemetry-instrumentation-koa/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
"@koa/router":
versions:
include: ">=8.0.0"
mode: latest-minors
commands: npm run test
jobs:
- versions:
include: ">=8.0.0 <13"
mode: latest-minors
commands: npm run test
- versions:
include: ">=13 <14"
mode: latest-minors
node: '>=18'
commands: npm run test

koa:
# Testing ^2.7.0 covers at least 97% of the downloaded koa versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"koa": "2.13.1",
"nyc": "15.1.0",
"rimraf": "5.0.10",
"semver": "7.6.3",
"sinon": "15.2.0",
"test-all-versions": "6.1.0",
"typescript": "4.4.4"
Expand Down
30 changes: 25 additions & 5 deletions plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import * as assert from 'assert';
import * as koa from 'koa';
import * as http from 'http';
import * as sinon from 'sinon';
import * as semver from 'semver';
import { AddressInfo } from 'net';
import { KoaLayerType, KoaRequestInfo } from '../src/types';
import { AttributeNames } from '../src/enums/AttributeNames';
Expand All @@ -65,7 +66,13 @@ const httpRequest = {
},
};

describe('Koa Instrumentation', () => {
const LIB_VERSION = require('@koa/router/package.json').version;
const NODE_VERSION = process.version;
const isrouterCompat =
semver.lt(LIB_VERSION, '13.0.0') ||
(semver.gte(LIB_VERSION, '13.0.0') && semver.gte(NODE_VERSION, '18.0.0'));

describe('Koa Instrumentation', function () {
const provider = new NodeTracerProvider();
const memoryExporter = new InMemorySpanExporter();
const spanProcessor = new SimpleSpanProcessor(memoryExporter);
Expand All @@ -77,7 +84,7 @@ describe('Koa Instrumentation', () => {
let server: http.Server;
let port: number;

before(() => {
before(function () {
plugin.enable();
});

Expand Down Expand Up @@ -141,7 +148,13 @@ describe('Koa Instrumentation', () => {
yield next;
};

describe('Instrumenting @koa/router calls', () => {
describe('Instrumenting @koa/router calls', function () {
before(function () {
if (!isrouterCompat) {
this.skip();
}
});

it('should create a child span for middlewares (string route)', async () => {
const rootSpan = tracer.startSpan('rootSpan');
const rpcMetadata: RPCMetadata = { type: RPCType.HTTP, span: rootSpan };
Expand Down Expand Up @@ -585,7 +598,13 @@ describe('Koa Instrumentation', () => {
});
});

describe('Using requestHook', () => {
describe('Using requestHook', function () {
before(function () {
if (!isrouterCompat) {
this.skip();
}
});

it('should ignore requestHook which throws exception', async () => {
const rootSpan = tracer.startSpan('rootSpan');
const rpcMetadata = { type: RPCType.HTTP, span: rootSpan };
Expand Down Expand Up @@ -721,7 +740,8 @@ describe('Koa Instrumentation', () => {
});
});

it('should work with ESM usage', async () => {
const itFn = isrouterCompat ? it : it.skip;
itFn('should work with ESM usage', async () => {
await testUtils.runTestFixture({
cwd: __dirname,
argv: ['fixtures/use-koa.mjs'],
Expand Down

0 comments on commit 7d9a8c2

Please sign in to comment.