// 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 20 02:07:02 UTC 2036"),
commandType: "EXAMPLE-commandType-Value",
totalRows: 248,
perfSchemaUsedPercent: 486,
schemaName: "EXAMPLE-schemaName-Value",
execCount: 913,
totalLatencyInPs: 261,
lockLatencyInPs: 881,
errCount: 772,
warnCount: 777,
rowsAffected: 491,
rowsSent: 647,
rowsExamined: 920,
tmpDiskTables: 283,
tmpTables: 501,
selectFullJoin: 497,
selectFullRangeJoin: 629,
selectRange: 843,
selectRangeCheck: 727,
selectScan: 941,
sortMergePasses: 210,
sortRange: 766,
rowsSorted: 285,
sortScan: 236,
noIndexUsedCount: 822,
noGoodIndexUsedCount: 277,
cpuLatencyInPs: 992,
maxControlledMemoryInBytes: 684,
maxTotalMemoryInBytes: 92,
execCountSecondary: 18,
timeFirstSeen: new Date("Mon Mar 20 12:02:12 UTC 2000"),
timeLastSeen: new Date("Tue Apr 09 08:09:23 UTC 2024"),
}
],
}
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: "TQWDHNMG8ZH8GOKXHGQ1<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);
}
})();