Skip to content

Commit 6a07e55

Browse files
committed
Inline more constants; fix failing tests
1 parent 514a1d5 commit 6a07e55

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

plugins/node/opentelemetry-instrumentation-pg/src/semantic-conventions.ts

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,44 @@
2424
*
2525
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
2626
*/
27-
export declare const METRIC_DB_CLIENT_CONNECTION_COUNT: 'db.client.connection.count';
27+
export const METRIC_DB_CLIENT_CONNECTION_COUNT = 'db.client.connection.count';
2828

2929
/**
3030
* The number of pending requests for an open connection, cumulative for the entire pool
3131
*
3232
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
3333
*/
34-
export declare const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS: 'db.client.connection.pending_requests';
34+
export const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS =
35+
'db.client.connection.pending_requests';
36+
37+
/**
38+
* The name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn't provide a name, instrumentation **SHOULD** use a combination of parameters that would make the name unique, for example, combining attributes `server.address`, `server.port`, and `db.namespace`, formatted as `server.address:server.port/db.namespace`. Instrumentations that generate connection pool name following different patterns **SHOULD** document it.
39+
*
40+
* @example myDataSource
41+
*
42+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
43+
*/
44+
export const ATTR_DB_CLIENT_CONNECTION_POOL_NAME =
45+
'db.client.connection.pool.name';
46+
47+
/**
48+
* The state of a connection in the pool
49+
*
50+
* @example idle
51+
*
52+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
53+
*/
54+
export const ATTR_DB_CLIENT_CONNECTION_STATE = 'db.client.connection.state';
55+
56+
/**
57+
* Enum value "idle" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}.
58+
*/
59+
export const DB_CLIENT_CONNECTION_STATE_VALUE_IDLE = 'idle';
60+
61+
/**
62+
* Enum value "used" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}.
63+
*/
64+
export const DB_CLIENT_CONNECTION_STATE_VALUE_USED = 'used';
3565

3666
/**
3767
* Duration of database client operations.
@@ -40,7 +70,8 @@ export declare const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS: 'db.client.co
4070
*
4171
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
4272
*/
43-
export declare const METRIC_DB_CLIENT_OPERATION_DURATION: 'db.client.operation.duration';
73+
export const METRIC_DB_CLIENT_OPERATION_DURATION =
74+
'db.client.operation.duration';
4475

4576
/**
4677
* The name of the database, fully qualified within the server address and port.
@@ -55,7 +86,7 @@ export declare const METRIC_DB_CLIENT_OPERATION_DURATION: 'db.client.operation.d
5586
*
5687
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
5788
*/
58-
export declare const ATTR_DB_NAMESPACE: 'db.namespace';
89+
export const ATTR_DB_NAMESPACE = 'db.namespace';
5990

6091
/**
6192
* The name of the operation or command being executed.
@@ -72,4 +103,4 @@ export declare const ATTR_DB_NAMESPACE: 'db.namespace';
72103
*
73104
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
74105
*/
75-
export declare const ATTR_DB_OPERATION_NAME: 'db.operation.name';
106+
export const ATTR_DB_OPERATION_NAME = 'db.operation.name';

plugins/node/opentelemetry-instrumentation-pg/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
ATTR_DB_CLIENT_CONNECTION_STATE,
4343
DB_CLIENT_CONNECTION_STATE_VALUE_USED,
4444
DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,
45-
} from '@opentelemetry/semantic-conventions/incubating';
45+
} from './semantic-conventions';
4646
import {
4747
PgClientExtended,
4848
PostgresCallback,

0 commit comments

Comments
 (0)