Why we built this

OCI Monitoring is very good at one thing: noticing when a metric crosses a line. On a large, shared GoldenGate fleet, that's only the start of the job. The person on call also needs to know which customer is affected, whether this is new or something that's been open for hours, and whether someone stopped the process on purpose.

Our fleet has more than a hundred OCI GoldenGate deployments and several hundred Extracts, Replicats and paths, spread across regions. Some customers have processes on more than one deployment, and some deployments serve several customers. When a source database goes down for patching, dozens of processes can stop at once, and plain alarms turn that into dozens of separate messages.

So we built a thin, event-driven layer on top of the native services. It doesn't replace OCI Monitoring. It takes what Monitoring and Events already produce, adds context and memory, and decides what's worth telling a human. Everything runs on managed OCI services, with no servers to patch and nothing polling on a timer.

This post walks through each service we used, what job it does in the design, and why we picked it. If you run any kind of shared data platform on OCI, most of this pattern will carry over.

The architecture at a glance

Three kinds of signal go into one stream, one function decides what each signal means, and two NoSQL tables give that function its memory.

Architecture showing Monitoring alarms, Events rules and scheduled checks feeding OCI Streaming, with Connector Hub, an OCI Functions router, NoSQL state tables and Notifications topics.
One regional stack built with managed OCI services.

OCI Monitoring alarms watch the native GoldenGate metrics. OCI Events rules catch deployment lifecycle changes. A small scheduled function runs custom checks that the native metrics don't cover. All three write to the same OCI Streaming stream. Connector Hub reads that stream and hands batches to a single OCI Functions router. The router looks up ownership and policy in one NoSQL table, reads and updates alert state in a second one, and publishes to OCI Notifications. A second internal stream lets the router hold related alerts briefly so it can send them together.

We run one copy of this stack per region. The two NoSQL tables are Global Active tables, so every region sees the same configuration and the same alert history.

1. OCI Monitoring: one alarm covers the whole fleet

OCI Monitoring is the detector. It keeps evaluating the native GoldenGate metrics for us, so we never write polling code of our own.

OCI GoldenGate publishes its metrics in the oci_goldengate namespace. The ones we lean on most are ExtractLag, ReplicatLag and HeartbeatLag (in seconds), ExtractStatus and ReplicatStatus (100 when running, 0 when stopped or abended), and deployment-level signals such as DeploymentHealth and CPU. The GoldenGate metrics reference lists them all.

Four alarm settings made the design work:

  • Compartment scope, no per-process filters. One ReplicatLag alarm watches every Replicat in the compartment. A new deployment is covered the day it's created, and nobody has to remember to add an alarm for it.
  • Split notifications per metric stream. With this on, you get a separate message for each firing metric stream instead of one combined message for the whole alarm. Each message carries the dimensions, such as the Replicat name and deployment, so the router knows exactly which process fired. (docs)
  • A stream as the destination. Alarms can send straight to OCI Streaming, and Oracle's own guidance is to choose Streaming if you expect more than 60 messages a minute. (docs) A fleet-wide outage easily beats that.
  • Raw message format. Raw JSON is the easiest thing for code to read. For split messages, the dedupekey field identifies the alarm and the metric stream, which gives the router a stable identity to work with. (docs)

Here's roughly what one of our alarms looks like from the CLI:

oci monitoring alarm create \
  --compartment-id "$ALARM_COMPARTMENT" \
  --metric-compartment-id "$GG_COMPARTMENT" \
  --display-name "gg-fleet-replicat-lag" \
  --namespace oci_goldengate \
  --query-text 'ReplicatLag[1m].mean() > 120' \
  --severity WARNING \
  --pending-duration PT5M \
  --is-notifications-per-metric-dimension-enabled true \
  --message-format RAW \
  --repeat-notification-duration PT1H \
  --destinations '["<ingress-stream-ocid>"]' \
  --is-enabled true

Two tips from running this. First, set the alarm threshold to the lowest severity tier the router cares about, and let the router apply the stricter tiers. If the alarm threshold is higher than the router's lowest tier, the alarm sends OK while the router still thinks the problem is open. Second, turn on repeat notifications. A problem that lasts all day only produces one FIRING message otherwise, and the router has nothing to base a reminder on.

How it helps: you get fleet-wide detection from a handful of alarms instead of hundreds, and Oracle runs the evaluation engine.

2. OCI Events: knowing when a deployment changes state

Metrics tell you how a process is doing. Events tell you that something happened to the deployment itself, such as it failing, needing attention, or going inactive.

OCI GoldenGate deployments emit lifecycle events like com.oraclecloud.goldengate.statefailed, com.oraclecloud.goldengate.stateneedsattention, com.oraclecloud.goldengate.stateinactive and com.oraclecloud.goldengate.stateactive, along with create, update and backup events. The GoldenGate events reference has the full list.

The usual pattern is a rule that sends one event type straight to an email topic. We did something different. Our rule sends every deployment event to the same ingress stream the alarms use, and nothing is filtered out at the rule. A condition along these lines does it:

{
  "eventType": [
    "com.oraclecloud.goldengate.statefailed",
    "com.oraclecloud.goldengate.stateneedsattention",
    "com.oraclecloud.goldengate.stateinactive",
    "com.oraclecloud.goldengate.stateactive",
    "com.oraclecloud.goldengate.stateupdating"
  ]
}

(Our real rule lists every deployment event type, not just these five.)

Why capture everything? Because deciding what matters is the router's job, not the rule's. A policy record in NoSQL says which event types open an alert (failed, needs attention, inactive unless planned), which close one (active), and which are only recorded. Changing that is a config update, not a rule edit. As a bonus, every deployment gets a full timeline of what happened to it, which is very handy during an investigation.

Each event comes with a unique eventID and an eventTime. The router uses the first to drop exact duplicates and the second to throw away events that arrive late and out of order.

How it helps: lifecycle problems show up in the same place, in the same format and with the same customer context as metric alarms, instead of arriving as a separate stream of emails.

3. OCI Streaming: a durable buffer in the middle

Every signal lands in OCI Streaming first. That one decision gives the design most of its resilience.

Our first version sent alarms to a Notifications topic and had a function subscribe to it. That works for a demo, but it gives you no buffer. If the function is slow or failing, messages pile up with nowhere to wait. A stream fixes that. Messages are stored durably for the retention period you choose, anywhere from 24 hours to 7 days, and consumers can read them again later. (limits) Streams also keep strict ordering within a partition and support replay, which queues don't. (FAQ)

We use two streams per region:

  • The ingress stream. Alarms, lifecycle events and custom checks all write here. This is the only front door into the pipeline, so adding a new source just means sending the same message shape to the same stream.
  • The grouping stream. When the router wants to hold related alerts for a short while and send them as one message, it writes a small "flush this group later" record here. Because that record lives in a durable stream, grouping keeps working through restarts and needs no scheduler.

Sizing is simple at our volume. Each partition gives you 1 MB per second in and 2 MB per second out (FAQ), and alarm messages are a few KB each, so one partition per stream is plenty. Pick the retention period carefully, because it can't be changed after the stream is created.

One gotcha: if your stream pool uses a private endpoint, the console's message viewer won't show you anything, even when messages are flowing fine. Check the consumer side (Connector Hub metrics or the function logs) instead.

How it helps: bursts, slow downstream services and short outages turn into a short delay instead of lost alerts.

4. Connector Hub: the glue that wakes the function

Streams don't call functions by themselves. Connector Hub does that part, and it takes no code at all.

A connector with a Streaming source and a Functions target reads from the stream, collects messages into a batch, and invokes the function with that batch. It's also free. You only pay for the services on either end. (FAQ)

We run two connectors per region, both pointing at the same router function:

  • Ingress connector: ingress stream to router. This is where new alarms, events and check results arrive.
  • Grouping connector: grouping stream to router. This is where the router gets its own "time to send this group" records back.

The router looks at what's in each batch and knows which job to do. One function and one image is much easier to version and roll back than two.

The main tuning knob is batching. You set a batch size and a batch time limit, and the connector sends a batch as soon as either one is reached. (docs) Smaller batches mean faster first alerts. Larger batches mean fewer function invocations during a storm and more alerts the router can group in one pass. We tuned the ingress side for speed and the grouping side for throughput.

A tip that cost us an afternoon: a connector can show ACTIVE in the console and still move nothing at all. It needs IAM policies that let it read the stream and invoke the function. If those are missing, the connector shows no obvious error. Create the policies before you judge the connector, and then check its metrics for messages read and written.

How it helps: you get managed, retried delivery from stream to function, and batching you can tune with no consumer code to write or babysit.

5. OCI Functions: the router that makes the decisions

The router is the one piece of real code in the design. It's a single Python function, and it only runs when Connector Hub hands it a batch.

For every message in the batch, it does the same steps in the same order:

  • Recognize and check the message. Is it an alarm, a lifecycle event or a custom-check result? Does it have the fields it needs? Anything malformed is recorded as a validation failure and never turns into a page.
  • Turn it into one common shape. All three sources become the same internal event, with a signal, a resource, a time and a value.
  • Work out who owns it. The registry says which customer, environment and policy the process belongs to. If there's no mapping yet, the alert is still sent, labeled UNMAPPED, so nothing is silently dropped.
  • Apply suppressions. Planned maintenance or a process marked as intentionally stopped means the alert is recorded but not sent.
  • Compare with what it already knows. Exact duplicates are dropped. Late, out-of-order events are rejected. A new problem is NEW, an open one is a continuation, and a cleared one is a recovery.
  • Decide and deliver. Send now, hold briefly to group with related alerts, repeat on schedule, or just record.
  • Write down why. Every message ends with one structured decision line in the function log.

A simplified handler looks like this:

import io
import json
from fdk import response


def handler(ctx, data: io.BytesIO = None):
    batch = json.loads(data.getvalue())
    summary = []
    for record in batch:
        event = normalize(record)            # alarm, lifecycle event or check result
        if event is None:
            log_invalid(record)
            continue
        owner = registry.lookup(event)       # tenant, environment, policy
        decision = decide(event, owner)      # NEW, REPEAT, RECOVERED, SUPPRESSED, DUPLICATE
        apply(decision)                      # conditional write to state, publish if needed
        log_decision(decision)               # one line per message, always
        summary.append(decision.kind)
    return response.Response(ctx, response_data=json.dumps(summary))

A few things made Functions a good fit:

  • Resource principal. The function signs in as itself. There are no API keys to store, rotate or leak. IAM policies decide exactly which tables, streams and topics it can touch.
  • Configuration outside the image. Table names, stream and topic OCIDs, and feature flags live in the function's configuration. Thresholds, templates and routing rules live in NoSQL. Most changes never need a new image.
  • Pay per run. On a quiet day the router barely runs at all, and on a bad day it scales out with the batches.
  • Safe to run twice. Connector Hub delivers at least once, so the router is written so that processing the same message again changes nothing. That's what the duplicate check and the conditional writes in the next section are for.

The registry is cached in memory for about a minute between invocations, so a warm function doesn't hit NoSQL for every single message.

How it helps: you get all the decision logic in one small, testable, versioned place, with no servers and no stored credentials.

6. NoSQL Database Cloud Service: the router's memory

A function forgets everything between runs. NoSQL Database Cloud Service is what lets the router remember, and we split that memory into two tables on purpose.

The registry table holds what should be true: which customer owns each deployment and each process, what environment it is, which alert policy and message template apply, and any active suppressions. It's loaded from files in version control by a re-runnable pipeline, never edited by hand.

The runtime table holds what has actually happened: one record per alert episode (first seen, current and peak severity, how many notifications so far), group buffers, and the evidence for each decision.

Keeping them apart matters. If configuration and event history live in the same place, sooner or later a stale setting hides inside old events and nobody can find it.

Both tables use the same simple shape. A composite primary key keeps related rows on the same shard, and a JSON payload lets the record grow without schema changes:

CREATE TABLE IF NOT EXISTS ggmon_runtime (
  state_type STRING,
  scope_key  STRING,
  state_key  STRING,
  payload    JSON,
  updated_at STRING,
  PRIMARY KEY (SHARD(state_type, scope_key), state_key)
) USING TTL 30 DAYS

Three NoSQL features do a lot of work here:

  • Time to live. Runtime rows expire on their own after 30 days. There's no cleanup job to write or forget about.
  • Conditional writes. Every row has a version. The router reads an episode, decides, and writes it back only if the version hasn't changed in between. If two batches touch the same episode at the same moment, one wins and the other reads again and retries. (row versions)
  • Global Active tables. Each table has replicas in every region we run in, and NoSQL keeps them in sync, active-active, with no replication code of our own. (docs) A suppression created in one region is honored in the other, and either region can carry on if one goes down.

Here's the conditional write in Python:

from borneo import GetRequest, PutRequest, PutOption

got = handle.get(GetRequest().set_table_name("ggmon_runtime").set_key(key))
row = update_episode(got.get_value(), event)

put = (PutRequest()
       .set_table_name("ggmon_runtime")
       .set_value(row)
       .set_option(PutOption.IF_VERSION)
       .set_match_version(got.get_version()))

if handle.put(put).get_version() is None:
    retry_from_read()    # someone else updated this episode first

A word of caution on the multi-region part. Replication makes data available everywhere, but it doesn't make two regions agree on who owns an episode at the same instant. We keep configuration changes to a single writer region, and each region owns the alerts from its own sources. Failover between regions is something we're still testing properly.

How it helps: you get durable, replicated memory with millisecond reads, automatic expiry and safe concurrent updates, without running a database server.

7. OCI Notifications: getting the message to people

Once the router decides a message is worth sending, OCI Notifications delivers it. The router publishes to a topic once, and Notifications fans that out to every subscription.

A topic can have subscriptions for email, Slack, PagerDuty, HTTPS endpoints, functions and SMS. (FAQ) Notifications tries to deliver every message at least once and keeps retrying for two hours. (product page) That means the router doesn't need its own delivery or retry logic for the common channels.

We use two topics per environment:

  • Alert topic. Real problems on the replication fleet, for the on-call team.
  • Health topic. Problems with the monitoring pipeline itself, such as a router error, a connector that stopped moving data, or a custom check that didn't run. Keeping this separate means a broken pipeline can't hide its own failure in the same channel it's failing to deliver to.

The router writes the final message text from templates stored in the registry, not from whatever the source sent. A grouped message for one customer ends up looking something like this (all names are placeholders):

FIRING · CRITICAL — 3 alerts
Customer: Example Tenant [T001] · PROD
Deployments: gg-prod-01, gg-prod-02
Since 2026-01-15 09:42
• NEW CRITICAL · REPLICAT RA01 — ReplicatStatus stopped · gg-prod-01
• NEW CRITICAL · REPLICAT RA02 — ReplicatStatus stopped · gg-prod-01
• NEW WARNING · EXTRACT EA01 — ExtractLag 14m · gg-prod-02

Because templates are data, we reworked the message layout several times during testing, based on on-call feedback, without rebuilding or redeploying the function once.

Two practical notes. New email subscriptions stay pending until someone clicks the confirmation link, and nothing is delivered until they do, so check that every subscription is active. Also, if the same topic feeds both Slack and email, Slack formatting such as asterisks for bold shows up as literal characters in the email.

How it helps: you get reliable, retried delivery to the tools people already use, from a single publish call.

8. The supporting cast

A handful of other OCI services don't sit in the main data path, but the design wouldn't be safe or usable without them.

Service What it does for us
IAM policies Least-privilege access for every component. The router can read the registry, read and write runtime state, write to the grouping stream and publish to two topics, and nothing else.
Logging Holds the router's decision lines. Searching the log for one alert ID tells you exactly what happened to it and why.
Resource Scheduler Runs the custom-check function on a schedule, with cron syntax. (docs)
Container Registry Stores the router image. We pin an exact tag in config so every region runs the same build.
API Gateway and Identity Domains Front the suppression API with OAuth tokens and role checks.
Vault Keeps the few secrets the suppression API needs out of code, config and tickets.

Custom checks on a schedule

Native metrics don't cover everything. Errors in a process report file, or a recovery checkpoint that hasn't moved in a day, need someone to go and look. A small function does that, triggered by Resource Scheduler. Scheduled functions run with the detached invocation type, so the scheduler doesn't wait for the result. (docs)

The important design choice is that the check function keeps no state. Every time it runs, it sends the current result for every check, healthy or not, to the same ingress stream. The router compares that with what it already knows, just as it does for alarms. That means any collector, whether a function, a container or a script, can feed the pipeline as long as it sends the same message shape. The hourly message also works as a heartbeat. If it stops arriving, the health pipeline should notice.

A suppression API instead of editing alarms

Native alarm suppression mutes the whole alarm. With compartment-level alarms, that would silence every customer at once, and it does nothing for lifecycle events or custom checks. So we built a small API on OCI Functions behind API Gateway. Operators can mute by environment, customer, deployment or a single process, always with an end time and a reason. The API writes the suppression into the registry, and every router honors it within about a minute. Suppressed alerts are still recorded, just not sent. Callers also need far less access than they would to edit alarms directly.

Watching the watcher

Every service in the pipeline publishes its own metrics: Streaming, Connector Hub, Functions, NoSQL and Notifications all have namespaces in OCI Monitoring. We put alarms on those too and send them to the health topic. The most valuable one is simple: alarms are firing, but the router hasn't made a decision. That catches the silent failures, which are the dangerous ones.

How it helps: these services make the pipeline secure, debuggable and extensible without adding servers.

9. Following one alert from start to finish

Here's what happens when three Replicats for the same customer stop at once, say because the target database restarted.

  • Detection. OCI Monitoring sees ReplicatStatus drop to 0 for three metric streams. After the pending duration passes, it sends three split messages, one per Replicat, to the ingress stream.
  • Delivery. Connector Hub picks the three messages up in the next batch and invokes the router once.
  • Context. The router looks each Replicat up in its cached copy of the registry. All three belong to the same customer and environment, and policy says a stopped Replicat is CRITICAL.
  • Suppression check. No maintenance window covers these processes, so the alerts go ahead.
  • State. No open episode exists for any of the three, so each gets a new episode in the runtime table, written conditionally.
  • Grouping. The first alert goes out right away, and the other two in the same batch ride along in the same message. If a fourth Replicat fails a minute later, it's collected into at most one follow-up through the grouping stream.
  • Delivery to people. The router publishes one message to the alert topic, and Notifications sends it to Slack and email. On-call sees one message naming the customer and listing all three Replicats.
  • While it stays broken. The alarm keeps repeating. The router treats each repeat as a continuation and only sends a reminder at the policy's repeat interval, showing when the problem started.
  • Recovery. The Replicats restart and the alarm sends OK. Before believing it, the router checks the latest metric value, since a metric that simply stops arriving can also look like OK. If the value really is healthy, it closes the episodes and sends one recovery message with the total duration.
  • Evidence. Every step above left a decision line in the log, so anyone can trace exactly what was sent and why.

Without the router, the same incident would have been three separate FIRING messages, a stream of repeats, and three recovery messages, none of them naming the customer.

10. What we learned along the way

Most of our lessons came from running the pipeline side by side with existing alerting, not from the design work.

  • A noise filter has to watch itself. At one point, a change in the format of a few registry values meant the router stopped matching anything. Alerts stopped flowing and nothing reported an error. Now the router logs and counts every registry row that breaks the expected format, matches type values without caring about case, and the health pipeline alarms when alarms fire but no decisions come out. Silence is the most dangerous failure a monitoring system can have.
  • Don't trust every OK. We saw alarms flip from FIRING to OK and back a few minutes later while lag was still very high, most likely because the metric briefly stopped arriving. Checking the real value before sending a recovery stopped false all-clears.
  • Keep alarm thresholds and router tiers in step. The alarm should fire at the router's lowest tier. When they drift apart, recoveries go out too early or problems go unseen.
  • Quiet processes make noisy lag. A Replicat that only applies data a few times a day shows lag that climbs every day and resets. A plain lag alarm treats that as a daily incident. HeartbeatLag, a per-profile threshold or a planned-idle flag are better fits for those processes.
  • Mapping data is half the product. The router can only name the customer if the registry knows it. Gaps in that data showed up straight away as UNMAPPED alerts. That's annoying, but at least it's visible, and it points at exactly what to fix.
  • Order your deployment steps. Connectors created before their IAM policies show as ACTIVE and move nothing. Policies come first.
  • Make templates data, not code. On-call people had strong opinions about the message layout, and they were right. Keeping templates in NoSQL meant we could act on that feedback in minutes.

Wrapping up

None of the services here are exotic. What makes the pattern work is how they fit together. Monitoring and Events do the detecting. Streaming holds everything safely. Connector Hub wakes a single function only when there's work to do. NoSQL gives that function a memory, and Notifications gets the result to people.

If you want to try this on your own fleet, a small first step goes a long way. Point one compartment-level, split-per-stream alarm at a stream, add a connector and a function that just logs what it receives, and look at what your alarms actually send for a week. You'll quickly see where context and memory would help.

Sources