Skip to content

Commit

Permalink
fix(instr-knex): set correct SpanKind for traces (#2157)
Browse files Browse the repository at this point in the history
Co-authored-by: Amir Blum <amirgiraffe@gmail.com>
  • Loading branch information
david-luna and blumamir committed Apr 29, 2024
1 parent b40926e commit 2d07c18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -160,6 +160,7 @@ export class KnexInstrumentation extends InstrumentationBase {
const span = instrumentation.tracer.startSpan(
utils.getName(name, operation, table),
{
kind: api.SpanKind.CLIENT,
attributes,
},
parent
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { context, trace } from '@opentelemetry/api';
import { SpanKind, context, trace } from '@opentelemetry/api';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import {
Expand Down Expand Up @@ -471,6 +471,7 @@ const assertSpans = (actualSpans: any[], expectedSpans: any[]) => {
try {
assert.notStrictEqual(span, undefined);
assert.notStrictEqual(expected, undefined);
assert.strictEqual(span.kind, SpanKind.CLIENT);
assertMatch(span.name, new RegExp(expected.op));
assertMatch(span.name, new RegExp(':memory:'));
assert.strictEqual(span.attributes['db.system'], 'sqlite');
Expand Down

0 comments on commit 2d07c18

Please sign in to comment.