{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/beats/pulls/comments/71313680","id":71313680,"diff_hunk":"@@ -0,0 +1,200 @@\n+package cassandra\n+\n+import (\n+\t\"time\"\n+\n+\t\"github.com/elastic/beats/libbeat/common\"\n+\t\"github.com/elastic/beats/libbeat/logp\"\n+\n+\t\"github.com/elastic/beats/packetbeat/protos\"\n+\t\"github.com/elastic/beats/packetbeat/protos/tcp\"\n+\t\"github.com/elastic/beats/packetbeat/publish\"\n+)\n+\n+// cassandra application level protocol analyzer plugin\n+type cassandra struct {\n+\tports        protos.PortsConfig\n+\tparserConfig parserConfig\n+\ttransConfig  transactionConfig\n+\tpub          transPub\n+}\n+\n+// Application Layer tcp stream data to be stored on tcp connection context.\n+type connection struct {\n+\tstreams [2]*stream\n+\ttrans   transactions\n+}\n+\n+// Uni-directioal tcp stream state for parsing messages.\n+type stream struct {\n+\tparser parser\n+}\n+\n+var (\n+\tdebugf = logp.MakeDebug(\"cassandra\")\n+\n+\t// use isDebug/isDetailed to guard debugf/detailedf to minimize allocations\n+\t// (garbage collection) when debug log is disabled.\n+\tisDebug = false\n+)\n+\n+func init() {\n+\tprotos.Register(\"cassandra\", New)\n+}\n+\n+// New create and initializes a new cassandra protocol analyzer instance.\n+func New(\n+\ttestMode bool,\n+\tresults publish.Transactions,\n+\tcfg *common.Config,\n+) (protos.Plugin, error) {\n+\tp := &cassandra{}\n+\tconfig := defaultConfig\n+\tif !testMode {\n+\t\tif err := cfg.Unpack(&config); err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\n+\tif err := p.init(results, &config); err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn p, nil\n+}\n+\n+func (cassandra *cassandra) init(results publish.Transactions, config *cassandraConfig) error {\n+\tif err := cassandra.setFromConfig(config); err != nil {\n+\t\treturn err\n+\t}\n+\tcassandra.pub.results = results\n+\n+\tisDebug = logp.IsDebug(\"http\")\n+\treturn nil\n+}\n+\n+func (cassandra *cassandra) setFromConfig(config *cassandraConfig) error {\n+\n+\t// set module configuration\n+\tif err := cassandra.ports.Set(config.Ports); err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// set parser configuration\n+\tparser := &cassandra.parserConfig\n+\tparser.maxBytes = tcp.TCP_MAX_DATA_IN_STREAM\n+\n+\t// set parser's compressor, only `snappy` supported right now\n+\tif config.Compressor == Snappy {\n+\t\tparser.compressor = SnappyCompressor{}\n+\t} else {\n+\t\tparser.compressor = nil\n+\t}","path":"packetbeat/protos/cassandra/cassandra.go","position":91,"original_position":91,"commit_id":"3fcf72745d327a6f0d313b1c4d4ce0955cf99c3a","original_commit_id":"a8f9a90b739853bc8132cfceb21c9c941cbfece8","user":{"login":"urso","id":75886,"avatar_url":"https://avatars.githubusercontent.com/u/75886?v=3","gravatar_id":"","url":"https://api.github.com/users/urso","html_url":"https://github.com/urso","followers_url":"https://api.github.com/users/urso/followers","following_url":"https://api.github.com/users/urso/following{/other_user}","gists_url":"https://api.github.com/users/urso/gists{/gist_id}","starred_url":"https://api.github.com/users/urso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urso/subscriptions","organizations_url":"https://api.github.com/users/urso/orgs","repos_url":"https://api.github.com/users/urso/repos","events_url":"https://api.github.com/users/urso/events{/privacy}","received_events_url":"https://api.github.com/users/urso/received_events","type":"User","site_admin":false},"body":"naming the compression algorithm is part of the startup-method. There is a chance we never see the startup-message, but if we do, we should check the compressor matches.\r\n\r\nIf decompression fails (indicator of wrong compressor being configured), we should set the stream state to don't follow stopping processing of all compressed frames (uncompressed frames can still be processed).","created_at":"2016-07-19T10:33:20Z","updated_at":"2016-07-19T10:33:20Z","html_url":"https://github.com/elastic/beats/pull/1959#discussion_r71313680","pull_request_url":"https://api.github.com/repos/elastic/beats/pulls/1959","_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments/71313680"},"html":{"href":"https://github.com/elastic/beats/pull/1959#discussion_r71313680"},"pull_request":{"href":"https://api.github.com/repos/elastic/beats/pulls/1959"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/beats/pulls/1959","id":76241126,"html_url":"https://github.com/elastic/beats/pull/1959","diff_url":"https://github.com/elastic/beats/pull/1959.diff","patch_url":"https://github.com/elastic/beats/pull/1959.patch","issue_url":"https://api.github.com/repos/elastic/beats/issues/1959","number":1959,"state":"open","locked":false,"title":"Support protocol: Cassandra","user":{"login":"medcl","id":64487,"avatar_url":"https://avatars.githubusercontent.com/u/64487?v=3","gravatar_id":"","url":"https://api.github.com/users/medcl","html_url":"https://github.com/medcl","followers_url":"https://api.github.com/users/medcl/followers","following_url":"https://api.github.com/users/medcl/following{/other_user}","gists_url":"https://api.github.com/users/medcl/gists{/gist_id}","starred_url":"https://api.github.com/users/medcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medcl/subscriptions","organizations_url":"https://api.github.com/users/medcl/orgs","repos_url":"https://api.github.com/users/medcl/repos","events_url":"https://api.github.com/users/medcl/events{/privacy}","received_events_url":"https://api.github.com/users/medcl/received_events","type":"User","site_admin":false},"body":"This PR is for this issue:\r\nhttps://github.com/elastic/beats/issues/1958\r\n\r\n","created_at":"2016-07-05T09:15:28Z","updated_at":"2016-07-19T10:33:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f8f8fa9e564777365921066ca6472805e2e752f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/beats/pulls/1959/commits","review_comments_url":"https://api.github.com/repos/elastic/beats/pulls/1959/comments","review_comment_url":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/beats/issues/1959/comments","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/3fcf72745d327a6f0d313b1c4d4ce0955cf99c3a","head":{"label":"medcl:cassandra","ref":"cassandra","sha":"3fcf72745d327a6f0d313b1c4d4ce0955cf99c3a","user":{"login":"medcl","id":64487,"avatar_url":"https://avatars.githubusercontent.com/u/64487?v=3","gravatar_id":"","url":"https://api.github.com/users/medcl","html_url":"https://github.com/medcl","followers_url":"https://api.github.com/users/medcl/followers","following_url":"https://api.github.com/users/medcl/following{/other_user}","gists_url":"https://api.github.com/users/medcl/gists{/gist_id}","starred_url":"https://api.github.com/users/medcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medcl/subscriptions","organizations_url":"https://api.github.com/users/medcl/orgs","repos_url":"https://api.github.com/users/medcl/repos","events_url":"https://api.github.com/users/medcl/events{/privacy}","received_events_url":"https://api.github.com/users/medcl/received_events","type":"User","site_admin":false},"repo":{"id":43449442,"name":"beats","full_name":"medcl/beats","owner":{"login":"medcl","id":64487,"avatar_url":"https://avatars.githubusercontent.com/u/64487?v=3","gravatar_id":"","url":"https://api.github.com/users/medcl","html_url":"https://github.com/medcl","followers_url":"https://api.github.com/users/medcl/followers","following_url":"https://api.github.com/users/medcl/following{/other_user}","gists_url":"https://api.github.com/users/medcl/gists{/gist_id}","starred_url":"https://api.github.com/users/medcl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medcl/subscriptions","organizations_url":"https://api.github.com/users/medcl/orgs","repos_url":"https://api.github.com/users/medcl/repos","events_url":"https://api.github.com/users/medcl/events{/privacy}","received_events_url":"https://api.github.com/users/medcl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/medcl/beats","description":"Open Source Real-Time Packet Analyzer","fork":true,"url":"https://api.github.com/repos/medcl/beats","forks_url":"https://api.github.com/repos/medcl/beats/forks","keys_url":"https://api.github.com/repos/medcl/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medcl/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medcl/beats/teams","hooks_url":"https://api.github.com/repos/medcl/beats/hooks","issue_events_url":"https://api.github.com/repos/medcl/beats/issues/events{/number}","events_url":"https://api.github.com/repos/medcl/beats/events","assignees_url":"https://api.github.com/repos/medcl/beats/assignees{/user}","branches_url":"https://api.github.com/repos/medcl/beats/branches{/branch}","tags_url":"https://api.github.com/repos/medcl/beats/tags","blobs_url":"https://api.github.com/repos/medcl/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medcl/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medcl/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/medcl/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medcl/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/medcl/beats/languages","stargazers_url":"https://api.github.com/repos/medcl/beats/stargazers","contributors_url":"https://api.github.com/repos/medcl/beats/contributors","subscribers_url":"https://api.github.com/repos/medcl/beats/subscribers","subscription_url":"https://api.github.com/repos/medcl/beats/subscription","commits_url":"https://api.github.com/repos/medcl/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/medcl/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/medcl/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/medcl/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/medcl/beats/contents/{+path}","compare_url":"https://api.github.com/repos/medcl/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medcl/beats/merges","archive_url":"https://api.github.com/repos/medcl/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medcl/beats/downloads","issues_url":"https://api.github.com/repos/medcl/beats/issues{/number}","pulls_url":"https://api.github.com/repos/medcl/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/medcl/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/medcl/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medcl/beats/labels{/name}","releases_url":"https://api.github.com/repos/medcl/beats/releases{/id}","deployments_url":"https://api.github.com/repos/medcl/beats/deployments","created_at":"2015-09-30T17:57:03Z","updated_at":"2016-05-05T03:41:33Z","pushed_at":"2016-07-18T08:22:09Z","git_url":"git://github.com/medcl/beats.git","ssh_url":"git@github.com:medcl/beats.git","clone_url":"https://github.com/medcl/beats.git","svn_url":"https://github.com/medcl/beats","homepage":"https://www.elastic.co/products/beats/packetbeat","size":35671,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"2f3885f6e19ec671054f2d6faf68b45c949db2d2","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":16554739,"name":"beats","full_name":"elastic/beats","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/beats","description":":tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash ","fork":false,"url":"https://api.github.com/repos/elastic/beats","forks_url":"https://api.github.com/repos/elastic/beats/forks","keys_url":"https://api.github.com/repos/elastic/beats/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/beats/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/beats/teams","hooks_url":"https://api.github.com/repos/elastic/beats/hooks","issue_events_url":"https://api.github.com/repos/elastic/beats/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/beats/events","assignees_url":"https://api.github.com/repos/elastic/beats/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/beats/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/beats/tags","blobs_url":"https://api.github.com/repos/elastic/beats/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/beats/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/beats/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/beats/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/beats/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/beats/languages","stargazers_url":"https://api.github.com/repos/elastic/beats/stargazers","contributors_url":"https://api.github.com/repos/elastic/beats/contributors","subscribers_url":"https://api.github.com/repos/elastic/beats/subscribers","subscription_url":"https://api.github.com/repos/elastic/beats/subscription","commits_url":"https://api.github.com/repos/elastic/beats/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/beats/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/beats/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/beats/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/beats/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/beats/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/beats/merges","archive_url":"https://api.github.com/repos/elastic/beats/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/beats/downloads","issues_url":"https://api.github.com/repos/elastic/beats/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/beats/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/beats/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/beats/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/beats/labels{/name}","releases_url":"https://api.github.com/repos/elastic/beats/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/beats/deployments","created_at":"2014-02-05T19:01:02Z","updated_at":"2016-07-19T09:15:32Z","pushed_at":"2016-07-19T10:25:10Z","git_url":"git://github.com/elastic/beats.git","ssh_url":"git@github.com:elastic/beats.git","clone_url":"https://github.com/elastic/beats.git","svn_url":"https://github.com/elastic/beats","homepage":"https://www.elastic.co/products/beats","size":41627,"stargazers_count":2975,"watchers_count":2975,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":495,"mirror_url":null,"open_issues_count":280,"forks":495,"open_issues":280,"watchers":2975,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/beats/pulls/1959"},"html":{"href":"https://github.com/elastic/beats/pull/1959"},"issue":{"href":"https://api.github.com/repos/elastic/beats/issues/1959"},"comments":{"href":"https://api.github.com/repos/elastic/beats/issues/1959/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/beats/pulls/1959/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/beats/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/beats/pulls/1959/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/beats/statuses/3fcf72745d327a6f0d313b1c4d4ce0955cf99c3a"}}}}
{"actor":{"display_login":"urso"}}