diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md index f68e4c49d4..b6fa12db57 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md @@ -30,11 +30,13 @@ for the same information. Note that `server.address` is only included when the `EnableConnectionLevelAttributes` option is enabled. ([#2229](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2229)) -* When `EnableConnectionLevelAttributes` is enabled, the `server.port` attribute - will now be written as an integer to be compliant with the - [semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/server.md). +* **Breaking change**: When `EnableConnectionLevelAttributes` is enabled, the + `server.port` attribute will now be written as an integer to be compliant with + the [semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/server.md). Previously, it was written as a string. ([#2233](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2233)) +* The `EnableConnectionLevelAttributes` option is now enabled by default. + ([#2249](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2249)) ## 1.9.0-beta.1 diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/README.md b/src/OpenTelemetry.Instrumentation.SqlClient/README.md index f5fe916ac3..e1c15c28c7 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/README.md +++ b/src/OpenTelemetry.Instrumentation.SqlClient/README.md @@ -165,13 +165,13 @@ command text will be captured. > [!NOTE] > EnableConnectionLevelAttributes is supported on all runtimes. -By default, `EnabledConnectionLevelAttributes` is disabled. -If `EnabledConnectionLevelAttributes` is enabled, +By default, `EnabledConnectionLevelAttributes` is enabled. +When `EnabledConnectionLevelAttributes` is enabled, the [`DataSource`](https://docs.microsoft.com/dotnet/api/system.data.common.dbconnection.datasource) will be parsed and the server name or IP address will be sent as the `server.address` attribute, the instance name will be sent as the `db.mssql.instance_name` attribute, and the port will be sent as the -`net.peer.port` attribute if it is not 1433 (the default port). +`server.port` attribute if it is not 1433 (the default port). The following example shows how to use `EnableConnectionLevelAttributes`. diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientTraceInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientTraceInstrumentationOptions.cs index 48b69212e9..dd7b38eb0e 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientTraceInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientTraceInstrumentationOptions.cs @@ -81,21 +81,20 @@ internal SqlClientTraceInstrumentationOptions(IConfiguration configuration) /// cref="SqlClientInstrumentation"/> should parse the DataSource on a /// SqlConnection into server name, instance name, and/or port /// connection-level attribute tags. Default value: . + /// langword="true"/>. /// /// /// /// EnableConnectionLevelAttributes is supported on all runtimes. /// /// - /// The default behavior is to set the SqlConnection DataSource as the tag. /// If enabled, SqlConnection DataSource will be parsed and the server name will be sent as the - /// or tag, + /// tag, /// the instance name will be sent as the tag, /// and the port will be sent as the tag if it is not 1433 (the default port). /// /// - public bool EnableConnectionLevelAttributes { get; set; } + public bool EnableConnectionLevelAttributes { get; set; } = true; /// /// Gets or sets an action to enrich an with the