Skip to content

Commit fe8416b

Browse files
Merge branch 'main' into bedrock-invoke-model-stream
2 parents 213fd74 + c8fa46d commit fe8416b

File tree

167 files changed

+4276
-5249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+4276
-5249
lines changed

.github/workflows/test-all-versions.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ jobs:
163163
- uses: actions/setup-node@v4
164164
with:
165165
node-version: ${{ matrix.node }}
166-
- name: Set MySQL variables
167-
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
168166
- name: Install
169167
run: npm ci
170168
- name: Download Build Artifacts

.github/workflows/unit-test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ jobs:
176176
- uses: actions/setup-node@v4
177177
with:
178178
node-version: ${{ matrix.node }}
179-
- name: Set MySQL variables
180-
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
181179
- name: Install
182180
run: npm ci
183181
- name: Download Build Artifacts

.release-please-manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"detectors/node/opentelemetry-resource-detector-github": "0.31.0",
88
"detectors/node/opentelemetry-resource-detector-instana": "0.21.0",
99
"metapackages/auto-configuration-propagators": "0.4.1",
10-
"metapackages/auto-instrumentations-node": "0.60.0",
10+
"metapackages/auto-instrumentations-node": "0.60.1",
1111
"metapackages/auto-instrumentations-web": "0.48.0",
1212
"packages/baggage-span-processor": "0.4.0",
1313
"packages/baggage-log-record-processor": "0.3.0",
@@ -29,7 +29,7 @@
2929
"plugins/node/instrumentation-socket.io": "0.49.0",
3030
"plugins/node/instrumentation-tedious": "0.21.0",
3131
"plugins/node/instrumentation-typeorm": "0.3.0",
32-
"plugins/node/instrumentation-undici": "0.13.0",
32+
"plugins/node/instrumentation-undici": "0.13.1",
3333
"plugins/node/opentelemetry-instrumentation-aws-lambda": "0.53.0",
3434
"plugins/node/opentelemetry-instrumentation-aws-sdk": "0.54.0",
3535
"plugins/node/opentelemetry-instrumentation-bunyan": "0.48.0",
@@ -40,22 +40,22 @@
4040
"plugins/node/opentelemetry-instrumentation-fastify": "0.47.0",
4141
"plugins/node/opentelemetry-instrumentation-generic-pool": "0.46.0",
4242
"plugins/node/opentelemetry-instrumentation-graphql": "0.50.0",
43-
"plugins/node/opentelemetry-instrumentation-hapi": "0.48.0",
43+
"plugins/node/opentelemetry-instrumentation-hapi": "0.49.0",
4444
"plugins/node/opentelemetry-instrumentation-ioredis": "0.50.0",
4545
"plugins/node/opentelemetry-instrumentation-knex": "0.47.0",
46-
"plugins/node/opentelemetry-instrumentation-koa": "0.50.0",
46+
"plugins/node/opentelemetry-instrumentation-koa": "0.50.1",
4747
"plugins/node/opentelemetry-instrumentation-memcached": "0.46.0",
48-
"plugins/node/opentelemetry-instrumentation-mongodb": "0.55.0",
48+
"plugins/node/opentelemetry-instrumentation-mongodb": "0.55.1",
4949
"plugins/node/opentelemetry-instrumentation-mysql": "0.48.0",
5050
"plugins/node/opentelemetry-instrumentation-mysql2": "0.48.0",
5151
"plugins/node/opentelemetry-instrumentation-nestjs-core": "0.48.0",
52-
"plugins/node/opentelemetry-instrumentation-net": "0.46.0",
52+
"plugins/node/opentelemetry-instrumentation-net": "0.46.1",
5353
"plugins/node/opentelemetry-instrumentation-oracledb": "0.28.0",
5454
"plugins/node/opentelemetry-instrumentation-pg": "0.54.0",
5555
"plugins/node/opentelemetry-instrumentation-pino": "0.49.0",
56-
"plugins/node/opentelemetry-instrumentation-redis": "0.49.0",
56+
"plugins/node/opentelemetry-instrumentation-redis": "0.49.1",
5757
"plugins/node/opentelemetry-instrumentation-redis-4": "0.49.0",
58-
"plugins/node/opentelemetry-instrumentation-restify": "0.48.0",
58+
"plugins/node/opentelemetry-instrumentation-restify": "0.48.1",
5959
"plugins/node/opentelemetry-instrumentation-router": "0.47.0",
6060
"plugins/node/opentelemetry-instrumentation-winston": "0.47.0",
6161
"plugins/web/opentelemetry-instrumentation-document-load": "0.47.0",

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,34 @@ The conventional commit type (in PR title) is very important to automatically bu
135135

136136
There is no need to update the CHANGELOG in a PR because it will be updated as part of the release process (see [RELEASING.md](RELEASING.md) for more details).
137137

138+
### Testing
139+
140+
Most unit tests case be run via:
141+
142+
```sh
143+
npm test
144+
```
145+
146+
However, some instrumentations require test-services to be running (e.g. the `instrumentation-mongodb` package requires a MongoDB server). Use the `test-services`-related npm scripts to start all required services in Docker and then run the tests with the appropriate configuration to use those services:
147+
148+
```sh
149+
npm run test-services:start # starts services in Docker
150+
npm run test:with-services-config # runs 'npm test' with envvars from test/test-services.env
151+
npm run test-services:stop # stops services in Docker
152+
```
153+
154+
If you only want to test a single package (e.g. the `instrumentation-mongodb`) you can `cd` into it and run the tests after you started the services.
155+
156+
```sh
157+
npm run test-services:start # starts services in Docker
158+
cd plugins/node/opentelemetry-instrumentation-mongodb # get into the instrumenation folder
159+
RUN_MONGODB_TESTS=1 npm test # run the test with the proper config (check each package)
160+
cd ../../.. # go back to root folder
161+
npm run test-services:stop # stops services in Docker
162+
```
163+
164+
NOTE: scripts for each package will be added to avoid extra consumption of resources and improve the development experience.
165+
138166
### Benchmarks
139167

140168
When two or more approaches must be compared, please write a benchmark in the benchmark/index.js module so that we can keep track of the most efficient algorithm.

eslint.config.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module.exports = {
55
"node",
66
"prettier"
77
],
8-
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
8+
extends: ["eslint:recommended", "plugin:prettier/recommended"],
99
parser: "@typescript-eslint/parser",
1010
parserOptions: {
11-
"project": "./tsconfig.json"
11+
"project": null
1212
},
1313
rules: {
1414
"quotes": ["error", "single", { "avoidEscape": true }],
@@ -28,6 +28,11 @@ module.exports = {
2828
overrides: [
2929
{
3030
files: ['*.ts'],
31+
// Enable typescript-eslint for ts files.
32+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
33+
parserOptions: {
34+
"project": "./tsconfig.json"
35+
},
3136
rules: {
3237
"@typescript-eslint/no-floating-promises": "error",
3338
"@typescript-eslint/no-this-alias": "off",
@@ -49,21 +54,39 @@ module.exports = {
4954
}
5055
}],
5156
"@typescript-eslint/no-shadow": ["warn"],
57+
"prefer-rest-params": "off",
5258
}
5359
},
5460
{
5561
files: ["test/**/*.ts"],
62+
// Enable typescript-eslint for ts files.
63+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
64+
parserOptions: {
65+
"project": "./tsconfig.json"
66+
},
5667
rules: {
5768
"no-empty": "off",
5869
"@typescript-eslint/ban-ts-ignore": "off",
70+
"@typescript-eslint/ban-types": ["warn", {
71+
"types": {
72+
"Function": null,
73+
}
74+
}],
5975
"@typescript-eslint/no-empty-function": "off",
6076
"@typescript-eslint/no-explicit-any": "off",
6177
"@typescript-eslint/no-unused-vars": "off",
6278
"@typescript-eslint/no-var-requires": "off",
6379
"@typescript-eslint/no-shadow": ["off"],
6480
"@typescript-eslint/no-floating-promises": ["off"],
6581
"@typescript-eslint/no-non-null-assertion": ["off"],
66-
"@typescript-eslint/explicit-module-boundary-types": ["off"]
82+
"@typescript-eslint/explicit-module-boundary-types": ["off"],
83+
"prefer-rest-params": "off",
84+
}
85+
},
86+
{
87+
files: ["*.mjs"],
88+
parserOptions: {
89+
sourceType: 'module',
6790
}
6891
}
6992
]

examples/bunyan/.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
const baseConfig = require('../../eslint.config');
20+
21+
module.exports = {
22+
...baseConfig,
23+
env: {
24+
node: true,
25+
},
26+
};

examples/bunyan/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const log = bunyan.createLogger({ name: 'myapp', level: 'debug' });
2828
log.debug({ foo: 'bar' }, 'hi');
2929

3030
const tracer = otel.trace.getTracer('example');
31-
tracer.startActiveSpan('manual-span', (span) => {
31+
tracer.startActiveSpan('manual-span', span => {
3232
log.info('this record will have trace_id et al fields for the current span');
3333
span.end();
3434
});

examples/bunyan/app.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
import { trace } from '@opentelemetry/api';
2222
import bunyan from 'bunyan';
2323

24-
const log = bunyan.createLogger({name: 'myapp', level: 'debug'});
24+
const log = bunyan.createLogger({ name: 'myapp', level: 'debug' });
2525

26-
log.debug({foo: 'bar'}, 'hi');
26+
log.debug({ foo: 'bar' }, 'hi');
2727

2828
const tracer = trace.getTracer('example');
2929
tracer.startActiveSpan('manual-span', span => {
3030
log.info('this record will have trace_id et al fields for the current span');
3131
span.end();
3232
});
33-

examples/bunyan/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"version": "0.1.0",
55
"description": "Example of Bunyan integration with OpenTelemetry",
66
"scripts": {
7+
"lint": "eslint . --ext=ts,js,mjs",
8+
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
79
"start": "node -r ./telemetry.js app.js"
810
},
911
"repository": {

examples/bunyan/telemetry.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@
2323
// for viewing and analysis.
2424

2525
const { NodeSDK, tracing, logs } = require('@opentelemetry/sdk-node');
26-
const { envDetector, hostDetector, processDetector } = require('@opentelemetry/resources');
26+
const {
27+
envDetector,
28+
hostDetector,
29+
processDetector,
30+
} = require('@opentelemetry/resources');
2731
// api.diag.setLogger(new api.DiagConsoleLogger(), api.DiagLogLevel.DEBUG);
2832

29-
const { BunyanInstrumentation } = require('@opentelemetry/instrumentation-bunyan');
33+
const {
34+
BunyanInstrumentation,
35+
} = require('@opentelemetry/instrumentation-bunyan');
3036

3137
const sdk = new NodeSDK({
3238
serviceName: 'bunyan-example',
@@ -40,18 +46,20 @@ const sdk = new NodeSDK({
4046
// default detector of the `NodeSDK`.
4147
hostDetector,
4248
],
43-
spanProcessor: new tracing.SimpleSpanProcessor(new tracing.ConsoleSpanExporter()),
44-
logRecordProcessor: new logs.SimpleLogRecordProcessor(new logs.ConsoleLogRecordExporter()),
45-
instrumentations: [
46-
new BunyanInstrumentation(),
47-
],
49+
spanProcessor: new tracing.SimpleSpanProcessor(
50+
new tracing.ConsoleSpanExporter()
51+
),
52+
logRecordProcessor: new logs.SimpleLogRecordProcessor(
53+
new logs.ConsoleLogRecordExporter()
54+
),
55+
instrumentations: [new BunyanInstrumentation()],
4856
});
4957
process.on('SIGTERM', () => {
5058
sdk
5159
.shutdown()
5260
.then(
5361
() => {},
54-
(err) => console.log('warning: error shutting down OTel SDK', err),
62+
err => console.log('warning: error shutting down OTel SDK', err)
5563
)
5664
.finally(() => process.exit(0));
5765
});

0 commit comments

Comments
 (0)