Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Pricing

John Gallagher

👤 Person
314 total appearances

Appearances Over Time

Podcast Appearances

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And so what you'll see is people do this kind of half-hearted, oh, well, we'll add the ID to the current span or the current trace or even the current log. We'll add the ID. And that's okay. That'll be enough. But you're not capturing the state of the object. Why not just take the object, in this case the account, convert it into a hash, and attach it to the event? Why can't we do that?

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And so what you'll see is people do this kind of half-hearted, oh, well, we'll add the ID to the current span or the current trace or even the current log. We'll add the ID. And that's okay. That'll be enough. But you're not capturing the state of the object. Why not just take the object, in this case the account, convert it into a hash, and attach it to the event? Why can't we do that?

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

Now there's a number of reasons why we actually can't do that in some cases. If you're billed in terms of the size of your event, so if you're billed on data, obviously that's going to get expensive fast.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

Now there's a number of reasons why we actually can't do that in some cases. If you're billed in terms of the size of your event, so if you're billed on data, obviously that's going to get expensive fast.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

But if you're billed on pure events, as in your observability provider, your observability tooling, is saying for every X number of events or X number of logs per month, we will charge you this much, but the size doesn't matter. then this is a perfect use case to be taking those rich domain objects, converting them into a structured format, and dumping them in the log or the trace.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

But if you're billed on pure events, as in your observability provider, your observability tooling, is saying for every X number of events or X number of logs per month, we will charge you this much, but the size doesn't matter. then this is a perfect use case to be taking those rich domain objects, converting them into a structured format, and dumping them in the log or the trace.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And so I've kind of thought about this quite a lot, and I've come up with a few quite simple ideas that people can use starting tomorrow in their Rails apps. Not without their problems, but The first of which is, I don't know if anybody's worked with formatted, so two formatted S for date time strings. And we have this idea in Ruby, don't we, of duck typing.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And so I've kind of thought about this quite a lot, and I've come up with a few quite simple ideas that people can use starting tomorrow in their Rails apps. Not without their problems, but The first of which is, I don't know if anybody's worked with formatted, so two formatted S for date time strings. And we have this idea in Ruby, don't we, of duck typing.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

We have an object and really good OO designers that you shouldn't understand anything about that object. You just know it's got four methods on it. And it can be an account. It can be an invoice. It can be many different things. So my approach, and I'm testing this approach out at work at the moment, is instead of having two formatted S, have two formatted H. What does that mean?

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

We have an object and really good OO designers that you shouldn't understand anything about that object. You just know it's got four methods on it. And it can be an account. It can be an invoice. It can be many different things. So my approach, and I'm testing this approach out at work at the moment, is instead of having two formatted S, have two formatted H. What does that mean?

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

It means you're going to format the domain object as a hash. And so to formatted S allows you to pass in a symbol to define the kind of format that you want. So it can be short, ordinal, long, humanized, and it will output a string. It will output a stringified version of that date in these different formats.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

It means you're going to format the domain object as a hash. And so to formatted S allows you to pass in a symbol to define the kind of format that you want. So it can be short, ordinal, long, humanized, and it will output a string. It will output a stringified version of that date in these different formats.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So my idea is, why can't we have a method on every single domain object in our Rails app called toFormattedH, and you pass it in a format. That format could be then OpenTelemetry. It could be any one of the numbers, a short, compact. And so for every trace, the way I like to think of it is, I want to, into that trace, add every object that's related to that.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So my idea is, why can't we have a method on every single domain object in our Rails app called toFormattedH, and you pass it in a format. That format could be then OpenTelemetry. It could be any one of the numbers, a short, compact. And so for every trace, the way I like to think of it is, I want to, into that trace, add every object that's related to that.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And you could format those in OpenTelemetry format, for example, or you could have a full format or a long format, whatever you want. And so that way you can say, oh, I just want to, I want a representation of the account that is short and it's just got the ID. And that's a totally minimal skeleton. And that's enough for me. But actually here, the work I'm doing is a bit more involved.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

And you could format those in OpenTelemetry format, for example, or you could have a full format or a long format, whatever you want. And so that way you can say, oh, I just want to, I want a representation of the account that is short and it's just got the ID. And that's a totally minimal skeleton. And that's enough for me. But actually here, the work I'm doing is a bit more involved.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So I want to call to formatted H with full. And that will give the full account, like the updated app, created app, everything about it. And then that will be sent to my logs and traces. And I now have a standardized way of observing what's going on with all the rich data of my app state at that point with all the relevant domain objects in it.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So I want to call to formatted H with full. And that will give the full account, like the updated app, created app, everything about it. And then that will be sent to my logs and traces. And I now have a standardized way of observing what's going on with all the rich data of my app state at that point with all the relevant domain objects in it.

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So that's my dream that I'm headed towards with this gem. So that's kind of the way I think about structuring it. And I think about the, like, people, I see people doing all this ad hoc kind of, well, this is an ID, and then we'll call the job ID, job underscore ID, I suppose. And what's the account? We can call that account underscore ID. And I just like to think of it as,

Ruby Rogues
Practical Observability: Logging, Tracing, and Metrics for Better Debugging - RUBY 656

So that's my dream that I'm headed towards with this gem. So that's kind of the way I think about structuring it. And I think about the, like, people, I see people doing all this ad hoc kind of, well, this is an ID, and then we'll call the job ID, job underscore ID, I suppose. And what's the account? We can call that account underscore ID. And I just like to think of it as,