# AppStartupTraceConfig

**Kind**: interface | **Module**: [Insights](https://docs.interop.io/browser/reference/javascript/insights/index.md)

**Source**: https://docs.interop.io/browser/reference/javascript/insights/appstartuptraceconfig/index.html

The application startup trace (instrumentAppStartup): its startup window
(parentSpanTimeoutMs, parentSpanLoadTimeoutMs,
parentSpanEnd) and what it traces, aspect by aspect. Every aspect
defaults to `true`: an object switches off only what it sets to `false`.
The aspects other than the root span apply in browsers only - in NodeJS
the trace is the root span and the startup window (see
instrumentAppStartup).

## Properties

- **`enabled`** (`boolean`, optional) default: `true`
  Whether the application startup is traced at all. `false` is the same as
  `instrumentAppStartup: false`: no root span, no startup window (spans
  created while the application starts are not nested under anything
  automatically and carry no isStartup attribute) and none of the aspects
  below.
- **`observeErrors`** (`boolean`, optional) default: `true`
  Whether the uncaught errors and unhandled promise rejections of the
  startup window are observed: counted on the root span (errorCount) and,
  when instrumentErrors is off, published as its error spans under the
  root. Has no bearing on instrumentErrors itself.
- **`observeLifecycle`** (`boolean`, optional) default: `true`
  Whether the page lifecycle transitions of the startup window are
  observed: visibility changes, pageshow/pagehide (back/forward cache),
  freeze/resume and prerenderingchange as point-in-time child spans, and
  the visibilityChanges / hiddenDuringStartup / bfcacheRestored summary on
  the root span.
- **`observeLongTasks`** (`boolean`, optional) default: `true`
  Whether long tasks of the startup window are observed: the per-task
  child spans ("interopio.api.instrumentation.eventLoopBlocking", only when
  instrumentEventLoop is off - it publishes them otherwise) and the
  perf.longTasks aggregate on the root span.
- **`observePaints`** (`boolean`, optional) default: `true`
  Whether the first-paint / first-contentful-paint marks are published as
  child spans ("interopio.api.appStartup.paint").
- **`observeVitals`** (`boolean`, optional) default: `true`
  Whether the web vitals of the startup window - the latest LCP and the
  session-window CLS - are observed and published on the root span
  (perf.vitals.lcp / perf.vitals.cls). The SESSION-level values are
  instrumentWebVitals' job either way.
- **`parentSpanEnd`** (`"explicit" | "timeout" | "loader" | "any" | "dom-ready" | "loaded"`, optional) default: `"any"`
  When will the application startup span be considered completed,
  so that no further spans are added under it.
  * explicit - when Traces.instance.startupTraceFinished() is called by the application code
  * timeout - same as "explicit" OR when parentSpanTimeoutMs have elapsed and the page has loaded (the load
    event - waited for as long as parentSpanLoadTimeoutMs allows). The span says which it was:
    startupFinishedType "timeout" when the page had loaded by the timeout, "loaded" when the
    window waited past the timeout for the load event
  * any - when any of "explicit", "timeout" or the loading animation of the window
    completing (the loader signal, startupTraceFinished("loader")) happens first
  * dom-ready, loaded, loader - the root span ENDS at the mode's event: DOMContentLoaded, the
    load event (both at the time the navigation timing records for them - at once, when the
    document is already past them) or the loader signal - while the startup window stays open
    the way it does for "timeout": parentSpanTimeoutMs elapsed and the page loaded (waited for
    as long as parentSpanLoadTimeoutMs allows), or the explicit finish, closes it, and ends the
    root then, with the event's time. Spans keep nesting under the root for the window's
    lifetime, and the navigation KPIs, read after the load event, still land on it.
    startupFinishedType is the event ("dom-ready", "loaded", "loader"), or what closed the
    window when the event had not happened by then; startupWindowClosedBy says what closed
    the window. Without a timeout (parentSpanTimeoutMs 0) nothing keeps the window open, and
    the event closes it. In io.Connect Desktop, with appStartMeasurement set to the matching moment,
    the application startup lines up with what the workspace and layout startups measure

  In NodeJS there is no loader signal, page load or DOMContentLoaded: "loader", "dom-ready"
  and "loaded" behave as "any", and the timeout counts alone.

  Whatever the value, the page being unloaded (a reload, a navigation away,
  the window closing - not an entry into the back/forward cache) while the
  startup window is still open closes it and completes the startup span there
  and then, marked startupFinishedType "pagehide": a span is only exported
  once it has ended, so the span of a startup the user walked away from would
  be lost otherwise. In the "dom-ready", "loaded" and "loader" modes, once the
  mode's event has happened, startupFinishedType stays the event - the span
  ends with the event's time - and only startupWindowClosedBy is "pagehide".
  The ended spans are flushed by the `flushOnClose` handling of the page going
  away, not by the startup trace: with `flushOnClose: false` nothing is flushed
  there, and the span goes out with the next scheduled export, if the page
  lives that long.

  When not set, the deprecated traces setting startupParentSpanEnd applies.
- **`parentSpanLoadTimeoutMs`** (`number`, optional) default: `0`
  How long the startup window waits for the page's load event once
  parentSpanTimeoutMs has elapsed, in milliseconds. `0` waits
  indefinitely: a page that never finishes loading keeps the startup span
  open until the application finishes it, or the page goes away (which
  completes and exports it - see parentSpanEnd). With a positive
  value the window closes that long after the timeout even though the page
  has not loaded - marked startupFinishedType "load-timeout", and without
  the navigation KPIs, which are read after the load event. Not applicable
  in NodeJS, where there is no page load to wait for.
- **`parentSpanTimeoutMs`** (`number`, optional) default: `3000`
  If non-zero, how long after application startup will any traced operations
  automatically be nested under the application startup trace. The timeout is
  counted from the moment the io.Connect API begins initializing. Without a
  timeout the startup window only closes on an explicit startupTraceFinished()
  call, on the loader signal in io.Connect Desktop windows ("loader" and "any"),
  or on the event of the "dom-ready" and "loaded" modes - the root span stays
  open, and unexported, until then or until the page goes away.

  When the timeout elapses before the page has loaded, the window stays open
  until the load event - so the navigation KPIs, which are read after it,
  land on the startup span. See parentSpanLoadTimeoutMs for limiting
  that wait.

  When not set, the deprecated traces setting startupParentSpanTimeoutMs applies.
- **`rootSpan`** (`boolean`, optional) default: `true`
  Whether the "interopio.api.appStartup" root span becomes the implicit
  parent of the spans the application creates during the startup window
  (through the propagation defaults). The root span itself is always
  opened - it is what the gathered data lands on, and the child spans of
  the aspects below always nest under it. With `false`, the spans created
  during the startup window are parented the way they would be without
  the startup trace: under the platform-provided parent
  (rootPropagationInfo / glue42gd.propagationInfo) when there is one,
  otherwise not at all. The startup window itself is unchanged - it ends
  on parentSpanTimeoutMs or startupTraceFinished() as usual, and
  spans created during it carry the isStartup attribute.
- **`traceNavigation`** (`boolean`, optional) default: `true`
  Whether the navigation timing is traced once the load event completed:
  the "interopio.api.appStartup.windowLoad" span - from the start of the
  navigation (the activation, for a prerendered page) to the end of the
  window's load event, its duration being the time to load, with the
  milestones (domInteractiveMs, domContentLoadedMs, domCompleteMs,
  loadEventStartMs, loadHandlersMs) as attributes -, the navigation phase
  child spans ("interopio.api.appStartup.navigation.*" - redirect, dns,
  connect, tls, request, response, domParsing, deferredScripts,
  contentLoadedHandlers, subresources, loadHandlers), the navigation
  metadata and perf.kpi on the root span, perf.resources.count
  and the slowest resource loads as child spans (the latter only when
  instrumentResources is off - it publishes them otherwise).
