startSpan
Ouvre un span dans la requête en cours, que vous pourrez terminer une fois le travail achevé. Dans la cascade, le span dépend du span propre à la requête. En dehors d’une requête ou avant init, la fonction renvoie un handle inactif.
Paramètres
namestringobligatoireLa nature du travail, par exemple users.findById.
opstringUne catégorie qui lui attribue une couleur dans la cascade, par exemple db, cache ou http.
Valeur renvoyée
Un handle. Appelez finish() une fois le travail terminé, avec "error" en cas d’échec. Un second appel à finish() ne fait rien.
Exemple
Node
import { startSpan } from "@octri/node";
const span = startSpan("users.findById", { op: "db" });
const user = await db.user.find(id);
span.finish();Dans chaque langage
| Langage | Appel |
|---|---|
| Node | startSpan() |
| Python | octri.start_span() |
| Go | octri.StartSpan() |
| Ruby | Octri.start_span |
| Java | Non disponible |
| Kotlin | Non disponible |
| PHP | Non disponible |
| Rust | Non disponible |
| Swift | Non disponible |
| Dart | Non disponible |
Articles associés
- Autres fonctions :
init,captureError,captureEvent,captureSpan,traceFromHeader,addScrubFields,setBeforeSend,withSpan,instrument,autoInstrument. - SDK backend : installation d’un environnement d’exécution et de ses intégrations de framework.