<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Observability Primer | OpenTelemetry</title>
</head>
<body>
<div class="td-content">
<h1>Observability Primer</h1>
<p><em>Observability</em> is the ability to measure the internal state of a system by examining its outputs. In the context of software, this means being able to understand the internal state of a system by looking at the data it produces, including logs, metrics, and traces.</p>
<p>A system is considered <em>observable</em> if you can quickly and consistently ask any question about it and get useful answers by looking at the system's outputs alone. In other words, you don't need to ship new code to answer new questions about your system's behavior.</p>
<h2>Reliability and Metrics</h2>
<p>Telemetry refers to data emitted from a system, about its behavior. The data can come in the form of <a href="https://opentelemetry.io/docs/concepts/signals/traces/">traces</a>, <a href="https://opentelemetry.io/docs/concepts/signals/metrics/">metrics</a>, and <a href="https://opentelemetry.io/docs/concepts/signals/logs/">logs</a>.</p>
<h2>Understanding Distributed Systems</h2>
<div class="note">
<p><strong>Note:</strong> OpenTelemetry is a collection of tools, APIs, and SDKs. Use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to help you analyze your software's performance and behavior.</p>
</div>
<p>A distributed system is a collection of independent services, often running in different processes, on different machines, that work together to accomplish a task that would be difficult or impossible for any single service to accomplish alone.</p>
<h2>Telemetry Signals</h2>
<p>OpenTelemetry defines three core telemetry signals:</p>
<ul>
<li><strong>Traces</strong> - A trace is a collection of spans that represents a single request as it flows through a distributed system.</li>
<li><strong>Metrics</strong> - Metrics are numerical measurements that can be used to monitor the performance and health of a system.</li>
<li><strong>Logs</strong> - Logs are timestamped text records, either structured or unstructured, with metadata.</li>
</ul>
<h2>Getting Started with Instrumentation</h2>
<p>The following is an example of how to instrument a simple Node.js application:</p>
<pre><code class="language-javascript">
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const sdk = new NodeSDK({
instrumentations: [getNodeAutoInstrumentations()]
});
sdk.start();
console.log('OpenTelemetry started successfully');
</code></pre>
<p>To run this example, you would first install the required packages:</p>
<pre><code class="language-shell">
npm install @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node
</code></pre>
<p>OpenTelemetry provides automatic instrumentation for many popular libraries and frameworks, making it easy to get started with observability in your applications.</p>
</div>
</body>
</html>