Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions examples/.eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion examples/connect/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line import/order
const tracing = require('./tracing')('example-connect-client');

const { tracer } = tracing;
Expand Down
2 changes: 0 additions & 2 deletions examples/connect/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line
const tracing = require('./tracing')('example-connect-server');

// Require in rest of modules
Expand All @@ -27,7 +26,6 @@ const axios = require('axios');
const app = connect();
const PORT = 8080;

// eslint-disable-next-line prefer-arrow-callback
app.use(function middleware1(req, res, next) {
next();
});
Expand Down
1 change: 0 additions & 1 deletion examples/dns/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

const api = require('@opentelemetry/api');
const tracer = require('./tracer')('example-dns');
// eslint-disable-next-line import/order
const dns = require('dns').promises;

/** A function which makes a dns lookup and handles response. */
Expand Down
1 change: 0 additions & 1 deletion examples/express/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

// eslint-disable-next-line import/order, import/extensions
import { setupTracing } from './tracer';

import * as api from '@opentelemetry/api';
Expand Down
1 change: 0 additions & 1 deletion examples/express/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

// eslint-disable-next-line import/order, import/extensions
import { setupTracing } from './tracer';

// Require in rest of modules
Expand All @@ -30,7 +29,7 @@

const getCrudController = () => {
const router = express.Router();
const resources: any[] = [];

Check warning on line 32 in examples/express/src/server.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
router.get('/', (req, res) => res.send(resources));
router.post('/', (req, res) => {
resources.push(req.body);
Expand Down
1 change: 0 additions & 1 deletion examples/express/src/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';

// eslint-disable-next-line import/prefer-default-export
export const setupTracing = (serviceName: string) => {
const exporter = new OTLPTraceExporter({});
const provider = new NodeTracerProvider({
Expand Down
2 changes: 0 additions & 2 deletions examples/fastify/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line
const api = require('@opentelemetry/api');
const tracer = api.trace.getTracer('fastify-server');
const Fastify = require('fastify');
Expand All @@ -32,7 +31,6 @@ async function subsystem(fastify) {
span.setAttribute('order', 2);
});

// eslint-disable-next-line prefer-arrow-callback
fastify.addHook('onRequest', async function onRequestHook() {
const span = api.trace.getSpan(api.context.active());
span.setAttribute('order', 3);
Expand Down
2 changes: 2 additions & 0 deletions examples/graphql/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

/* eslint-disable no-unused-vars */

'use strict';

const https = require('https');
Expand Down
1 change: 0 additions & 1 deletion examples/grpc-census-prop/capitalize_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'use strict';

const api = require('@opentelemetry/api');
/* eslint-disable global-require */
const binaryPropagator = process.env.BINARY_PROPAGATOR === 'true';
const censusTracer = process.env.CENSUS_TRACER === 'true';
let tracer;
Expand Down
1 change: 0 additions & 1 deletion examples/grpc-census-prop/capitalize_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

/* eslint-disable global-require */
const binaryPropagator = process.env.BINARY_PROPAGATOR === 'true';
const censusTracer = process.env.CENSUS_TRACER === 'true';

Expand Down
1 change: 0 additions & 1 deletion examples/hapi/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line import/order
const tracer = require('./tracer')('example-hapi-client');

const api = require('@opentelemetry/api');
Expand Down
1 change: 0 additions & 1 deletion examples/hapi/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
const api = require('@opentelemetry/api');
require('./tracer')('example-hapi-server');

// eslint-disable-next-line
const Hapi = require('@hapi/hapi');

const PORT = 8081;
Expand Down
1 change: 0 additions & 1 deletion examples/koa/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as api from '@opentelemetry/api';
import * as axios from 'axios';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

const tracer = setupTracing('example-koa-client');
Expand Down
1 change: 0 additions & 1 deletion examples/koa/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import * as api from '@opentelemetry/api';
// Adding Koa router (if desired)
import * as Router from '@koa/router';
import * as Koa from 'koa';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

setupTracing('example-koa-server');
Expand Down
1 change: 0 additions & 1 deletion examples/koa/src/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';

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

// eslint-disable-next-line import/prefer-default-export
export const setupTracing = (serviceName: string) => {
let exporter;
if (EXPORTER === 'jaeger') {
Expand Down
1 change: 0 additions & 1 deletion examples/meta-node/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line import/order
const tracer = require('./tracer')('example-express-client');
const api = require('@opentelemetry/api');
const axios = require('axios').default;
Expand Down
1 change: 0 additions & 1 deletion examples/meta-node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

'use strict';

// eslint-disable-next-line
require('./tracer')('example-meta-node');

// Require in rest of modules
Expand Down
1 change: 0 additions & 1 deletion examples/mongodb/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as api from '@opentelemetry/api';
import * as http from 'http';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

const tracer = setupTracing('example-mongodb-http-client');
Expand All @@ -40,7 +39,7 @@
path: '/collection/',
},
response => {
const body: any = [];

Check warning on line 42 in examples/mongodb/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -59,7 +58,7 @@
path: '/insert/',
},
response => {
const body: any = [];

Check warning on line 61 in examples/mongodb/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -78,7 +77,7 @@
path: '/get/',
},
response => {
const body: any = [];

Check warning on line 80 in examples/mongodb/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand Down
2 changes: 0 additions & 2 deletions examples/mongodb/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import * as http from 'http';
import { IncomingMessage, ServerResponse } from 'http';
import * as mongodb from 'mongodb';
import { Collection } from 'mongodb';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';
// eslint-disable-next-line import/extensions
import { accessDB } from './utils';

setupTracing('example-mongodb-server');
Expand Down
1 change: 0 additions & 1 deletion examples/mongodb/src/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';

// eslint-disable-next-line import/prefer-default-export
export const setupTracing = (serviceName: string): api.Tracer => {
const provider = new NodeTracerProvider({
resource: new Resource({
Expand Down
1 change: 0 additions & 1 deletion examples/mongodb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
* @param dbName The mongodb database name.
* @param options The mongodb client config options.
*/
// eslint-disable-next-line import/prefer-default-export
export function accessDB(
url: string,
dbName: string,
options: mongodb.MongoClientOptions = {}

Check warning on line 28 in examples/mongodb/src/utils.ts

View workflow job for this annotation

GitHub Actions / build

'options' is assigned a value but never used
): Promise<mongodb.Db> {
return new Promise((resolve, reject) => {
mongodb.MongoClient.connect(url, {
Expand Down
1 change: 0 additions & 1 deletion examples/mysql/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as api from '@opentelemetry/api';
import * as http from 'http';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

const tracer = setupTracing('example-mysql-client');
Expand All @@ -40,7 +39,7 @@
path: '/connection/query',
},
response => {
const body: any[] = [];

Check warning on line 42 in examples/mysql/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -59,7 +58,7 @@
path: '/pool/query',
},
response => {
const body: any[] = [];

Check warning on line 61 in examples/mysql/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -78,7 +77,7 @@
path: '/pool/query-with-2-connections',
},
response => {
const body: any[] = [];

Check warning on line 80 in examples/mysql/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -97,7 +96,7 @@
path: '/pool/query-2-pools',
},
response => {
const body: any[] = [];

Check warning on line 99 in examples/mysql/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand All @@ -116,7 +115,7 @@
path: '/cluster/query',
},
response => {
const body: any[] = [];

Check warning on line 118 in examples/mysql/src/client.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
response.on('data', chunk => body.push(chunk));
response.on('end', () => {
responses += 1;
Expand Down
1 change: 0 additions & 1 deletion examples/mysql/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import * as api from '@opentelemetry/api';
import * as mysql from 'mysql';
import * as http from 'http';
import { MysqlError, PoolConnection } from 'mysql';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

setupTracing('example-mysql-server');
Expand Down
1 change: 0 additions & 1 deletion examples/mysql/src/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const {

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

// eslint-disable-next-line import/prefer-default-export
export const setupTracing = (serviceName: string) => {
// metrics:
const metricExporter = new OTLPMetricExporter();
Expand Down
1 change: 1 addition & 0 deletions examples/react-load/preact/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ module.exports = {
...baseConfig,
env: {
browser: true,
node: true,
},
};
1 change: 0 additions & 1 deletion examples/react-load/preact/src/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Content extends BaseOpenTelemetryComponent {
};
}

// eslint-disable-next-line class-methods-use-this
componentDidMount() {
// Example, do something here
}
Expand Down
1 change: 0 additions & 1 deletion examples/react-load/preact/src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Link } from 'preact-router/match';
import { BaseOpenTelemetryComponent } from '@opentelemetry/plugin-react-load';

class Home extends BaseOpenTelemetryComponent {
// eslint-disable-next-line class-methods-use-this
render() {
return (
<div>
Expand Down
1 change: 1 addition & 0 deletions examples/react-load/react/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ module.exports = {
...baseConfig,
env: {
browser: true,
node: true,
},
};
1 change: 0 additions & 1 deletion examples/redis/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as api from '@opentelemetry/api';
import * as axios from 'axios';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';

const tracer = setupTracing('example-redis-client');
Expand Down
3 changes: 0 additions & 3 deletions examples/redis/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
import * as express from 'express';
import * as axios from 'axios';
import { randomBytes } from 'crypto';
// eslint-disable-next-line import/extensions
import { setupTracing } from './tracer';
// eslint-disable-next-line import/extensions
import * as tracerHandlers from './express-tracer-handlers';

const tracer = setupTracing('example-redis-server');
// eslint-disable-next-line import/extensions
const { redisPromise } = require('./setup-redis');

// Setup express
Expand Down
1 change: 0 additions & 1 deletion examples/redis/src/setup-redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { createClient } from 'redis';

const client = createClient('redis://localhost:6379');
// eslint-disable-next-line import/prefer-default-export
export const redisPromise = new Promise((resolve, reject) => {
client.once('ready', () => {
resolve(client);
Expand Down
1 change: 0 additions & 1 deletion examples/redis/src/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';

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

// eslint-disable-next-line import/prefer-default-export
export const setupTracing = (serviceName: string) => {
let exporter;
if (EXPORTER.toLowerCase().startsWith('z')) {
Expand Down
1 change: 0 additions & 1 deletion examples/router/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

// required to initialize the service name for the auto-instrumentation
require('./tracer')('example-client');
// eslint-disable-next-line import/order
const http = require('http');

/** A function which makes requests and handles response. */
Expand Down
3 changes: 0 additions & 3 deletions examples/router/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,15 @@ router.param('name', (req, res, next, name) => {
next();
});

// eslint-disable-next-line prefer-arrow-callback
router.get('/hello/:name', function greetingHandler(req, res) {
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
res.end(`Hello, ${req.params.name}!`);
});

// eslint-disable-next-line prefer-arrow-callback
router.get('/err', function erroringRoute(req, res, next) {
next(new Error('Broken!'));
});

// eslint-disable-next-line prefer-arrow-callback, func-names
const server = http.createServer(function (req, res) {
router(req, res, error => {
if (error) {
Expand Down
1 change: 1 addition & 0 deletions examples/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ module.exports = {
...baseConfig,
env: {
browser: true,
node: true,
},
};
1 change: 0 additions & 1 deletion examples/web/examples/document-load/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const tracer = provider.getTracer('example-document-load');

const getData = url =>
new Promise((resolve, reject) => {
// eslint-disable-next-line no-undef
const req = new XMLHttpRequest();
req.open('GET', url, true);
req.send();
Expand Down
3 changes: 1 addition & 2 deletions examples/web/examples/meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function btnAddClick() {
}

function prepareClickEvents() {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < 5; i++) {
btnAddClick();
}
Expand Down Expand Up @@ -106,7 +105,7 @@ function onClick(navigate) {
}

function getData(url) {
return new Promise((resolve, _reject) => {
return new Promise(resolve => {
const req = new XMLHttpRequest();
req.open('GET', url, true);
req.setRequestHeader('Content-Type', 'application/json');
Expand Down
3 changes: 1 addition & 2 deletions examples/web/examples/user-interaction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function btnAddClick() {
}

function prepareClickEvents() {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < 5; i++) {
btnAddClick();
}
Expand Down Expand Up @@ -107,7 +106,7 @@ function onClick(navigate) {
}

function getData(url) {
return new Promise((resolve, _reject) => {
return new Promise(resolve => {
const req = new XMLHttpRequest();
req.open('GET', url, true);
req.setRequestHeader('Content-Type', 'application/json');
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"test-services:stop": "docker compose -f ./test/docker-compose.yaml down",
"test:with-services-env": "cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test",
"changelog": "lerna-changelog",
"lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps",
"lint": "nx run-many -t lint && npm run lint:deps && npm run lint:readme && npm run lint:markdown && npm run lint:semconv-deps && npm run lint:examples",
"lint:fix": "nx run-many -t lint:fix && npm run lint:markdown:fix",
"lint:deps": "npx --yes [email protected] --dependencies --production --tags=-knipignore",
"lint:examples": "eslint ./examples/**/*.js",
"lint:examples:fix": "eslint ./examples/**/*.js --fix",
"lint:examples": "./scripts/npm-run-in-examples.js --if-present lint",
"lint:examples:fix": "./scripts/npm-run-in-examples.js --if-present lint:fix",
"lint:markdown": "markdownlint-cli2 $(git ls-files '*.md')",
"lint:markdown:fix": "markdownlint-cli2 --fix $(git ls-files '*.md')",
"lint:readme": "nx run-many -t lint:readme",
Expand Down
Loading