// 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("Sun Dec 23 10:09:56 UTC 2001"),
commandType: "EXAMPLE-commandType-Value",
totalRows: 625,
perfSchemaUsedPercent: 979,
schemaName: "EXAMPLE-schemaName-Value",
execCount: 768,
totalLatencyInPs: 759,
lockLatencyInPs: 919,
errCount: 412,
warnCount: 743,
rowsAffected: 609,
rowsSent: 648,
rowsExamined: 492,
tmpDiskTables: 803,
tmpTables: 320,
selectFullJoin: 611,
selectFullRangeJoin: 602,
selectRange: 131,
selectRangeCheck: 891,
selectScan: 615,
sortMergePasses: 15,
sortRange: 193,
rowsSorted: 852,
sortScan: 978,
noIndexUsedCount: 796,
noGoodIndexUsedCount: 752,
cpuLatencyInPs: 961,
maxControlledMemoryInBytes: 118,
maxTotalMemoryInBytes: 43,
execCountSecondary: 247,
timeFirstSeen: new Date("Mon Feb 16 18:27:24 UTC 2004"),
timeLastSeen: new Date("Tue Oct 30 03:24:50 UTC 2018"),
}
],
}
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: "0J9XNBZNAEHMWVLVVCVC<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);
}
})();