Class GameStats
- java.lang.Object
-
- org.apache.beam.examples.complete.game.UserScore
-
- org.apache.beam.examples.complete.game.HourlyTeamScore
-
- org.apache.beam.examples.complete.game.LeaderBoard
-
- org.apache.beam.examples.complete.game.GameStats
-
public class GameStats extends LeaderBoard
This class is the fourth in a series of four pipelines that tell a story in a 'gaming' domain, followingUserScore,HourlyTeamScore, andLeaderBoard. New concepts: session windows and finding session duration; use of both singleton and non-singleton side inputs.This pipeline builds on the
LeaderBoardfunctionality, and adds some "business intelligence" analysis: abuse detection and usage patterns. The pipeline derives the Mean user score sum for a window, and uses that information to identify likely spammers/robots. (The robots have a higher click rate than the human users). The 'robot' users are then filtered out when calculating the team scores.Additionally, user sessions are tracked: that is, we find bursts of user activity using session windows. Then, the mean session duration information is recorded in the context of subsequent fixed windowing. (This could be used to tell us what games are giving us greater user retention).
Run
org.apache.beam.examples.complete.game.injector.Injectorto generate pubsub data for this pipeline. TheInjectordocumentation provides more detail.To execute this pipeline, specify the pipeline configuration like this:
--project=YOUR_PROJECT_ID --tempLocation=gs://YOUR_TEMP_DIRECTORY --runner=YOUR_RUNNER --dataset=YOUR-DATASET --topic=projects/YOUR-PROJECT/topics/YOUR-TOPICThe BigQuery dataset you specify must already exist. The PubSub topic you specify should be the same topic to which the Injector is publishing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGameStats.CalculateSpammyUsersFilter out all users but those with a high clickrate, which we will consider as 'spammy' users.static interfaceGameStats.OptionsOptions supported byGameStats.-
Nested classes/interfaces inherited from class org.apache.beam.examples.complete.game.UserScore
UserScore.ExtractAndSumScore
-
-
Constructor Summary
Constructors Constructor Description GameStats()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static java.util.Map<java.lang.String,WriteToBigQuery.FieldInfo<java.lang.Double>>configureSessionWindowWrite()Create a map of information that describes how to write pipeline output to BigQuery.protected static java.util.Map<java.lang.String,WriteToBigQuery.FieldInfo<org.apache.beam.sdk.values.KV<java.lang.String,java.lang.Integer>>>configureWindowedWrite()Create a map of information that describes how to write pipeline output to BigQuery.static voidmain(java.lang.String[] args)-
Methods inherited from class org.apache.beam.examples.complete.game.LeaderBoard
configureBigQueryWrite, configureGlobalWindowBigQueryWrite, configureWindowedTableWrite
-
Methods inherited from class org.apache.beam.examples.complete.game.HourlyTeamScore
configureOutput
-
-
-
-
Method Detail
-
configureWindowedWrite
protected static java.util.Map<java.lang.String,WriteToBigQuery.FieldInfo<org.apache.beam.sdk.values.KV<java.lang.String,java.lang.Integer>>> configureWindowedWrite()
Create a map of information that describes how to write pipeline output to BigQuery. This map is used to write information about team score sums.
-
configureSessionWindowWrite
protected static java.util.Map<java.lang.String,WriteToBigQuery.FieldInfo<java.lang.Double>> configureSessionWindowWrite()
Create a map of information that describes how to write pipeline output to BigQuery. This map is used to write information about mean user session time.
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
-