// 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).
package main
import (
"context"
"fmt"
"time"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
"github.com/oracle/oci-go-sdk/v65/opsi"
)
func ExampleIngestHostMetrics() {
// 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.
client, err := opsi.NewOperationsInsightsClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := opsi.IngestHostMetricsRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
Id: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value"),
IfMatch: common.String("EXAMPLE-ifMatch-Value"),
IngestHostMetricsDetails: opsi.IngestHostMetricsDetails{Items: []opsi.HostPerformanceMetricGroup{opsi.HostGpuUsage{PowerDraw: common.Float64(5697.0938),
ClockEventAppClockSetting: common.Int(465),
ClockSpeedMemory: common.Float64(8976.08),
EccDoubleBitErrors: common.Int(178),
FanUtilization: common.Float64(5546.7354),
ClockEventHwThermalSlowDown: common.Int(649),
ClockEventSwPowerCap: common.Int(251),
ClockSpeedVideo: common.Float64(1440.8767),
GpuId: common.Int(792),
Temperature: common.Float64(4078.881),
TimeCollected: &common.SDKTime{Time: time.Now()},
ClockSpeedGraphics: common.Float64(2890.0486),
ClockSpeedSm: common.Float64(548.8366),
EccSingleBitErrors: common.Int(0),
PerformanceState: common.Float64(582.1955),
Utilization: common.Float64(3868.1948),
ClockEventHwPowerBreak: common.Int(626),
ClockEventIdle: common.Int(795),
ClockEventSwThermalSlowdown: common.Int(504),
ClockEventSyncBoost: common.Int(511),
MemoryUtilization: common.Float64(1063.6317)}}},
OpcRequestId: common.String("CTWEAKI0PCH7Y8EC20IZ<unique_ID>")}
// Send the request using the service client
resp, err := client.IngestHostMetrics(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}