
Creating a Query for Generative AI Metrics

Creating a Query for Generative AI
 Metrics
By using the OCI Monitoring service, you can create
 custom queries and trigger alarms to monitor the OCI
Generative AI dedicated AI clusters and endpoints.
 Note
To get permission to work with the Monitoring service
 resources, ask an administrator to review the IAM policies in Securing Monitoring and grant you the proper access for your
 role.
For permission to work with Generative AI resources,
 ask an administrator to give you access to Generative AI
 resources.
 Important In the Monitoring service, to add Generative AI resources to queries or alarms, select the
 namespace, oci_generativeai and refer to Monitoring Query Language (MQL) Reference
 for the query syntax.
ConsoleCLIAPI
In the navigation bar of the Console, select a region with Generative AI, for example, US Midwest
 (Chicago) or UK South (London). See which models are offered in your
 region.
Open the navigation menu and click Observability & Management. Under Monitoring, click Service Metrics. 
Select a compartment that has the Generative AI resources that you want to monitor.
For Metric namespace, select
 oci_generativeai.
A metric namespace is the service or application that emits the metrics. The metric
 namespace for the Generative AI service is
 oci_generativeai.
The Service Metrics page dynamically updates the page to show
 charts for the oci_generativeai metric namespace. See Viewing Default Metric Charts for a Metric Namespace (Multiple Resources).
To create a query, follow the steps in Creating a Query.
(Optional) 
 To create an alarm, follow the steps in Creating a Basic Alarm.
Use the oci monitoring metric-data summarize-metrics-data command and required parameters to query metric data:
oci monitoring metric-data summarize-metrics-data [OPTIONS]
When specifying a dimension value within the query (--query-text), surround it with double quotes, and escape each double quote with a backslash character (\). Example:
oci monitoring metric-data summarize-metrics-data --compartment-id <compartment_OCID> --namespace oci_computeagent --query-text "CpuUtilization[1m]{resourceId = \"<instance_OCID>\"}.max()"
For a complete list of parameters and values for CLI commands, see the Command Line Reference for Monitoring.
Use the oci monitoring alarm create command and required parameters to create an alarm:
oci monitoring alarm create --compartment-id <compartment_OCID> --destinations <file_or_text> --display-name <name> --is-enabled <true_or_false> --metric-compartment-id <compartment_OCID> --namespace <metric_namespace> --query-text <mql_expression> --severity <level>
For a complete list of parameters and values for CLI commands, see the Command Line Reference for Monitoring.
Refer to the Monitoring API for using the Monitoring service APIs.
For example, run the SummarizeMetricsDataDetails
 operation to query metric data and CreateAlarm to create
 an alarm.
For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.
