captureSpan
Signale un span d’une trace, avec les heures que vous avez mesurées vous-même. Les spans ayant le même traceId forment la cascade de trace d’une requête. La plupart du code utilise plutôt startSpan ou les intégrations de frameworks, qui renseignent ces valeurs pour vous.
Paramètres
traceIdstringobligatoireLa trace à laquelle il appartient.
spanIdstringobligatoireL’identifiant de ce span, composé de 16 caractères hexadécimaux.
parentSpanIdstringLe span à l’origine de celui-ci.
namestringobligatoireSa fonction, par exemple orders.insert.
servicestringUne catégorie qui lui attribue une couleur dans la cascade, par exemple db.
operationIdstringL’opération à laquelle il appartient.
startTimeISO timestampobligatoireSon heure de début.
endTimeISO timestampSon heure de fin.
statuschoiceok ou error.
Exemple
Node
import { captureSpan, newSpanId } from "@octri/node";
captureSpan({
traceId: trace.traceId,
spanId: newSpanId(),
parentSpanId: trace.parentSpanId,
name: "invoice.render",
service: "pdf",
startTime: started.toISOString(),
endTime: new Date().toISOString(),
status: "ok",
});Dans chaque langage
| Langage | Appel |
|---|---|
| Node | captureSpan() |
| Python | octri.capture_span() |
| Go | octri.CaptureSpan() |
| Ruby | Octri.capture_span |
| Java | Octri.captureSpan() |
| Kotlin | Octri.captureSpan() |
| PHP | Octri::captureSpan() |
| Rust | octri_monitoring::capture_span() |
| Swift | Octri.captureSpan() |
| Dart | Octri.captureSpan() |
Articles associés
- Autres fonctions :
init,captureError,captureEvent,traceFromHeader,addScrubFields,setBeforeSend,startSpan,withSpan,instrument,autoInstrument. - SDK backend : installation d’un environnement d’exécution et de ses intégrations de framework.