gctoolkit icon indicating copy to clipboard operation
gctoolkit copied to clipboard

Rethink GCToolKit API flow: GCAnalyzer returns GCAnalysis

Open brunoborges opened this issue 4 years ago • 6 comments
trafficstars

For discussion:

Bruno and I had a discussion about this API in general. It was very refreshing to have his un-initiated perspective here. One of the ideas he tossed into the ring was having an 'analyzer' API, to which my response was that is what GCToolkit is.

Later, I got to thinking about it and I see where he's coming from. I think, perhaps, we should rename the GCToolKit class to GCAnalyzer, and have the analyze method return a GCAnalysis which would be what JavaVirtualMachine is now. I think this would make it more clear to the user what to do and what to use.

Thoughts?

Originally posted by @dsgrieve in https://github.com/microsoft/gctoolkit/pull/70#issuecomment-910364145

brunoborges avatar Sep 01 '21 17:09 brunoborges

This is also related to #6.

// @kcpeppe @karianna

brunoborges avatar Sep 01 '21 17:09 brunoborges

I agree that the name of JavaVirtualMachine could be improved to more accurately represent what it is (which is really the GC information for that JVM as pulled out of the log). I'm not 100% sure it's a full analysis though, more of a model?

karianna avatar Sep 01 '21 17:09 karianna

@kcpeppe you mentioned the following:

It sounds good but we’re not offering a GC analysis.

And that is correct. Perhaps the method analyze(dataSource) shouldn't be called that. It should be called aggregate then?

brunoborges avatar Sep 01 '21 18:09 brunoborges

I'll be frank here and state my opinion that what we have now for an API is unsatisfactory. The API is designed to support the Censum way of modeling which makes it difficult for anyone else to use. The Aggregators/Aggregations, and the whole of gctoolkit-vertx, is a layer of abstraction that is unnecessary. I believe that the majority of users want to just get a stream of events from the parser:

GCLogFile logFile = new GCLogFile(path);
Stream<JVMEvent> jvmEventStream = GCLogParser.parse(logFile); 

dsgrieve avatar Oct 08 '21 13:10 dsgrieve

Can we offer both? That is have an opinionated API that we know clients use today, as well as a raw 'data stream' API?

karianna avatar Oct 08 '21 20:10 karianna

@karianna There is value to the current API. In my opinion, the current API should be built on a more fundamental API.

dsgrieve avatar Oct 12 '21 14:10 dsgrieve

completed with refactoring

ghost avatar Jan 25 '23 20:01 ghost