pier 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 242d50f767dc92b3e7e7e62b1c6ccd43dced1a69
4
- data.tar.gz: 7c94dc03fa55bf10cbe1cd060bae78257c565405
2
+ SHA256:
3
+ metadata.gz: ecab9eae84ec8dac26368c8ccecc9ae11f886d828568acb22f6f7eb34469d8c3
4
+ data.tar.gz: e2b59b05f6bc5b9e696703a3610ce81bade493fc3eec15a2ec256da13ee7f5f9
5
5
  SHA512:
6
- metadata.gz: a0d3efbecfd2c6f0cef1927eace4c292be757fadc828f9639a02e2a747e14235f523b1cea2adbd0b360805a311a606a65051a3b8473d67fd8a99e1f894ada3ba
7
- data.tar.gz: 2c148174651a433f6a8e25af66eda4a9ad50d4988f5d3f6e0d76db5dd7e37142514302cef697d8e995b2b4d0eb6c6a97f3e050a074e9d027ab46a2119d06d119
6
+ metadata.gz: d686802524598c83823cfd4994be754513c780e7ba0165d9e400b212befe46fdaf0f1fe496558b3c4279d86fde14ecc5842b6d5cc742acfe6997015e023b194d
7
+ data.tar.gz: 4d658ca5d3613711ce5d7a639d5815f311361a0330801eb41bdd86cac46a0d6bd6b3d466fc93b516c0d04b3b3a9403a8c2f33ea87fc80c745435ae9f05f85778
data/.gitignore CHANGED
@@ -7,8 +7,3 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.2
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2014 Arvind Kunday
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2016 Arvind Kunday
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,24 +1,15 @@
1
- # Docker::Registry
1
+ # Pier
2
2
 
3
- Docker Registry is an alternative implementation for the private docker registry
4
- provided by docker. It provides the following:
5
-
6
- 1. Export contents of an image and all it's layers as a tar.gz file(docker save).
7
- 2. Import contents of an image and all it's layers(docker import).
8
- 3. Listing Repositories.
9
- 4. Listing different version of a particular repository.
10
- 5. Better access control via AWS IAM Roles.
11
- 6. Delete old docker images.
12
- 7. An immutable representation of the docker image history at a particular point
13
- in time.
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pier`. To experiment with that code, run `bin/console` for an interactive prompt.
14
4
 
5
+ TODO: Delete this and the text above, and describe your gem
15
6
 
16
7
  ## Installation
17
8
 
18
9
  Add this line to your application's Gemfile:
19
10
 
20
11
  ```ruby
21
- gem 'docker-registry'
12
+ gem 'pier'
22
13
  ```
23
14
 
24
15
  And then execute:
@@ -27,16 +18,24 @@ And then execute:
27
18
 
28
19
  Or install it yourself as:
29
20
 
30
- $ gem install docker-registry
21
+ $ gem install pier
31
22
 
32
23
  ## Usage
33
24
 
34
25
  TODO: Write usage instructions here
35
26
 
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
36
33
  ## Contributing
37
34
 
38
- 1. Fork it ( https://github.com/[my-github-username]/docker-registry/fork )
39
- 2. Create your feature branch (`git checkout -b my-new-feature`)
40
- 3. Commit your changes (`git commit -am 'Add some feature'`)
41
- 4. Push to the branch (`git push origin my-new-feature`)
42
- 5. Create a new Pull Request
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
1
  require "bundler/gem_tasks"
2
-
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pier"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/pier ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pier"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pier
4
+ module PageRequest
5
+ class Logger
6
+ def initialize(client:, namespace:)
7
+ @client = client
8
+ @namespace = namespace
9
+ end
10
+
11
+ def call(name, started, finished, unique_id, payload)
12
+ log_message = {
13
+ application: namespace,
14
+ request_id: unique_id,
15
+ path: payload[:path],
16
+ format: payload[:format],
17
+ controller: payload[:controller],
18
+ action: payload[:action],
19
+ timestamp: Time.now.utc.iso8601(6),
20
+ view_runtime: payload[:view_runtime],
21
+ db_runtime: payload[:db_runtime],
22
+ status: payload[:status],
23
+ }
24
+ ActiveSupport::Logger.new(STDOUT).info(log_message.to_json)
25
+ end
26
+
27
+ private
28
+
29
+ attr_reader :client, :namespace, :application
30
+
31
+ def tags(payload:)
32
+ %W[
33
+ controller:#{payload[:controller]}
34
+ action:#{payload[:action]}
35
+ format:#{payload[:format]}
36
+ method:#{payload[:method]}
37
+ path:#{payload[:path]}
38
+ status:#{payload[:status]}
39
+ view_runtime:#{payload[:view_runtime]}
40
+ db_runtime:#{payload[:db_runtime]}
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+ require 'datadog/statsd'
3
+
4
+ module Pier
5
+ module PageRequest
6
+ class Metric
7
+ def initialize(client:, namespace:)
8
+ @client = client
9
+ @namespace = namespace
10
+ end
11
+
12
+ def call(name, started, finished, unique_id, payload)
13
+ client.increment(
14
+ "#{namespace}.http",
15
+ tags: tags(payload: payload)
16
+ )
17
+ client.histogram(
18
+ "#{namespace}.http.response_time",
19
+ payload[:view_runtime].to_f + payload[:db_runtime].to_f,
20
+ tags: tags(payload: payload)
21
+ )
22
+
23
+ if payload[:view_runtime]
24
+ client.histogram(
25
+ "#{namespace}.http.response_time.views",
26
+ payload[:view_runtime].to_f,
27
+ tags: tags(payload: payload)
28
+ )
29
+ end
30
+
31
+ if payload[:db_runtime]
32
+ client.histogram(
33
+ "#{namespace}.http.response_time.db",
34
+ payload[:db_runtime].to_f,
35
+ tags: tags(payload: payload)
36
+ )
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :client, :namespace
43
+
44
+ def tags(payload:)
45
+ %W[
46
+ controller:#{payload[:controller]}
47
+ action:#{payload[:action]}
48
+ format:#{payload[:format]}
49
+ method:#{payload[:method]}
50
+ path:#{payload[:path]}
51
+ status:#{payload[:status]}
52
+ view_runtime:#{payload[:view_runtime]}
53
+ db_runtime:#{payload[:db_runtime]}
54
+ ]
55
+ end
56
+ end
57
+ end
58
+ end
data/lib/pier/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pier
2
- VERSION = "0.0.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/pier.gemspec CHANGED
@@ -7,17 +7,21 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "pier"
8
8
  spec.version = Pier::VERSION
9
9
  spec.authors = ["Arvind Kunday"]
10
- spec.email = ["arvind.kunday@rea-group.com"]
11
- spec.summary = %q{Alternative docker-registry.}
12
- spec.description = %q{Alternative docker-registry.}
13
- spec.homepage = ""
10
+ spec.email = ["arvind@kunday.com"]
11
+
12
+ spec.summary = %q{Transmit rails events and logs to statsd}
13
+ spec.description = %q{Measure rails events easily}
14
+ spec.homepage = "https://github.com/kunday/pier"
14
15
  spec.license = "MIT"
15
16
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "bin"
19
+ spec.executables = ['pier']
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_dependency "activesupport"
23
+ spec.add_dependency 'dogstatsd-ruby'
24
+ spec.add_development_dependency "bundler", "~> 2.0"
22
25
  spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_dependency 'byebug'
23
27
  end
metadata CHANGED
@@ -1,59 +1,110 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvind Kunday
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-29 00:00:00.000000000 Z
11
+ date: 2019-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dogstatsd-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - ~>
45
+ - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '1.7'
47
+ version: '2.0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - ~>
52
+ - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '1.7'
54
+ version: '2.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rake
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ~>
59
+ - - "~>"
32
60
  - !ruby/object:Gem::Version
33
61
  version: '10.0'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ~>
66
+ - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '10.0'
41
- description: Alternative docker-registry.
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Measure rails events easily
42
84
  email:
43
- - arvind.kunday@rea-group.com
44
- executables: []
85
+ - arvind@kunday.com
86
+ executables:
87
+ - pier
45
88
  extensions: []
46
89
  extra_rdoc_files: []
47
90
  files:
48
- - .gitignore
91
+ - ".gitignore"
92
+ - ".ruby-version"
93
+ - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
49
95
  - Gemfile
50
96
  - LICENSE.txt
51
97
  - README.md
52
98
  - Rakefile
99
+ - bin/console
100
+ - bin/pier
101
+ - bin/setup
53
102
  - lib/pier.rb
103
+ - lib/pier/page_request/logger.rb
104
+ - lib/pier/page_request/metric.rb
54
105
  - lib/pier/version.rb
55
106
  - pier.gemspec
56
- homepage: ''
107
+ homepage: https://github.com/kunday/pier
57
108
  licenses:
58
109
  - MIT
59
110
  metadata: {}
@@ -63,18 +114,17 @@ require_paths:
63
114
  - lib
64
115
  required_ruby_version: !ruby/object:Gem::Requirement
65
116
  requirements:
66
- - - '>='
117
+ - - ">="
67
118
  - !ruby/object:Gem::Version
68
119
  version: '0'
69
120
  required_rubygems_version: !ruby/object:Gem::Requirement
70
121
  requirements:
71
- - - '>='
122
+ - - ">="
72
123
  - !ruby/object:Gem::Version
73
124
  version: '0'
74
125
  requirements: []
75
- rubyforge_project:
76
- rubygems_version: 2.0.14
126
+ rubygems_version: 3.0.3
77
127
  signing_key:
78
128
  specification_version: 4
79
- summary: Alternative docker-registry.
129
+ summary: Transmit rails events and logs to statsd
80
130
  test_files: []