Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"dependencies": {
"@opentelemetry/core": "^1.26.0",
"@opentelemetry/instrumentation": "^0.57.0",
"@opentelemetry/semantic-conventions": "1.27.0",
"@opentelemetry/semantic-conventions": "^1.27.0",
"@opentelemetry/sql-common": "^0.40.1",
"@types/pg": "8.6.1",
"@types/pg-pool": "2.0.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
METRIC_DB_CLIENT_OPERATION_DURATION,
ATTR_DB_NAMESPACE,
ATTR_DB_OPERATION_NAME,
} from '@opentelemetry/semantic-conventions/incubating';
} from './semconv';

export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConfig> {
private _operationDuration!: Histogram;
Expand Down
28 changes: 28 additions & 0 deletions plugins/node/opentelemetry-instrumentation-pg/src/semconv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const ATTR_DB_CLIENT_CONNECTION_POOL_NAME =
'db.client.connection.pool.name';
export const ATTR_DB_CLIENT_CONNECTION_STATE = 'db.client.connection.state';
export const ATTR_DB_NAMESPACE = 'db.namespace';
export const ATTR_DB_OPERATION_NAME = 'db.operation.name';
export const DB_CLIENT_CONNECTION_STATE_VALUE_USED = 'used';
export const DB_CLIENT_CONNECTION_STATE_VALUE_IDLE = 'idle';
export const METRIC_DB_CLIENT_CONNECTION_COUNT = 'db.client.connection.count';
export const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS =
'db.client.connection.pending_requests';
export const METRIC_DB_CLIENT_OPERATION_DURATION =
'db.client.operation.duration';
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
ATTR_DB_CLIENT_CONNECTION_STATE,
DB_CLIENT_CONNECTION_STATE_VALUE_USED,
DB_CLIENT_CONNECTION_STATE_VALUE_IDLE,
} from '@opentelemetry/semantic-conventions/incubating';
} from './semconv';
import {
PgClientExtended,
PostgresCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
METRIC_DB_CLIENT_CONNECTION_COUNT,
METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS,
METRIC_DB_CLIENT_OPERATION_DURATION,
} from '@opentelemetry/semantic-conventions/incubating';
} from '../src/semconv';

const memoryExporter = new InMemorySpanExporter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
import {
METRIC_DB_CLIENT_OPERATION_DURATION,
ATTR_DB_OPERATION_NAME,
} from '@opentelemetry/semantic-conventions/incubating';
} from '../src/semconv';
import { addSqlCommenterComment } from '@opentelemetry/sql-common';

const memoryExporter = new InMemorySpanExporter();
Expand Down
Loading