@@ -49,10 +49,12 @@ dotnet add package --prerelease OpenTelemetry.Instrumentation.SqlClient
4949
5050SqlClient instrumentation must be enabled at application startup.
5151
52- The following example demonstrates adding SqlClient instrumentation to a console
53- application. This example also sets up the OpenTelemetry Console exporter, which
54- requires adding the package
55- [ ` OpenTelemetry.Exporter.Console ` ] ( ../OpenTelemetry.Exporter.Console/README.md )
52+ #### Traces
53+
54+ The following example demonstrates adding SqlClient traces instrumentation
55+ to a console application. This example also sets up the OpenTelemetry Console
56+ exporter, which requires adding the package
57+ [ ` OpenTelemetry.Exporter.Console ` ] ( https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.Console/README.md )
5658to the application.
5759
5860``` csharp
@@ -70,13 +72,50 @@ public class Program
7072}
7173```
7274
75+ #### Metrics
76+
77+ The following example demonstrates adding SqlClient metrics instrumentation
78+ to a console application. This example also sets up the OpenTelemetry Console
79+ exporter, which requires adding the package
80+ [ ` OpenTelemetry.Exporter.Console ` ] ( https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.Console/README.md )
81+ to the application.
82+
83+ ``` csharp
84+ using OpenTelemetry .Metrics ;
85+
86+ public class Program
87+ {
88+ public static void Main (string [] args )
89+ {
90+ using var tracerProvider = Sdk .CreateMeterProviderBuilder ()
91+ .AddSqlClientInstrumentation ()
92+ .AddConsoleExporter ()
93+ .Build ();
94+ }
95+ }
96+ ```
97+
98+ ##### List of metrics produced
99+
100+ The instrumentation is implemented based on [ metrics semantic
101+ conventions] ( https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/database/database-metrics.md#database-operation ) .
102+ Currently, the instrumentation supports the following metric.
103+
104+ | Name | Instrument Type | Unit | Description |
105+ | -------| -----------------| ------| -------------|
106+ | ` db.client.operation.duration ` | Histogram | ` s ` | Duration of database client operations. |
107+
108+ #### ASP.NET Core
109+
73110For an ASP.NET Core application, adding instrumentation is typically done in the
74111` ConfigureServices ` of your ` Startup ` class. Refer to documentation for
75112[ OpenTelemetry.Instrumentation.AspNetCore] ( ../OpenTelemetry.Instrumentation.AspNetCore/README.md ) .
76113
114+ #### ASP.NET
115+
77116For an ASP.NET application, adding instrumentation is typically done in the
78117` Global.asax.cs ` . Refer to the documentation for
79- [ OpenTelemetry.Instrumentation.AspNet] ( https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src /OpenTelemetry.Instrumentation.AspNet/README.md) .
118+ [ OpenTelemetry.Instrumentation.AspNet] ( .. /OpenTelemetry.Instrumentation.AspNet/README.md) .
80119
81120## Advanced configuration
82121
0 commit comments