> ## 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.

# Prozessmonitor-Events über die AppSignal-Integrationen senden

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>;
};

Die AppSignal-Integrationen für [Ruby](/ruby), [Elixir](/elixir), [Node.js](/nodejs) und [Python](/python) bieten Hilfsmethoden und -funktionen, mit denen Sie einfach Prozessmonitor-Events an AppSignal senden können.

<Note>
  Die Integrations-Hilfsfunktionen verwenden weiterhin `CheckIn`, `checkIn` und `check_in` im Code
  für Kompatibilität mit bestehenden Anwendungen.
</Note>

## Cron-Prozessmonitor-Events

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

Um AppSignal zu benachrichtigen, dass ein Cronjob erfolgreich beendet wurde, verwenden Sie die Hilfsfunktion `cron` und übergeben Sie den Namen des Cron-Prozessmonitors als Argument.

<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>

Es ist sicher, die Hilfsfunktion `cron` in kurzer Zeit mehrfach aufzurufen, da die Hilfsfunktion höchstens alle zehn Sekunden ein Finish-Event an AppSignal sendet.

### Überwachung der Job-Dauer

Um die Dauer eines Cronjobs zu überwachen, können Sie die Hilfsfunktion `cron` mit einem Block oder einer Funktion verwenden, der/die den zu überwachenden Code enthält. Dadurch werden Events sowohl beim Start als auch beim Ende des Jobs an AppSignal gesendet.

<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>

Wenn innerhalb der überwachten Funktion oder Methode eine Exception ausgelöst wird, wird das Finish-Event nicht an AppSignal gemeldet, was eine Benachrichtigung über einen fehlenden Prozessmonitor auslöst. Die Exception wird erneut ausgelöst.

Wenn der Kontext, in dem die Exception ausgelöst wird, ein AppSignal-überwachter Kontext ist, wird die Exception an AppSignal gemeldet. Andernfalls können Sie, wenn Sie die Exception an AppSignal melden möchten, unsere Hilfsfunktionen für die Exception-Behandlung für [Ruby](/ruby/instrumentation/exception-handling#appsignalreport_error), [Elixir](/elixir/instrumentation/exception-handling#appsignalsend_error3), [Node.js](/nodejs/3.x/instrumentation/exception-handling#send-error) oder [Python](/python/instrumentation/exception-handling#send_error) verwenden.

## Heartbeat-Prozessmonitor-Events

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

Um ein Heartbeat-Prozessmonitor-Event an AppSignal zu senden, verwenden Sie die Hilfsfunktion `heartbeat` und übergeben Sie den Namen des Heartbeat-Prozessmonitors als Argument.

Es ist sicher, `heartbeat` mehrfach aufzurufen, da die Hilfsfunktion höchstens alle zehn Sekunden ein Heartbeat-Event an AppSignal sendet.

<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>

### Heartbeats kontinuierlich senden

Um Heartbeat-Prozessmonitore kontinuierlich zu senden, können Sie die Option `{ continuous: true }` an die Hilfsfunktion `heartbeat` übergeben. Dies ist nützlich, um die Lebensdauer des Prozesses selbst zu überwachen. Die Hilfsfunktion sendet alle dreißig Sekunden ein Heartbeat-Event an 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>

## Prozessmonitor-Vorkommen in AppSignal überprüfen

Nach der Konfiguration beginnt AppSignal, Informationen über Vorkommen für Ihre Prozessmonitore anzuzeigen.

Sie können mehr über Vorkommen in unserer [Dokumentation zu Prozessmonitor-Vorkommen](/check-ins/occurrences) lesen.
