Skip to content

Commit f61c339

Browse files
authored
Merge branch 'main' into trentm-redis-consolidation-alt
2 parents f8e7b93 + c8fa46d commit f61c339

Some content is hidden

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

107 files changed

+2050
-4830
lines changed

examples/dns/.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/dns/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/dns/client.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
'use strict';
218

319
const api = require('@opentelemetry/api');
@@ -28,8 +44,12 @@ function makeLookup() {
2844
// The process must live for at least the interval past any traces that
2945
// must be exported, or some risk being lost if they are recorded after the
3046
// last export.
31-
console.log('Sleeping 5 seconds before shutdown to ensure all records are flushed.');
32-
setTimeout(() => { console.log('Completed.'); }, 5000);
47+
console.log(
48+
'Sleeping 5 seconds before shutdown to ensure all records are flushed.'
49+
);
50+
setTimeout(() => {
51+
console.log('Completed.');
52+
}, 5000);
3353
}
3454

3555
makeLookup();

examples/dns/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"description": "Example of DNS integration with OpenTelemetry",
66
"main": "index.js",
77
"scripts": {
8+
"lint": "eslint . --ext=ts,js,mjs",
9+
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
810
"zipkin:client": "cross-env EXPORTER=zipkin node ./client.js",
911
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js"
1012
},

examples/dns/tracer.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
'use strict';
218

319
const opentelemetry = require('@opentelemetry/api');
@@ -10,7 +26,7 @@ const { registerInstrumentations } = require('@opentelemetry/instrumentation');
1026

1127
const EXPORTER = process.env.EXPORTER || '';
1228

13-
module.exports = (serviceName) => {
29+
module.exports = serviceName => {
1430
let exporter;
1531
if (EXPORTER.toLowerCase().startsWith('z')) {
1632
exporter = new ZipkinExporter({
@@ -23,9 +39,7 @@ module.exports = (serviceName) => {
2339
}
2440

2541
const provider = new NodeTracerProvider({
26-
spanProcessors: [
27-
new SimpleSpanProcessor(exporter),
28-
],
42+
spanProcessors: [new SimpleSpanProcessor(exporter)],
2943
});
3044

3145
// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings

examples/fastify/.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/fastify/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

examples/fastify/client.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
'use strict';
218

319
const api = require('@opentelemetry/api');

examples/fastify/opentelemetry.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
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+
117
'use strict';
218

3-
const {
4-
diag,
5-
DiagConsoleLogger,
6-
DiagLogLevel,
7-
} = require('@opentelemetry/api');
19+
const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
820

921
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.WARN);
1022

1123
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
12-
const { FastifyInstrumentation } = require('@opentelemetry/instrumentation-fastify');
24+
const {
25+
FastifyInstrumentation,
26+
} = require('@opentelemetry/instrumentation-fastify');
1327

14-
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto');
15-
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto');
28+
const {
29+
OTLPTraceExporter,
30+
} = require('@opentelemetry/exporter-trace-otlp-proto');
31+
const {
32+
OTLPMetricExporter,
33+
} = require('@opentelemetry/exporter-metrics-otlp-proto');
1634
const { NodeSDK, metrics } = require('@opentelemetry/sdk-node');
1735

1836
const sdk = new NodeSDK({
19-
instrumentations: [
20-
HttpInstrumentation,
21-
new FastifyInstrumentation(),
22-
],
37+
instrumentations: [HttpInstrumentation, new FastifyInstrumentation()],
2338
traceExporter: new OTLPTraceExporter(),
2439
metricReader: new metrics.PeriodicExportingMetricReader({
2540
exporter: new OTLPMetricExporter(),

0 commit comments

Comments
 (0)