Skip to content

Commit 67f6a33

Browse files
authored
chore(instrumentation-mysql): update metric names to semconv METRIC_* exports (#3128)
1 parent 5a37dcd commit 67f6a33

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/instrumentation-mysql/src/instrumentation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
DB_SYSTEM_VALUE_MYSQL,
3232
ATTR_DB_STATEMENT,
3333
ATTR_DB_SYSTEM,
34+
METRIC_DB_CLIENT_CONNECTIONS_USAGE,
3435
} from './semconv';
3536
import type * as mysqlTypes from 'mysql';
3637
import { AttributeNames } from './AttributeNames';
@@ -63,7 +64,7 @@ export class MySQLInstrumentation extends InstrumentationBase<MySQLInstrumentati
6364

6465
protected override _updateMetricInstruments() {
6566
this._connectionsUsage = this.meter.createUpDownCounter(
66-
'db.client.connections.usage', //TODO:: use semantic convention
67+
METRIC_DB_CLIENT_CONNECTIONS_USAGE,
6768
{
6869
description:
6970
'The number of connections that are currently in state described by the state attribute.',

packages/instrumentation-mysql/src/semconv.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,13 @@ export const ATTR_NET_PEER_PORT = 'net.peer.port' as const;
106106
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
107107
*/
108108
export const DB_SYSTEM_VALUE_MYSQL = 'mysql' as const;
109+
110+
/**
111+
* Deprecated, use `db.client.connection.count` instead.
112+
*
113+
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
114+
*
115+
* @deprecated Replaced by `db.client.connection.count`.
116+
*/
117+
export const METRIC_DB_CLIENT_CONNECTIONS_USAGE =
118+
'db.client.connections.usage' as const;

0 commit comments

Comments
 (0)