# 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('2018-08-01T22:48:04.114Z'),
          command_type: 'EXAMPLE-commandType-Value',
          total_rows: 743,
          perf_schema_used_percent: 630,
          schema_name: 'EXAMPLE-schemaName-Value',
          exec_count: 59,
          total_latency_in_ps: 319,
          lock_latency_in_ps: 734,
          err_count: 356,
          warn_count: 968,
          rows_affected: 733,
          rows_sent: 120,
          rows_examined: 502,
          tmp_disk_tables: 388,
          tmp_tables: 949,
          select_full_join: 199,
          select_full_range_join: 333,
          select_range: 580,
          select_range_check: 785,
          select_scan: 409,
          sort_merge_passes: 64,
          sort_range: 253,
          rows_sorted: 349,
          sort_scan: 716,
          no_index_used_count: 247,
          no_good_index_used_count: 446,
          cpu_latency_in_ps: 717,
          max_controlled_memory_in_bytes: 244,
          max_total_memory_in_bytes: 845,
          exec_count_secondary: 847,
          time_first_seen: DateTime.parse('2043-01-02T12:27:43.358Z'),
          time_last_seen: DateTime.parse('2002-02-12T20:56:55.656Z')
        )
      ]
    )
  )

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

Was this article helpful?