init
Configures the runtime. Call it once at startup, before anything else. Every other function does nothing until init has run, so a missing call fails quietly rather than breaking your application.
Parameters
urlstringrequiredYour monitoring address, the Ingest URL in the Monitoring connection settings.
tokenstringThe project's ingest token. Keep it in an environment variable. Leave it out only for a self-hosted endpoint that takes events without one.
environmentstringrequiredYour environment id, which is your project's id. The Monitoring connection settings show it.
releasestringWhich deploy this is, usually the git SHA. Errors are grouped by it on the releases view.
Example
Node
import { init } from "@octri/node";
init({
url: process.env.MONITORING_URL!,
token: process.env.OCTRI_TOKEN,
environment: "YOUR_PROJECT_ID",
release: process.env.GIT_SHA,
});In each language
| Language | Call |
|---|---|
| Node | init() |
| Python | octri.init() |
| Go | octri.Init() |
| Ruby | Octri.init |
| Java | Octri.init() |
| Kotlin | Octri.init() |
| PHP | Octri::init() |
| Rust | octri_monitoring::init() |
| Swift | Octri.initialize() |
| Dart | Octri.init() |
Each language's own setup is on backend SDKs. Go, Java, Kotlin, PHP, Rust, Swift and Dart take the same four settings in a config object.
Related
- Other functions:
captureError,captureEvent,captureSpan,traceFromHeader,addScrubFields,setBeforeSend,startSpan,withSpan,instrument,autoInstrument. - Backend SDKs: installing a runtime and its framework integrations.