# 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).

require 'date'
require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
opsi_client = OCI::Opsi::OperationsInsightsClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
ingest_my_sql_sql_stats_response =
  opsi_client.ingest_my_sql_sql_stats(
    OCI::Opsi::Models::IngestMySqlSqlStatsDetails.new(
      items: [
        OCI::Opsi::Models::MySqlSqlStats.new(
          digest: 'EXAMPLE-digest-Value',
          time_collected: DateTime.parse('2009-03-28T09:34:32.497Z'),
          command_type: 'EXAMPLE-commandType-Value',
          total_rows: 561,
          perf_schema_used_percent: 648,
          schema_name: 'EXAMPLE-schemaName-Value',
          exec_count: 238,
          total_latency_in_ps: 754,
          lock_latency_in_ps: 132,
          err_count: 622,
          warn_count: 440,
          rows_affected: 214,
          rows_sent: 458,
          rows_examined: 249,
          tmp_disk_tables: 952,
          tmp_tables: 140,
          select_full_join: 537,
          select_full_range_join: 902,
          select_range: 248,
          select_range_check: 351,
          select_scan: 37,
          sort_merge_passes: 188,
          sort_range: 708,
          rows_sorted: 49,
          sort_scan: 281,
          no_index_used_count: 873,
          no_good_index_used_count: 192,
          cpu_latency_in_ps: 943,
          max_controlled_memory_in_bytes: 230,
          max_total_memory_in_bytes: 243,
          exec_count_secondary: 259,
          time_first_seen: DateTime.parse('2024-11-30T10:25:46.541Z'),
          time_last_seen: DateTime.parse('2013-10-27T11:27:36.587Z')
        )
      ]
    )
  )

# Get the data from response
puts "#{ingest_my_sql_sql_stats_response.data}"