// 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).
import * as opsi from "oci-opsi";
import common = require("oci-common");
// 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.
const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();
(async () => {
try {
// Create a service client
const client = new opsi.OperationsInsightsClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const ingestMySqlSqlStatsDetails = {
items: [{
digest: "EXAMPLE-digest-Value",
timeCollected: new Date("Sat Sep 26 02:53:30 UTC 2026"),
commandType: "EXAMPLE-commandType-Value",
totalRows: 833,
perfSchemaUsedPercent: 129,
schemaName: "EXAMPLE-schemaName-Value",
execCount: 915,
totalLatencyInPs: 796,
lockLatencyInPs: 530,
errCount: 248,
warnCount: 96,
rowsAffected: 737,
rowsSent: 820,
rowsExamined: 505,
tmpDiskTables: 662,
tmpTables: 322,
selectFullJoin: 256,
selectFullRangeJoin: 480,
selectRange: 639,
selectRangeCheck: 487,
selectScan: 809,
sortMergePasses: 431,
sortRange: 376,
rowsSorted: 157,
sortScan: 807,
noIndexUsedCount: 160,
noGoodIndexUsedCount: 193,
cpuLatencyInPs: 208,
maxControlledMemoryInBytes: 701,
maxTotalMemoryInBytes: 80,
execCountSecondary: 996,
timeFirstSeen: new Date("Thu Nov 09 04:09:17 UTC 2006"),
timeLastSeen: new Date("Fri Dec 11 09:13:12 UTC 2043"),
}
],
}
const ingestMySqlSqlStatsRequest: opsi.requests.IngestMySqlSqlStatsRequest = {
ingestMySqlSqlStatsDetails: ingestMySqlSqlStatsDetails,
databaseId: "ocid1.test.oc1..<unique_ID>EXAMPLE-databaseId-Value",
id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
opcRequestId: "BM83LDPPKFKGALVM3GPD<unique_ID>",
ifMatch: "EXAMPLE-ifMatch-Value",
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
};
// Send request to the Client.
const ingestMySqlSqlStatsResponse = await client.ingestMySqlSqlStats(ingestMySqlSqlStatsRequest);
}
catch (error) {
console.log("ingestMySqlSqlStats Failed with error " + error);
}
})();