Skip to content

Commit

Permalink
fix(mysql*,*redis): net.peer.ip -> db.connection_string
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Feb 21, 2022
1 parent d3883d3 commit de67ae5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class IORedisInstrumentation extends InstrumentationBase<
span.setAttributes({
[SemanticAttributes.NET_PEER_NAME]: host,
[SemanticAttributes.NET_PEER_PORT]: port,
[SemanticAttributes.NET_PEER_IP]: `redis://${host}:${port}`,
[SemanticAttributes.DB_CONNECTION_STRING]: `redis://${host}:${port}`,
});

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const DEFAULT_ATTRIBUTES = {
[SemanticAttributes.DB_SYSTEM]: IORedisInstrumentation.DB_SYSTEM,
[SemanticAttributes.NET_PEER_NAME]: CONFIG.host,
[SemanticAttributes.NET_PEER_PORT]: CONFIG.port,
[SemanticAttributes.NET_PEER_IP]: URL,
[SemanticAttributes.DB_CONNECTION_STRING]: URL,
};

const unsetStatus: SpanStatus = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export function getConnectionAttributes(
return {
[SemanticAttributes.NET_PEER_NAME]: host,
[SemanticAttributes.NET_PEER_PORT]: port,
[SemanticAttributes.NET_PEER_IP]: getJDBCString(host, port, database),
[SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString(
host,
port,
database
),
[SemanticAttributes.DB_NAME]: database,
[SemanticAttributes.DB_USER]: user,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export function getConnectionAttributes(config: Config): SpanAttributes {
return {
[SemanticAttributes.NET_PEER_NAME]: host,
[SemanticAttributes.NET_PEER_PORT]: port,
[SemanticAttributes.NET_PEER_IP]: getJDBCString(host, port, database),
[SemanticAttributes.DB_CONNECTION_STRING]: getJDBCString(
host,
port,
database
),
[SemanticAttributes.DB_NAME]: database,
[SemanticAttributes.DB_USER]: user,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const getTracedInternalSendCommand = (
}
if (this.address) {
span.setAttribute(
SemanticAttributes.NET_PEER_IP,
SemanticAttributes.DB_CONNECTION_STRING,
`redis://${this.address}`
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const DEFAULT_ATTRIBUTES = {
[SemanticAttributes.DB_SYSTEM]: RedisInstrumentation.COMPONENT,
[SemanticAttributes.NET_PEER_NAME]: CONFIG.host,
[SemanticAttributes.NET_PEER_PORT]: CONFIG.port,
[SemanticAttributes.NET_PEER_IP]: URL,
[SemanticAttributes.DB_CONNECTION_STRING]: URL,
};

const unsetStatus: SpanStatus = {
Expand Down

0 comments on commit de67ae5

Please sign in to comment.