Skip to content

Commit d61e27a

Browse files
authored
chore(instrumentation-mongodb): update metric names to semconv METRIC_* exports (#3127)
1 parent ead2797 commit d61e27a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/instrumentation-mongodb/src/instrumentation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
ATTR_NET_PEER_NAME,
3838
ATTR_NET_PEER_PORT,
3939
DB_SYSTEM_VALUE_MONGODB,
40+
METRIC_DB_CLIENT_CONNECTIONS_USAGE,
4041
} from './semconv';
4142
import { MongoDBInstrumentationConfig, CommandResult } from './types';
4243
import {
@@ -74,7 +75,7 @@ export class MongoDBInstrumentation extends InstrumentationBase<MongoDBInstrumen
7475

7576
override _updateMetricInstruments() {
7677
this._connectionsUsage = this.meter.createUpDownCounter(
77-
'db.client.connections.usage',
78+
METRIC_DB_CLIENT_CONNECTIONS_USAGE,
7879
{
7980
description:
8081
'The number of connections that are currently in state described by the state attribute.',

packages/instrumentation-mongodb/src/semconv.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,13 @@ export const ATTR_NET_PEER_PORT = 'net.peer.port' as const;
118118
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
119119
*/
120120
export const DB_SYSTEM_VALUE_MONGODB = 'mongodb' as const;
121+
122+
/**
123+
* Deprecated, use `db.client.connection.count` instead.
124+
*
125+
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
126+
*
127+
* @deprecated Replaced by `db.client.connection.count`.
128+
*/
129+
export const METRIC_DB_CLIENT_CONNECTIONS_USAGE =
130+
'db.client.connections.usage' as const;

0 commit comments

Comments
 (0)