Skip to content

Commit

Permalink
chore: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
david-luna committed Jan 24, 2025
1 parent dedcb81 commit 135b19d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
16 changes: 7 additions & 9 deletions packages/opentelemetry-node/test/fixtures/use-graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
const otel = require('@opentelemetry/api');
const graphql = require('graphql');


async function main() {
const { schema, source } = setup();
const result = await graphql.graphql({ schema, source })
console.dir(result, {depth:9});
const {schema, source} = setup();
const result = await graphql.graphql({schema, source});
console.dir(result, {depth: 9});
}

const tracer = otel.trace.getTracer('test');
Expand All @@ -35,7 +34,6 @@ tracer.startActiveSpan('manual-parent-span', async (span) => {
span.end();
});


// hrlper functions
function setup() {
const Todo = new graphql.GraphQLObjectType({
Expand All @@ -61,21 +59,21 @@ function setup() {
todo: {
type: Todo,
args: {
id: { type: graphql.GraphQLInt },
id: {type: graphql.GraphQLInt},
},
resolve(obj, args, context) {
return Promise.resolve({ id: args.id, desc: 'todo desc' });
return Promise.resolve({id: args.id, desc: 'todo desc'});
},
},
},
});
const schema = new graphql.GraphQLSchema({ query });
const schema = new graphql.GraphQLSchema({query});
const source = `
query {
todo (id: 0) {
desc
}
}
`;
return { schema, source };
return {schema, source};
}
9 changes: 7 additions & 2 deletions packages/opentelemetry-node/test/instr-graphql.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Test that instrumentation-graphql generates the telemetry we expect.

const test = require('tape');
const {filterOutDnsNetSpans, runTestFixtures} = require('./testutils');
const {runTestFixtures} = require('./testutils');

/** @type {import('./testutils').TestFixture[]} */
const testFixtures = [
Expand All @@ -44,7 +44,12 @@ const testFixtures = [
const spans = col.sortedSpans.slice(1);
t.equal(spans.length, 5);

t.ok(spans.every(s => s.scope.name, '@opentelemetry/instrumentation-graphql'))
t.ok(
spans.every(
(s) => s.scope.name,
'@opentelemetry/instrumentation-graphql'
)
);
t.equal(spans[0].name, 'graphql.parse');
t.equal(spans[1].name, 'graphql.validate');
t.equal(spans[2].name, 'query');
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-node/test/testutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function assertDeepMatch(t, actual, expected, msgPrefix = 'obj') {
* Eventually it would be preferable to have each test run with instr-dns
* and instr-net turned off, if that is what they want to test.
*
* @param {CollectedSpan[]} spans
* @param {CollectedSpan[]} spans
* @returns {CollectedSpan[]}
*/
function filterOutDnsNetSpans(spans) {
Expand Down

0 comments on commit 135b19d

Please sign in to comment.