> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Procesmonitor-events versturen met de AppSignal-integraties

export const Compatibility = ({versions = [], label = "Available in"}) => {
  if (!Array.isArray(versions) || versions.length === 0) {
    return null;
  }
  const defaultPillStyle = {
    borderColor: "#d4d4d8",
    background: "#f4f4f5",
    color: "#3f3f46"
  };
  const pillStyles = {
    "AppSignal for Elixir": {
      background: "#f3e8ff",
      borderColor: "#d8b4fe",
      color: "#6b21a8"
    },
    "AppSignal for Front-end": {
      background: "#fef9c3",
      borderColor: "#fde047",
      color: "#854d0e"
    },
    "AppSignal for Go": {
      background: "#ccfbf1",
      borderColor: "#5eead4",
      color: "#115e59"
    },
    "AppSignal for JavaScript": {
      background: "#fef9c3",
      borderColor: "#fde047",
      color: "#854d0e"
    },
    "AppSignal for Node.js": {
      background: "#dcfce7",
      borderColor: "#86efac",
      color: "#166534"
    },
    "AppSignal for Python": {
      background: "#dbeafe",
      borderColor: "#93c5fd",
      color: "#1e40af"
    },
    "AppSignal for Ruby": {
      background: "#fee2e2",
      borderColor: "#fca5a5",
      color: "#991b1b"
    },
    "AppSignal for Rust": {
      background: "#ffedd5",
      borderColor: "#fdba74",
      color: "#9a3412"
    }
  };
  const getPillStyle = name => ({
    ...defaultPillStyle,
    ...pillStyles[name] || ({})
  });
  return <div className="not-prose my-4 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 text-sm dark:border-white/10 dark:bg-white/5">
      <div className="flex flex-wrap items-center gap-x-2 gap-y-1">
        <span className="font-semibold text-zinc-700 dark:text-zinc-200">
          {label}:
        </span>
        {versions.map((v, i) => <span key={`${v.name}-${v.version}-${i}`} className="inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium" style={getPillStyle(v.name)}>
            <span>{v.name}</span>
            <span className="opacity-70">
              {v.version}
              {v.exact ? "" : "+"}
            </span>
          </span>)}
      </div>
    </div>;
};

De AppSignal-integraties voor [Ruby](/ruby), [Elixir](/elixir), [Node.js](/nodejs) en [Python](/python) bieden helper-methodes en -functies waarmee u eenvoudig procesmonitor-events naar AppSignal kunt versturen.

<Note>
  De integratie-helpers gebruiken nog steeds `CheckIn`, `checkIn` en `check_in` in code
  voor compatibiliteit met bestaande applicaties.
</Note>

## Cron-procesmonitor-events

<Compatibility
  versions={[
{ name: "AppSignal for Ruby", version: "3.13.0" },
{ name: "AppSignal for Elixir", version: "2.12.2" },
{ name: "AppSignal for Node.js", version: "3.4.9" },
{ name: "AppSignal for Python", version: "1.3.8" },
]}
/>

Om AppSignal te informeren dat een cron job succesvol is voltooid, gebruikt u de `cron`-helperfunctie en geeft u de naam van de cron-procesmonitor als argument mee.

<CodeGroup>
  ```ruby Ruby theme={null}
  def send_invoices
    # ... your code here ...
    Appsignal::CheckIn.cron("send_invoices")
  end
  ```

  ```elixir Elixir theme={null}
  def send_invoices do
    # ... your code here ...
    Appsignal.CheckIn.cron("send_invoices")
  end
  ```

  ```javascript Node.js theme={null}
  import { checkIn } from "@appsignal/nodejs";

  function sendInvoices() {
    // ... your code here ...
    checkIn.cron("send_invoices");
  }
  ```

  ```python Python theme={null}
  from appsignal.check_in import cron

  def send_invoices():
    # ... your code here ...
    cron("send_invoices")
  ```
</CodeGroup>

Het is veilig om de `cron`-helperfunctie vele keren in korte tijd aan te roepen, aangezien de helper slechts maximaal eens per tien seconden een finish-event naar AppSignal stuurt.

### De duur van de job monitoren

Om de duur van een cron job te monitoren, kunt u de `cron`-helperfunctie gebruiken met een block of functie die de code bevat die u wilt monitoren. Hiermee worden events naar AppSignal verzonden zowel wanneer de job start als wanneer deze eindigt.

<CodeGroup>
  ```ruby Ruby theme={null}
  def send_invoices()
    Appsignal::CheckIn.cron("send_invoices") do
      # ... your code here ...
    end
  end
  ```

  ```elixir Elixir theme={null}
  def send_invoices do
    Appsignal.CheckIn.cron("send_invoices", fn ->
      # ... your code here ...
    end)
  end
  ```

  ```javascript Node.js theme={null}
  import { checkIn } from "@appsignal/nodejs";

  function sendInvoices() {
    checkIn.cron("send_invoices", () => {
      // ... your code here ...
    });
  }

  // If the function passed to `cron` returns a promise, the finish event
  // will be reported to AppSignal if the promise resolves, allowing you
  // to track the duration of async functions:
  async function sendInvoices() {
    await checkIn.cron("send_invoices", async () => {
      // ... your async code here ...
    });
  }

  // If the promise is rejected, or if it never resolves, the finish event
  // will not be reported to AppSignal.
  ```

  ```python Python theme={null}
  from appsignal.check_in import Cron

  def send_invoices():
    with Cron("send_invoices"):
      # ... your code here ...
  ```
</CodeGroup>

Als binnen de gemonitorde functie of methode een exception wordt geraised, wordt het finish-event niet gerapporteerd aan AppSignal en wordt er een notificatie voor een gemiste procesmonitor verzonden. De exception zal opnieuw worden geraised.

Als de context waarin de exception wordt geraised een door AppSignal gemonitorde context is, wordt de exception aan AppSignal gerapporteerd. Als u de exception anders aan AppSignal wilt rapporteren, kunt u onze exception handling-helpers gebruiken voor [Ruby](/ruby/instrumentation/exception-handling#appsignalreport_error), [Elixir](/elixir/instrumentation/exception-handling#appsignalsend_error3), [Node.js](/nodejs/3.x/instrumentation/exception-handling#send-error) of [Python](/python/instrumentation/exception-handling#send_error).

## Heartbeat-procesmonitor-events

<Compatibility
  versions={[
{ name: "AppSignal for Ruby", version: "4.1.0" },
{ name: "AppSignal for Elixir", version: "2.13.0" },
{ name: "AppSignal for Node.js", version: "3.5.0" },
{ name: "AppSignal for Python", version: "1.4.0" },
]}
/>

Om een heartbeat-procesmonitor-event naar AppSignal te versturen, gebruikt u de `heartbeat`-helperfunctie en geeft u de naam van de heartbeat-procesmonitor als argument mee.

Het is veilig om `heartbeat` vele keren aan te roepen, aangezien de helper slechts maximaal eens per tien seconden een heartbeat-event naar AppSignal stuurt.

<CodeGroup>
  ```ruby Ruby theme={null}
  loop do
    Appsignal::CheckIn.heartbeat("job_processor")
    # ... your code here ...
  end
  ```

  ```elixir Elixir theme={null}
  def job_processing_loop do
    Appsignal.CheckIn.heartbeat("job_processor")
    # ... your code here ...
    job_processing_loop()
  end
  ```

  ```javascript Node.js theme={null}
  import { checkIn } from "@appsignal/nodejs";

  while (true) {
    checkIn.heartbeat("job_processor");
    // ... your code here ...
  }
  ```

  ```python Python theme={null}
  from appsignal.check_in import heartbeat

  while True:
    heartbeat("job_processor")
    # ... your code here ...
  ```
</CodeGroup>

### Continu heartbeats versturen

Om continu heartbeat-procesmonitoren te versturen, kunt u de optie `{ continuous: true }` doorgeven aan de `heartbeat`-helperfunctie. Dit is handig om de levensduur van het proces zelf te monitoren. De helper stuurt elke dertig seconden een heartbeat-event naar AppSignal.

<CodeGroup>
  ```ruby Ruby theme={null}
  Appsignal::CheckIn.heartbeat("job_processor", continuous: true)
  ```

  ```elixir Elixir theme={null}
  # This call spawns a new Elixir process, linked to the current process.
  # If the current process exits, the heartbeat process will also exit.
  Appsignal.CheckIn.heartbeat("job_processor", continuous: true)

  # It is also possible to add a continuous heartbeat sending process
  # to a supervision tree. This will ensure that the process is restarted
  # alongside the rest of the supervised children.
  Supervisor.start_link([
    {Appsignal.CheckIn.Heartbeat, "job_processor"},
    # ... other children processes ...
  ], strategy: :one_for_one)
  ```

  ```javascript Node.js theme={null}
  import { checkIn } from "@appsignal/nodejs";

  checkIn.heartbeat("job_processor", { continuous: true });
  ```

  ```python Python theme={null}
  from appsignal.check_in import heartbeat

  heartbeat("my_app", continuous=True)
  ```
</CodeGroup>

## Procesmonitor-occurrences in AppSignal bekijken

Eenmaal geconfigureerd, begint AppSignal informatie weer te geven over occurrences voor uw procesmonitoren.

U kunt meer lezen over occurrences in onze [documentatie over procesmonitor-occurrences](/check-ins/occurrences).
