Knowing When Things Break Before Users Tell You
OCI Monitoring collects performance metrics from all OCI resources. For application developers, the most relevant metrics come from Autonomous Database, Compute instances running ORDS, Load Balancers, and Object Storage. Setting up alarms on these metrics provides early warning of performance degradation and outages.
Key Metrics to Monitor
Autonomous Database: CPU utilization (sustained high CPU indicates query optimization needed), storage utilization (plan capacity before you run out), session count (detect connection leaks), and SQL statement execution time (identify performance regressions).
ORDS / Compute: CPU and memory utilization, network throughput, and disk IOPS. Load Balancer: Request count, error rate (4xx and 5xx responses), backend health, and latency. Object Storage: Request count and first-byte latency.
Creating an Alarm
In the OCI Console, navigate to Monitoring, then Alarms. Create a new alarm specifying the metric, statistic, threshold, and notification topic:
Metric: CpuUtilization (oci_autonomous_database). Statistic: Mean over 5 minutes. Condition: Greater than 80%. Notification: Send to the “ops-team” topic which delivers email and Slack notifications.
Custom Application Metrics
Publish your own metrics from PL/SQL using the OCI Monitoring API through APEX_WEB_SERVICE. Track application-specific measurements like orders processed per minute, API response times, or queue depths:
-- Publish a custom metric from PL/SQL
DECLARE
l_payload CLOB;
BEGIN
l_payload := '[{"namespace":"custom_app","compartmentId":"ocid1...","name":"orders_per_minute","dimensions":{"app":"order_system"},"datapoints":[{"timestamp":"' || TO_CHAR(SYSTIMESTAMP,'YYYY-MM-DD"T"HH24:MI:SS"Z"') || '","value":' || l_order_count || '}]}]';
APEX_WEB_SERVICE.MAKE_REST_REQUEST(
p_url => 'https://telemetry-ingestion.us-ashburn-1.oraclecloud.com/20180401-/metrics',
p_http_method => 'POST',
p_body => l_payload,
p_credential_static_id => 'OCI_MONITORING_CRED'
);
END;
Logging
OCI Logging aggregates logs from all services. Enable audit logging for security events, enable service logs for ORDS and database, and send custom application logs using the OCI Logging API. Use Log Analytics to search, filter, and analyze logs across all your services from a single dashboard.