Skip to content

Commit 4308ee1

Browse files
committed
Merge branch 'main' into sqs-batch-receive
2 parents 2ae3ff2 + 8a93515 commit 4308ee1

File tree

136 files changed

+4395
-3346
lines changed

Some content is hidden

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

136 files changed

+4395
-3346
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ If possible, provide a recipe for reproducing the error.
3131
Add any other context about the problem here.
3232
-->
3333

34+
<sub>**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>

.github/ISSUE_TEMPLATE/discussion.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ labels: discussion
1111
- [ ] This only affects the JavaScript OpenTelemetry library
1212
- [ ] This may affect other libraries, but I would like to get opinions here first
1313

14+
<sub>**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>
15+

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ A clear and concise description of any alternative solutions or features you've
3131
Add any other context or screenshots about the feature request here.
3232
-->
3333

34+
<sub>**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>
35+

.github/ISSUE_TEMPLATE/instrumentation_request.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ Any code-owners listed MUST fulfill all criteria laid out in the checklist below
3434
<!--
3535
Add any other context or screenshots about the instrumentation request here. Is there a reference you could point for the well-defined lifecycle methods?
3636
-->
37+
38+
<sub>**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>

.github/ISSUE_TEMPLATE/ownership_request.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ Examples:
3838
<!--
3939
Add any other context that does not fit any of the above sections
4040
-->
41+
42+
<sub>**Tip**: [React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>

.release-please-manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"packages/resource-detector-github": "0.31.0",
88
"packages/resource-detector-instana": "0.22.0",
99
"packages/auto-configuration-propagators": "0.4.1",
10-
"packages/auto-instrumentations-node": "0.62.0",
10+
"packages/auto-instrumentations-node": "0.62.1",
1111
"packages/auto-instrumentations-web": "0.49.0",
1212
"packages/baggage-span-processor": "0.4.0",
1313
"packages/baggage-log-record-processor": "0.4.0",
@@ -17,21 +17,21 @@
1717
"packages/redis-common": "0.38.0",
1818
"packages/sql-common": "0.41.0",
1919
"packages/contrib-test-utils": "0.49.0",
20-
"packages/winston-transport": "0.14.0",
20+
"packages/winston-transport": "0.14.1",
2121
"packages/instrumentation-amqplib": "0.50.0",
22-
"packages/instrumentation-cucumber": "0.18.0",
23-
"packages/instrumentation-dataloader": "0.21.0",
22+
"packages/instrumentation-cucumber": "0.18.1",
23+
"packages/instrumentation-dataloader": "0.21.1",
2424
"packages/instrumentation-fs": "0.23.0",
25-
"packages/instrumentation-kafkajs": "0.12.0",
25+
"packages/instrumentation-kafkajs": "0.13.0",
2626
"packages/instrumentation-lru-memoizer": "0.48.0",
2727
"packages/instrumentation-mongoose": "0.50.0",
28-
"packages/instrumentation-runtime-node": "0.17.0",
28+
"packages/instrumentation-runtime-node": "0.17.1",
2929
"packages/instrumentation-socket.io": "0.50.0",
3030
"packages/instrumentation-tedious": "0.22.0",
3131
"packages/instrumentation-typeorm": "0.4.0",
3232
"packages/instrumentation-undici": "0.14.0",
3333
"packages/instrumentation-aws-lambda": "0.54.0",
34-
"packages/instrumentation-aws-sdk": "0.56.0",
34+
"packages/instrumentation-aws-sdk": "0.57.0",
3535
"packages/instrumentation-bunyan": "0.49.0",
3636
"packages/instrumentation-cassandra-driver": "0.49.0",
3737
"packages/instrumentation-connect": "0.47.0",
@@ -47,16 +47,16 @@
4747
"packages/instrumentation-memcached": "0.47.0",
4848
"packages/instrumentation-mongodb": "0.56.0",
4949
"packages/instrumentation-mysql": "0.49.0",
50-
"packages/instrumentation-mysql2": "0.49.0",
50+
"packages/instrumentation-mysql2": "0.50.0",
5151
"packages/instrumentation-nestjs-core": "0.49.0",
5252
"packages/instrumentation-net": "0.47.0",
5353
"packages/instrumentation-oracledb": "0.29.0",
54-
"packages/instrumentation-pg": "0.55.0",
54+
"packages/instrumentation-pg": "0.56.0",
5555
"packages/instrumentation-pino": "0.50.0",
5656
"packages/instrumentation-redis": "0.51.0",
5757
"packages/instrumentation-restify": "0.49.0",
5858
"packages/instrumentation-router": "0.48.0",
59-
"packages/instrumentation-winston": "0.48.0",
59+
"packages/instrumentation-winston": "0.48.1",
6060
"packages/instrumentation-document-load": "0.48.0",
6161
"packages/instrumentation-long-task": "0.48.0",
6262
"packages/instrumentation-user-interaction": "0.48.0",

CONTRIBUTING.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The required steps to start development on a pacakge are:
117117

118118
- `npm ci` from root folder to install dependencies ([see npm-ci docs](https://docs.npmjs.com/cli/v10/commands/npm-ci))
119119
- `cd` into the pacakge you want to apply changes.
120-
- `npm run setup:dev` compiles the TypeScript files for this package and its dependencies within the repository.
120+
- `npm run compile:with-dependencies` compiles the TypeScript files for this package and its dependencies within the repository.
121121

122122
Then you can proceed to do apply the changes and use the scripts below for development workflow
123123

@@ -146,23 +146,21 @@ npm test
146146
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:
147147

148148
```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
149+
npm run test-services:start # starts services in Docker
150+
npm run test:with-services-env # runs 'npm test' with envvars from test/test-services.env
151+
npm run test-services:stop # stops services in Docker
152152
```
153153

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.
154+
If you only want to test a single package that dfepends on a service (e.g. the `instrumentation-mongodb`) you can `cd` into it and
155+
use the same scripts for testing. In this case the script will only start the services needed to test the package.
155156

156157
```sh
157-
npm run test-services:start # starts services in Docker
158-
cd packages/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
158+
cd packages/instrumentation-mongodb # get into the instrumenation folder
159+
npm run test-services:start # start the MongoDB service in Docker
160+
npm run test:with-services-env # runs 'npm test' with envvars from test/test-services.env
161+
npm run test-services:stop # stop MongoDB service in Docker
162162
```
163163

164-
NOTE: scripts for each package will be added to avoid extra consumption of resources and improve the development experience.
165-
166164
### Benchmarks
167165

168166
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.

incubator/opentelemetry-sampler-aws-xray/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
],
2929
"repository": "open-telemetry/opentelemetry-js-contrib",
3030
"scripts": {
31-
"setup:dev": "nx run-many -t compile -p @opentelemetry/sampler-aws-xray",
31+
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
3232
"compile": "tsc -p .",
33+
"compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/sampler-aws-xray",
3334
"lint": "eslint . --ext .ts",
3435
"lint:fix": "eslint . --ext .ts --fix",
35-
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
3636
"prepublishOnly": "npm run compile",
3737
"tdd": "npm run test -- --watch-extensions ts --watch",
3838
"test": "nyc mocha 'test/**/*.test.ts'",

incubator/opentelemetry-sampler-aws-xray/src/aws-xray-sampling-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AWSXRaySamplingClient {
4545
this.makeSamplingRequest<GetSamplingTargetsResponse>(
4646
this.samplingTargetsEndpoint,
4747
callback,
48-
this.samplerDiag.debug,
48+
(message: string) => this.samplerDiag.debug(message),
4949
JSON.stringify(requestBody)
5050
);
5151
}
@@ -56,7 +56,7 @@ export class AWSXRaySamplingClient {
5656
this.makeSamplingRequest<GetSamplingRulesResponse>(
5757
this.getSamplingRulesEndpoint,
5858
callback,
59-
this.samplerDiag.error
59+
(message: string) => this.samplerDiag.error(message)
6060
);
6161
}
6262

incubator/opentelemetry-sampler-aws-xray/src/fallback-sampler.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,20 @@
2121
import { Attributes, Context, Link, SpanKind } from '@opentelemetry/api';
2222
import {
2323
Sampler,
24+
SamplingDecision,
2425
SamplingResult,
2526
TraceIdRatioBasedSampler,
2627
} from '@opentelemetry/sdk-trace-base';
28+
import { RateLimitingSampler } from './rate-limiting-sampler';
2729

2830
// FallbackSampler samples 1 req/sec and additional 5% of requests using TraceIdRatioBasedSampler.
2931
export class FallbackSampler implements Sampler {
3032
private fixedRateSampler: TraceIdRatioBasedSampler;
33+
private rateLimitingSampler: RateLimitingSampler;
3134

32-
constructor() {
33-
this.fixedRateSampler = new TraceIdRatioBasedSampler(0.05);
35+
constructor(ratio = 0.05, quota = 1) {
36+
this.fixedRateSampler = new TraceIdRatioBasedSampler(ratio);
37+
this.rateLimitingSampler = new RateLimitingSampler(quota);
3438
}
3539

3640
shouldSample(
@@ -41,7 +45,19 @@ export class FallbackSampler implements Sampler {
4145
attributes: Attributes,
4246
links: Link[]
4347
): SamplingResult {
44-
// TODO: implement and use Rate Limiting Sampler
48+
const samplingResult: SamplingResult =
49+
this.rateLimitingSampler.shouldSample(
50+
context,
51+
traceId,
52+
spanName,
53+
spanKind,
54+
attributes,
55+
links
56+
);
57+
58+
if (samplingResult.decision !== SamplingDecision.NOT_RECORD) {
59+
return samplingResult;
60+
}
4561

4662
return this.fixedRateSampler.shouldSample(context, traceId);
4763
}

0 commit comments

Comments
 (0)