An introduction to observability
a measure of how well internal states of a system can be inferred from knowledge of its external outputs
logs
metrics
traces
“An event log is an immutable, timestamped record of discrete events that happened over time.”

String orderId = "689";
logger.info("Order {} saved", orderId);
22:53:03.689 [main] INFO MyApplication - Order 689 savedimport static net.logstash.logback.argument.StructuredArguments.v;
…
String orderId = "689";
logger.info("Order {} saved", v("orderId", orderId));
{
"@timestamp": "2019-04-16T22:53:03.689+02:00",
"@version": 1,
"message": "Order 689 saved",
"logger_name": "MyApplication",
"thread_name": "main",
"level": "INFO",
"level_value": 20000,
"orderId": "689"
}




| |

“Metrics are a numeric representation of data measured over intervals of time.“

httpsessions_active 0.0
datasource_primary_active 0.0
mem 2074624.0
mem_free 1526867.0
processors 2.0
uptime 1.8064965529E10
heap_used 547756.0
threads 27.0
classes 12524.0
http_requests{status=200} 19652.0
http_requests{status=404} 42.0
http_requests{status=500} 2.0a value that can only increase
a value that can arbitrarily go up and down
sampled observations counted in buckets (e.g. request durations, response sizes)
the time it takes to service a request; distinguished between successful and failed requests
a measure of how much demand is being placed on the system (e.g. HTTP requests per second)
the rate of requests that fail (e.g., HTTP 500s)
how "full" a service is (e.g. in terms of CPU, memory, I/O)
latency increases are often a leading indicator of saturation
also concerned with predictions, e.g. "the database will fill its hard drive in 4 hours"
Includes many auto-configured metrics about
JVM
memory usage
garbage collection
threads utilization
number of classes loaded/unloaded
CPU
Uptime
HTTP requests
database connections
import io.micrometer.core.instrument.*;
…
@Autowired private MeterRegistry registry;
…
// counter
Counter counter = registry.counter("my_counter", "label_key", "some_value");
counter.increment();
counter.increment(42);
// gauge
List<String> list = new ArrayList<>();
meterRegistry.gauge("my_gauge", list, List::size);
// timer
Timer timer = registry.timer("my_timer");
timer.record(() -> {
// my operation
});
|
|









“A trace is a representation of a series of causally related distributed events that encode the end-to-end request flow through a distributed system.“

represents an individual unit of work done in a distributed system
a collection of spans that share the same ID, representing a unique transaction handled by an application and its constituent services

introduced special HTTP header X-One-Platform-Trace-Id
generated on inital request
passed on to subsequent requests

|
|
|
|
|
