Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
achied committed Oct 11, 2012
0 parents commit aecd629
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.gem
*.rbc
.bundle
.config
.rvmrc
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp

# YARD artifacts
.yardoc
_yardoc
doc/
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: ruby
rvm:
- 1.9.2
- 1.9.3
13 changes: 13 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (C) 2012 Eduardo Aceituno <[email protected]> All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source :rubygems

gemspec
86 changes: 86 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
PATH
remote: .
specs:
fluent-plugin-fnordmetric (0.0.1)
fluentd (>= 0.10.7)
fnordmetric (= 1.0.0)

GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
bson (1.7.0)
bson_ext (1.7.0)
bson (~> 1.7.0)
cool.io (1.1.0)
iobuffer (>= 1.0.0)
daemons (1.1.9)
em-hiredis (0.1.1)
hiredis (~> 0.4.0)
em-websocket (0.3.8)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
eventmachine (1.0.0)
fluentd (0.10.26)
cool.io (~> 1.1.0)
http_parser.rb (~> 0.5.1)
json (>= 1.4.3)
msgpack (~> 0.4.4)
yajl-ruby (~> 1.0)
fnordmetric (1.0.0)
activesupport
bson_ext (>= 1.4.0)
em-hiredis (= 0.1.1)
eventmachine
haml
i18n
json
rack
rack-test
redis (>= 2.2.2)
sinatra (>= 1.2.6)
thin (~> 1.3.0)
websocket-rack (= 0.4.0)
yajl-ruby
haml (3.1.7)
hiredis (0.4.5)
http_parser.rb (0.5.3)
i18n (0.6.1)
iobuffer (1.1.2)
json (1.7.5)
msgpack (0.4.7)
multi_json (1.3.6)
rack (1.4.1)
rack-protection (1.2.0)
rack
rack-test (0.6.2)
rack (>= 1.0)
rake (0.9.2.2)
redis (3.0.2)
rr (1.0.4)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3.3)
websocket-rack (0.4.0)
em-websocket (~> 0.3.6)
eventmachine (~> 1.0.0.beta.4)
rack
thin
yajl-ruby (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
fluent-plugin-fnordmetric!
rake (>= 0.9.2)
rr (>= 1.0.0)
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fluent-plugin-fnordmetric
=========================

fnordmetric plugin for fluent Event Collector

[![Build Status](https://secure.travis-ci.org/achied/fluent-plugin-fnordmetric.png)](http://travis-ci.org/achied/fluent-plugin-fnordmetric)


# Getting Started
Setup the fnordmetric onput:

~~~~~
<target test.*>
type fnordmetric
host localhost
port 4242
</target>
~~~~~

14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"

require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.test_files = Dir['test/plugin/*.rb']
test.ruby_opts = ['-rubygems'] if defined? Gem
test.ruby_opts << '-I.'
test.verbose = true
end

task :default => :test
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
23 changes: 23 additions & 0 deletions fluent-plugin-fnordmetric.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)

Gem::Specification.new do |gem|
gem.name = "fluent-plugin-fnordmetric"
gem.version = File.read("VERSION").strip
gem.authors = ["Eduardo Aceituno"]
gem.email = ["[email protected]"]
gem.homepage = "https://github.com/achied/fluent-plugin-fnordmetric"
gem.summary = %q{fnordmetric plugin for fluent, an event collector}
gem.description = %q{fnordmetric plugin for fluent, an event collector}

gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
gem.require_paths = ["lib"]

gem.add_dependency "fluentd", ">= 0.10.7"
gem.add_dependency "fnordmetric", "1.0.0"

gem.add_development_dependency "rake", ">= 0.9.2"
gem.add_development_dependency "rr", ">= 1.0.0"
end
37 changes: 37 additions & 0 deletions lib/fluent/plugin/out_fnordmetric.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module Fluent
class FnordmetricOutPut < Output
Fluent::Plugin.register_output("fnordmetric", self)

def initialize
require 'fnordmetric'

FnordMetric.options = {
:event_queue_ttl => 10,
:event_data_ttl => 10,
:session_data_ttl => 1,
:redis_prefix => "fnordmetric"
}

@api = FnordMetric::API.new
super
end

def configure(conf)
super
end

def start
super
end

def shutdown
super
end

def emit(tag, es, chain)
es.each { |time,record|
@api.event(:_type => :tag, :info => record)
}
end
end
end
4 changes: 4 additions & 0 deletions test/plugin/out_fnordmetric.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test/unit'
require 'fluent/test'
require 'lib/fluent/plugin/out_fnordmetric'
require 'test_helper'
26 changes: 26 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'test/unit'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'fluent/test'
unless ENV.has_key?('VERBOSE')
nulllogger = Object.new
nulllogger.instance_eval {|obj|
def method_missing(method, *args)
# pass
end
}
$log = nulllogger
end

class Test::Unit::TestCase
end

0 comments on commit aecd629

Please sign in to comment.