@@ -25,7 +25,6 @@ import {
2525 trace ,
2626 diag ,
2727} from '@opentelemetry/api' ;
28- import { AttributeNames } from './constants' ;
2928import {
3029 SEMATTRS_DB_SYSTEM ,
3130 SEMATTRS_DB_NAME ,
@@ -39,6 +38,9 @@ import {
3938 DBSYSTEMVALUES_ORACLE ,
4039} from '@opentelemetry/semantic-conventions' ;
4140import * as oracledbTypes from 'oracledb' ;
41+
42+ // Local modules.
43+ import { AttributeNames } from './constants' ;
4244import { OracleInstrumentationConfig , SpanConnectionConfig } from './types' ;
4345import { TraceSpanData , SpanCallLevelConfig } from './internal-types' ;
4446import { SpanNames } from './constants' ;
@@ -114,7 +116,7 @@ export class OracleTelemetryTraceHandler extends newmoduleExports.traceHandler
114116 return convertedValues ;
115117 }
116118 } catch ( e ) {
117- diag . error ( 'failed to stringify ' , values , e ) ;
119+ diag . error ( 'failed to stringify bind values: ' , values , e ) ;
118120 }
119121 return convertedValues ;
120122 }
@@ -196,7 +198,7 @@ export class OracleTelemetryTraceHandler extends newmoduleExports.traceHandler
196198 roundTrip = false
197199 ) {
198200 const span = traceContext . userContext . span ;
199- // Set if addtional connection and call parameters
201+ // Set if additional connection and call parameters
200202 // are available
201203 if ( traceContext . connectLevelConfig ) {
202204 span . setAttributes (
@@ -236,17 +238,14 @@ export class OracleTelemetryTraceHandler extends newmoduleExports.traceHandler
236238 }
237239
238240 const spanName = traceContext . operation ;
239- let spanAttrs = { } ;
240- if ( traceContext . connectLevelConfig ) {
241- spanAttrs = this . _getConnectionSpanAttributes (
242- traceContext . connectLevelConfig
243- ) ;
244- }
241+ const spanAttributes = traceContext . connectLevelConfig
242+ ? this . _getConnectionSpanAttributes ( traceContext . connectLevelConfig )
243+ : { } ;
245244
246245 traceContext . userContext = {
247246 span : this . _tracer . startSpan ( spanName , {
248247 kind : SpanKind . CLIENT ,
249- attributes : spanAttrs ,
248+ attributes : spanAttributes ,
250249 } ) ,
251250 } ;
252251
@@ -258,15 +257,11 @@ export class OracleTelemetryTraceHandler extends newmoduleExports.traceHandler
258257 ) ;
259258 }
260259
261- switch ( traceContext . operation ) {
262- case SpanNames . EXECUTE :
263- this . _handleExecuteCustomRequest (
264- traceContext . userContext . span ,
265- traceContext
266- ) ;
267- break ;
268- default :
269- break ;
260+ if ( traceContext . operation === SpanNames . EXECUTE ) {
261+ this . _handleExecuteCustomRequest (
262+ traceContext . userContext . span ,
263+ traceContext
264+ ) ;
270265 }
271266 }
272267
0 commit comments