This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn annotate-event | |
"Applies the context and id field to the provided source event." | |
[source-event id context] | |
(merge source-event {:id id :context context})) | |
(defn contextualize | |
"Parses a source event for identifiers that are representative of contexts (interactions, queues, resources, etc) and | |
annotates + replicates the event based on these contexts." | |
[source-event] | |
(let [{:keys [resource-id queue-id interaction-id]} source-event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defsfn actor-loop | |
"The function that represents our Actors, which are responsible for handling source events. Takes a list of records | |
which implement the Statistic protocol, and loops over receive until all of the records indicate they are finished." | |
[id recs] | |
(register! id @self) | |
(add-child! supervisor-actor id :transient 1 5 :sec 2000 @self) | |
(loop [records recs] | |
(if-let [event (receive [m] :else m :after actor-event-receive-timeout nil)] | |
(if-let [updated-records (actor-body records event)] | |
(recur updated-records) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns stats-service.domain.protocols | |
"Protocols used throughout the stats service." | |
(:refer-clojure :exclude [name]) | |
(:require [co.paralleluniverse.pulsar.core :as a])) | |
(defprotocol Statistic | |
"Base statistic from which all other statistics are derived." | |
(name [this] "Returns the name of this Statistic. Will be used by the Actor to update its map of Records when the Record changes") | |
(context [this] "Returns the context for the Statistic (Interaction, Resource, Queue)") | |
(event-set [this] "Returns the set of events that this Statistic cares about") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns stats-service.handlers.contextualizer | |
"Contextualizes incoming source events, duplicating and delegating throughout the cluster as needed." | |
(:refer-clojure :exclude [promise await]) | |
(:require [zinn.log :as log] | |
[stats-service.handlers.event :as e] | |
[co.paralleluniverse.pulsar.core :refer :all])) | |
(defn delegate-contextualized-events | |
"Interacts with the [store] (dynamodb?) to find which node handles a particular source event. For now, throws things | |
directly on the processing queue of this node until we are actually doing delegation." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn delegate-contextualized-events | |
"Interacts with the [store] (dynamodb?) to find which node handles a particular source event. For now, throws things | |
directly on the processing queue of this node until we are actually doing delegation." | |
[events] | |
(doseq [event events] | |
(snd e/message-queue event))) | |
(defn annotate-event | |
"Applies the context and id field to the provided source event." | |
[source-event id context] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ZSH=/home/sam/.oh-my-zsh | |
ZSH_THEME="robbyrussell" | |
plugins=(git) | |
export PATH="$HOME/bin:$HOME/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/heroku/bin:$PATH" | |
source $ZSH/oh-my-zsh.sh | |
source ~/z.sh | |
alias e="emacs&" | |
# Git Aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"dataSchema" : { | |
"dataSource" : "testing", | |
"parser" : { | |
"type" : "string", | |
"parseSpec" : { | |
"format" : "json", | |
"timestampSpec" : { | |
"column" : "timestamp-utc", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"queryType": "timeseries", | |
"dataSource": "testing", | |
"intervals": ["1980-01-01/2100-01-01"], | |
"granularity": "all", | |
"filter": { | |
"type": "selector", | |
"dimension": "event-type", | |
"value": "resource-conversation-end-instance" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"dataSchema" : { | |
"dataSource" : "testing", | |
"parser" : { | |
"type" : "string", | |
"parseSpec" : { | |
"format" : "json", | |
"timestampSpec" : { | |
"column" : "timestamp-utc", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"dataSchema" : { | |
"dataSource" : "hyperion2", | |
"parser" : { | |
"type" : "string", | |
"parseSpec" : { | |
"format" : "json", | |
"timestampSpec" : { | |
"column" : "timestamp", |
NewerOlder