MySql.Data.OpenTelemetry
8.3.0
Prefix Reserved
See the version list below for details.
dotnet add package MySql.Data.OpenTelemetry --version 8.3.0
NuGet\Install-Package MySql.Data.OpenTelemetry -Version 8.3.0
<PackageReference Include="MySql.Data.OpenTelemetry" Version="8.3.0" />
paket add MySql.Data.OpenTelemetry --version 8.3.0
#r "nuget: MySql.Data.OpenTelemetry, 8.3.0"
// Install MySql.Data.OpenTelemetry as a Cake Addin #addin nuget:?package=MySql.Data.OpenTelemetry&version=8.3.0 // Install MySql.Data.OpenTelemetry as a Cake Tool #tool nuget:?package=MySql.Data.OpenTelemetry&version=8.3.0
About
MySQL provides connectivity for client applications developed in .NET compatible programming languages with MySQL Connector/NET through a series of packages.
MySql.Data.OpenTelemetry activates telemetry capabilities when the target MySQL server is configured to support telemetry. It is compatible with .NET 6.0+ and must be used alongside the MySql.Data package. An OpenTelemetry SDK is required.
More information at [MySQL Connector/NET documentation] (https://dev.mysql.com/doc/connector-net/en/).
How to use
//create the tracer provider and add Connector/NET as a source from telemetry data.
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddConnectorNet()
.ConfigureResource(resource => resource.AddService("connector-net"))
.Build();
//use MySql.Data as usual, the internal implementation of OpenTelemetry is now enabled.
MySql.Data.MySqlClient.MySqlConnection myConnection;
string myConnectionString;
//set the correct values for your server, user, password and database name
myConnectionString = "server=127.0.0.1;uid=root;pwd=12345;database=test";
try
{
myConnection = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
//open a connection
myConnection.Open();
// create a MySQL command and set the SQL statement with parameters
MySqlCommand myCommand = new MySqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = @"SELECT * FROM clients WHERE client_id = @clientId;";
myCommand.Parameters.AddWithValue("@clientId", clientId);
// execute the command and read the results
using var myReader = myCommand.ExecuteReader()
{
while (myReader.Read())
{
var id = myReader.GetInt32("client_id");
var name = myReader.GetString("client_name");
// ...
}
}
myConnection.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show(ex.Message);
}
Related Packages
- Core package: MySql.Data
- Entity Framework Core: MySql.EntityFrameworkCore
- Entity Framework: MySql.Data.EntityFramework
- Web: MySql.Web
Contributing
There are a few ways to contribute to the Connector/NET code. Please refer to the contributing guidelines for additional information.
Additional Resources
- MySQL
- MySQL Connector/NET GitHub
- MySQL Connector/NET API
- MySQL Connector/NET Discussion Forum
- MySQL Public Bug Tracker
#connectors
channel in MySQL Community Slack (Sign-up required when not using an Oracle account)- For more information about this and other MySQL products, please visit MySQL Contact & Questions.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MySql.Data.OpenTelemetry:
Package | Downloads |
---|---|
Grafana.OpenTelemetry.Base
Minimal Grafana distribution of OpenTelemetry .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.