// This is an automatically generated code sample. 
// To make this code sample work in your Oracle Cloud tenancy, 
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and 
// boolean, number, and enum parameters with values not fitting your use case).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.OpsiService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Opsi
{
    public class IngestMySqlSqlStatsExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var ingestMySqlSqlStatsDetails = new Oci.OpsiService.Models.IngestMySqlSqlStatsDetails
			{
				Items = new List<Oci.OpsiService.Models.MySqlSqlStats>
				{
					new Oci.OpsiService.Models.MySqlSqlStats
					{
						Digest = "EXAMPLE-digest-Value",
						TimeCollected = DateTime.Parse("11/08/2006 23:11:26"),
						CommandType = "EXAMPLE-commandType-Value",
						TotalRows = 122,
						PerfSchemaUsedPercent = 343,
						SchemaName = "EXAMPLE-schemaName-Value",
						ExecCount = 316,
						TotalLatencyInPs = 160,
						LockLatencyInPs = 400,
						ErrCount = 641,
						WarnCount = 401,
						RowsAffected = 241,
						RowsSent = 956,
						RowsExamined = 499,
						TmpDiskTables = 907,
						TmpTables = 174,
						SelectFullJoin = 546,
						SelectFullRangeJoin = 268,
						SelectRange = 360,
						SelectRangeCheck = 493,
						SelectScan = 674,
						SortMergePasses = 958,
						SortRange = 709,
						RowsSorted = 697,
						SortScan = 230,
						NoIndexUsedCount = 467,
						NoGoodIndexUsedCount = 858,
						CpuLatencyInPs = 196,
						MaxControlledMemoryInBytes = 181,
						MaxTotalMemoryInBytes = 157,
						ExecCountSecondary = 213,
						TimeFirstSeen = DateTime.Parse("01/03/2028 20:29:47"),
						TimeLastSeen = DateTime.Parse("07/09/2026 20:49:15")
					}
				}
			};
			var ingestMySqlSqlStatsRequest = new Oci.OpsiService.Requests.IngestMySqlSqlStatsRequest
			{
				IngestMySqlSqlStatsDetails = ingestMySqlSqlStatsDetails,
				DatabaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
				Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
				OpcRequestId = "SED9ZAOBD0L9XJ5HZNLR<unique_ID>",
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
			};

            // Create a default authentication provider that uses the DEFAULT
            // profile in the configuration file.
            // Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new OperationsInsightsClient(provider, new ClientConfiguration()))
				{
					var response = await client.IngestMySqlSqlStats(ingestMySqlSqlStatsRequest);
					// Retrieve value from the response.
					var messageValue = response.IngestMySqlSqlStatsResponseDetails.Message;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"IngestMySqlSqlStats Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?