Debugging and Observing Your Scala Code - Will Sargent

  Рет қаралды 918

ScalaCon

ScalaCon

Күн бұрын

This talk was given at ScalaCon on May 19th, 2021 by Will Sargent.
Debugging and Observing your Scala Code
Imagine that you’re driving on a racetrack at night. There’s no light, and it’s pitch black. There’s a light at the beginning of the course, and a light at the end. The rest of the course is dark. When you say you can’t see where the road is, you’re handed a map of the course. But don’t worry. When you run off the road and into the bushes, you can put a light where you ran off the road so that the next time you try the course, you can see where the road is.
This would be a crazy state of affairs, but it’s how developers are expected to write and debug code these days. We write code with no debugging statements. When we run into a problem, we’ll put debug statements (or breakpoints, if you’re lucky enough to have a local dev environment) where we think something went wrong, and keep doing that until we have a rough idea of what’s happening.
This is entirely backwards. Code maintenance involves reading and understanding code that you didn’t write, and seeing how that code operates in different environments. In production, metrics and error reporting are critically important, while in testing and development, clarity of code flow and data flow is essential. Every single part of the code should be observable by default.
Operations has already realized the need for observability to answer questions about errors in production. Structured operational logging, distributed tracing, and metrics are all commonly used: but there’s a catch. These tools are typically only used to determine and resolve errors and issues in latency. Operational logging capturing an error doesn’t tell you what led up to it. Opentracing instrumentation is typically not fine-grained. Metrics are aggregated and low-cardinality. As developer tools go, they don’t capture the flow of data - they cannot catch logic bugs, they will not handle database corruption or memory leaks, and they typically do not capture changes over time. Worse, these tools are typically aggregated and sampled in production so rare bugs are harder to see.
There is a solution to this: context aware diagnostic logging. Given a sufficiently advanced context, we can determine when to log information at debug or trace level. And between Scala’s implicit support, rich language features like macros for line numbers and type classes, we can provide lightweight logging and instrumentation that aligns with your code so that observability can be turned on and off for a particular flow or a particular user.
Speaker:
Will Sargent
/ will_sargent
---
ScalaCon is organized in partnership by 47 Degrees, Skills Matter, Scala Center, and Lightbend.

Пікірлер: 1
@goldeye00
@goldeye00 2 жыл бұрын
Wonderful logging library! Thank you very much!
The Art of Code - Dylan Beattie
1:00:49
NDC Conferences
Рет қаралды 4,7 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 50 МЛН
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 11 МЛН
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 5 МЛН
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 44 МЛН
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 63 М.
I Reverse Engineered this Program and Generated Infinite CD Keys
11:39
Low Level Learning
Рет қаралды 277 М.
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 169 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 269 М.
Preparing Apache Kafka for Scala 3 - Josep Prat
40:53
ScalaCon
Рет қаралды 853
How To Think Like A Programmer
1:00:07
Coding Tech
Рет қаралды 2 МЛН
Makefiles: 95% of what you need to know
1:01:53
Gabriel Parmer
Рет қаралды 122 М.
Cursor Is Beating VS Code (...by forking it)
18:00
Theo - t3․gg
Рет қаралды 36 М.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 893 М.
The mind behind Linux | Linus Torvalds | TED
21:31
TED
Рет қаралды 6 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 50 МЛН