Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* Note that the methods of this class are deliberately not thread-safe, because they should
* always be called from EventProcessor's single message-processing thread.
*/
final class AggregatedEventSummarizer implements EventSummarizerInterface {
public final class AggregatedEventSummarizer implements EventSummarizerInterface {
private final EventSummarizer summarizer;

AggregatedEventSummarizer() {
public AggregatedEventSummarizer() {
this.summarizer = new EventSummarizer();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,28 @@
* handling of context data and private attribute redaction is implemented in EventContextFormatter
* and tested in more detail in EventContextFormatterTest.
*/
final class EventOutputFormatter {
public final class EventOutputFormatter {
private final EventContextFormatter contextFormatter;
private final boolean redactAnonymousAllEvents;

EventOutputFormatter(EventsConfiguration config) {
public EventOutputFormatter(EventsConfiguration config) {
this.contextFormatter = new EventContextFormatter(
config.allAttributesPrivate,
config.privateAttributes.toArray(new AttributeRef[config.privateAttributes.size()]));
this.redactAnonymousAllEvents = config.redactAnonymousAllEvents;
}

int writeOutputEvents(Event[] events, List<EventSummarizer.EventSummary> summaries, Writer writer) throws IOException {
/**
* Writes events and summaries as the JSON array that makes up a request body.
*
* @param events the individual events to write
* @param summaries the summaries to write; empty ones are skipped
* @param writer where to write the JSON
* @return how many output events were written, counting each summary as one
* @throws IOException if the writer failed
*/
public int writeOutputEvents(Event[] events, List<EventSummarizer.EventSummary> summaries, Writer writer)
throws IOException {
int count = 0;
JsonWriter jsonWriter = new JsonWriter(writer);
jsonWriter.beginArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* methods of this class are deliberately not thread-safe, because they should always
* be called from EventProcessor's single message-processing thread.
*/
final class EventSummarizer {
public final class EventSummarizer {
private EventSummary eventsState;
private final LDContext context; // nullable - only set for per-context summarization

Expand Down Expand Up @@ -85,7 +85,10 @@ void clear() {
eventsState = new EventSummary(context);
}

static final class EventSummary {
/**
* A snapshot of the evaluations counted since the last reset.
*/
public static final class EventSummary {
final Map<String, FlagInfo> counters;
long startDate;
long endDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Note that implementations are deliberately not thread-safe, as they should always
* be called from EventProcessor's single message-processing thread.
*/
interface EventSummarizerInterface {
public interface EventSummarizerInterface {
/**
* Adds information about an evaluation to the summary.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* Note that the methods of this class are deliberately not thread-safe, because they should
* always be called from EventProcessor's single message-processing thread.
*/
final class PerContextEventSummarizer implements EventSummarizerInterface {
public final class PerContextEventSummarizer implements EventSummarizerInterface {
private final Map<LDContext, EventSummarizer> summarizersByContext;

PerContextEventSummarizer() {
public PerContextEventSummarizer() {
this.summarizersByContext = new HashMap<>();
}

Expand Down
Loading