Giter Site home page Giter Site logo

traffic-spy's People

Contributors

whithub avatar levthedev avatar with-a-k avatar rwarbelow avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

traffic-spy's Issues

Event Index: No Events

As a user, when I go to .../sources/(identifier)/events but there are no events, I should get a message that says so.

Event Detail: Hourly Receptions

As a user, when I go to .../sources/(identifier)/events/(eventname) I should see the number of times each event was received for every hour of the day.

Processing Requests

Possible Outcomes:

As a user,
When I send a POST request to
http://yourapplication:port/sources/IDENTIFIER/data
with a Missing Payload
Then I expect a 400 Bad Request response with a descriptive error message.

As a user,
When I send a POST request to
http://yourapplication:port/sources/IDENTIFIER/data
with an identical payload
Then I expect a 403 Forbidden response with a descriptive error message that it's
"Already Received Request"

As a user,
When I send a POST request to
http://yourapplication:port/sources/IDENTIFIER/data
with an unknown Identifier
Then I expect a 403 Forbidden response with a descriptive error message that
"Application Not Registered"

As a user,
When I send a POST request to
http://yourapplication:port/sources/IDENTIFIER/data
with a unique identifier and payload
Then I expect a Success - 200 OKresponse and POST is complete

Identifier: Screen resolution breakdowns

As a user, when I go to .../sources/(identifier) I should see the screen resolution (or window size) my website was viewed in, in descending order of frequency.

most requested urls

when a user goes to localhost/port/sources/identifier, they see a list of all the statistics, starting with most requested urls.

Viewing Specific Event Details

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/events/EVENTNAME
with defined event
Then I expect to be returned a page that displays the following;

Hour by hour breakdown of when the event was received.
How many were shown per hour?
How many were shown in 24 hours?
How many times it was recieved overall

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/events/EVENTNAME
with an event that has been not defined
Then I expect to be returned a 400 Bad Request response with a descriptive error message that states "o event with the given name has been defined".

Views

Create view files for:

Index
Error
Sources
Data
Event(s)
URL Stats

Create Sources & Payloads Table

rake db:create_migration NAME=create_sources_table..

rake db:create_migration NAME=create_payloads_table

add_column to payloads tables with each payload attribute, as we go...

Identifier: Response times

As a user, when I go to .../sources/(identifier) I should see all of my site's URLs in descending order of average response time.

Viewing Data & Stats

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER
with an existing identifier
Then I expect to be returned a page that displays the following;

Most requested URLS to least requested URLS (url)
Web browser breakdown across all requests (userAgent)
OS breakdown across all requests (userAgent)
Screen Resolution across all requests (resolutionWidth x resolutionHeight)
Longest, average response time per URL to shortest, average response time per URL
Hyperlinks of each url to view url specific data
Hyperlink to view aggregate event data

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER
with an identifier that does not exist/was not registered
Then I expect to be returned a 403 Forbidden response with a descriptive error message that states "Identifier does not exist"

HTML for Views (split up further)

Split up view files to HTML/CSS btwn group. STYLE!

Index -- Erik
Error -- Erik
Sources -- Whitney
Data -- Whitney
Event(s) -- Lev
URL Stats - Lev

Event Index: Event-specific links

As a user, when I go to .../sources/(identifier)/events I should see all the events which lead to my website as links to view more information about that event.

Event Detail: Total Receptions

As a user, when I go to .../sources/(identifier)/events/(eventname) I should see the total number of times that event was received.

Viewing Application URL Stats

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/urls/RELATIVE/PATH
with an existing url
Then I expect to be returned a page that displays the following;

Longest response time
Shortest response time
Average response time
Which HTTP verbs have been used
Most popular referrrers
Most popular user agents

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/urls/RELATIVE/PATH
with an url that does not exist
Then I expect to be returned a 400 Bad Request response with a descriptive error message that states "URL has not been requested"

Change the payload to SHA

Digest::SHA1.hexdigest(string_payload) --- Wil provide the incoming string payload to be unique. Will be usful with error messages and whether or not this request already exists.

Identifier: DNE

As a user, when I go to .../sources/(identifier) but the identifier doesn't exist, I should get a message saying so.

JSON the incoming string payload

@DaTa = JSON.parse(string payload)

JSON changes the incoming string payload into a hash that we'll be able to use when we get to storing each attribute of the payload in our table and referencing it later.

Analyze Payload Info After Extraction

t.text :payhash
t.text :url
t.datetime :requestedat
t.integer :respondedin
t.text :referredby
t.text :requesttype
t.varchar :parameters
t.text :eventname
t.text :useragent
t.integer :resolutionwidth
t.integer :resolutionheight
t.integer :ip

datetime might be tricky..... UTC format once in ActiveRecord

Identifier: URL-specific links

As a user, when I go to .../sources/(identifier) I should see all of my site's URLs and links to a page to get more specific information about each one as well as a link to view information by event.

Viewing Data & Stats - UserAgent!!

SO TRICKY!!!

RegEx??

Web browser breakdown across all requests (userAgent)
We need to pull out each browser within the userAgent attribute in teh payload.

OS breakdown across all requests (userAgent)

Event Detail: Event DNE

As a user, when I go to .../sources/(identifier)/events/(eventname) but there isn't an event with that name, I should see a message to that effect and a link back to the main events index.

Testing for Models

*source_test
*payload_test
test_incoming_payload_attributes_get_assigned

*source_validator_test

*payload_validator_test
test_incoming_payload_attributes_get_saved_to_payloads_table

Event Index - Reception Frequency

As a user, when I go to .../sources/(identifier)/events I should see all the events which lead to my website in descending order of frequency.

Extract Payload Info & Store

parsed_payload = JSON.parse the incoming string payload

Further parse the "parsed_payload" into the payloads table & save.

Do so by assigning the value of each (camelcased) key in the parsed_payload hash to a (snake_cased) named column that matches that key.

(request_at = requestedAt)

Testing Processing a Request

test_invalid_identifier_errors
Missing Payload - 400 Bad Request
Already Received Request - 403 Forbidden
Application Not Registered - 403 Forbidden
Success - 200 OK

test_valid_payload_structure_gets_logged

test_already_received_payload

Viewing Application Details

Work through together as group? Or split up work?

When an identifer exists return a page that displays the following:

Most requested URLS to least requested URLS (url)
Web browser breakdown across all requests (userAgent)
OS breakdown across all requests (userAgent)
Screen Resolution across all requests (resolutionWidth x resolutionHeight)
Longest, average response time per URL to shortest, average response time per URL
Hyperlinks of each url to view url specific data
Hyperlink to view aggregate event data
When an identifier does not exist return a page that displays the following:

Message that the identifier does not exist

Testing for Source Registration

Missing Payload - 400 Bad Request
Already Received Request - 403 Forbidden
Application Not Registered - 403 Forbidden
Success - 200 OK

By using last_response.status and last_response.body:

test_valid_registration_with_identifier_and_rooturl

test_invalid_registration_with_no_identifier

test_invalid_registration_with_no_rooturl

test_invalid_registration_with_existent_identifier

Unique Payloads

Make a unique key for each payload (SHA) that will help identify/validate it later on so the app can recognize if two identical payloads are being submitted.

If the payload is missing return status 400 Bad Request with a descriptive error message.

If the request payload has already been received return status 403 Forbidden with a descriptive error message.

When data is submitted to an application URL that does not exist, return a 403 Forbidden with a descriptive error message.

When the request contains a unique payload return status 200 OK.

Viewing Event Index

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/events
with defined events
Then I expect to be returned a page that displays the following;

Most received event to least received event
Hyperlinks of each event to view event specific data

As a client,
When I send a GET request to
http://yourapplication:port/sources/IDENTIFIER/events
with events have been not defined
Then I expect to be returned a 400 Bad Request response with a descriptive error message that states "no events have been defined".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.