dc-metrics 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +113 -0
- data/lib/dc/metrics.rb +74 -0
- data/lib/dc/metrics/auth.json +12 -0
- data/lib/dc/metrics/configuration.rb +26 -0
- data/lib/dc/metrics/logger.rb +97 -0
- data/lib/dc/metrics/pub_sub.rb +42 -0
- data/lib/dc/metrics/version.rb +7 -0
- data/lib/protos/metrics_pb.rb +43 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 76c91c46a841f89632769640ab956876daa5f60ec1e8fbfc3d5c47194e309125
|
4
|
+
data.tar.gz: 6ea402f59239624e1b6aa4dac1c3f9fe907771e1994eb86ae155ecda0b8a9272
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 16c890fdc91fdcff3789fc71012d611c7914c41e3203e3a911d0edf4668637eba91ec6ae15c7b0eeaccd792c39935c5fc1a291ceaa5437893e2ff78a1d574d60
|
7
|
+
data.tar.gz: df725846003233c70ee368a2d227ceabeb4c28b382b10db77fba1c35da1cd2aaa97e7a85b337e11458c58a54ed9dcebd9fc450f7aa4eb3aceac3106bc5af02bd
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Delivery Center
|
4
|
+
|
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:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
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
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# Dc::Metrics | dc.libs.metrics.ruby
|
2
|
+
|
3
|
+
Ruby implementation for DeliveryCenter's structured logging format.
|
4
|
+
|
5
|
+
> This package is part of a family of libraries that implement DeliveryCenter's metrics pattern for different languages.
|
6
|
+
Check also our [Elixir](https://github.com/deliverycenter/dc.libs.metrics.elixir),
|
7
|
+
> [Golang](https://github.com/deliverycenter/dc.libs.metrics.golang) and
|
8
|
+
>[Node](https://github.com/deliverycenter/dc.libs.metrics.node) versions.
|
9
|
+
|
10
|
+
By default, all events will be logged to:
|
11
|
+
|
12
|
+
- Stdout, as a [Google Cloud Platform structured log](https://cloud.google.com/logging/docs/structured-logging)
|
13
|
+
- Metrics API, using PubSub
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'dc-metrics'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install dc-metrics
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
How to configure:
|
34
|
+
```ruby
|
35
|
+
Dc::Metrics.configure do |config|
|
36
|
+
config.caller = 'application_name'
|
37
|
+
config.environment = 'test'
|
38
|
+
config.gcp_project_id = 'project_id'
|
39
|
+
config.pubsub_topic_name = 'topic_name'
|
40
|
+
# Path to you local GCP credentials file if needed(mostly for local testing).
|
41
|
+
config.gcp_credentials_path = 'path/to/file'
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
Obs: If there are missing parameters in this configuration the lib will fail to execute and output message to stdout! No exception is raised.
|
46
|
+
|
47
|
+
## Documentation
|
48
|
+
|
49
|
+
For this call of the library
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
Dc::Metrics.debug("Message test!", {
|
53
|
+
action: "CREATE_PRODUCT",
|
54
|
+
direction: "INCOMING",
|
55
|
+
source_type: "PROVIDER",
|
56
|
+
source_name: "MY_PROVIDER",
|
57
|
+
root_resource_type: "PRODUCT",
|
58
|
+
ext_root_resource_id: "EXT1234",
|
59
|
+
int_root_resource_id: "6789",
|
60
|
+
int_store_id: 100
|
61
|
+
})
|
62
|
+
```
|
63
|
+
|
64
|
+
The stdout ouput will be:
|
65
|
+
|
66
|
+
```json
|
67
|
+
{
|
68
|
+
"message": "Message test!",
|
69
|
+
"modelLog": {
|
70
|
+
"level": "DEBUG",
|
71
|
+
"message": "Message test!",
|
72
|
+
"caller": "application_name",
|
73
|
+
"environment": "test",
|
74
|
+
"correlation_id": "PROVIDER-MY_PROVIDER-EXT1234-6789",
|
75
|
+
"create_timestamp": 1605714894275120000,
|
76
|
+
"action": "CREATE_PRODUCT",
|
77
|
+
"direction": "INCOMING",
|
78
|
+
"source_type": "PROVIDER",
|
79
|
+
"source_name": "MY_PROVIDER",
|
80
|
+
"duration_ms": null,
|
81
|
+
"root_resource_type": "PRODUCT",
|
82
|
+
"ext_root_resource_id": "EXT1234",
|
83
|
+
"int_root_resource_id": "6789",
|
84
|
+
"child_resource_type": null,
|
85
|
+
"child_resource_id": "",
|
86
|
+
"ext_store_id": "",
|
87
|
+
"int_store_id": "100",
|
88
|
+
"error_code": null,
|
89
|
+
"payload": null
|
90
|
+
},
|
91
|
+
"severity": "DEBUG"
|
92
|
+
}
|
93
|
+
```
|
94
|
+
|
95
|
+
To generate RDOC use
|
96
|
+
```bash
|
97
|
+
$ rdoc 'dc-metrics'
|
98
|
+
```
|
99
|
+
|
100
|
+
## Development
|
101
|
+
|
102
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
103
|
+
|
104
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
105
|
+
|
106
|
+
**TODO:** 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).
|
107
|
+
|
108
|
+
## Disable logs
|
109
|
+
If you need to disable the package behavior (for testing, for example), you can use:
|
110
|
+
```ruby
|
111
|
+
Dc::Metrics.disable
|
112
|
+
```
|
113
|
+
|
data/lib/dc/metrics.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dc/metrics/version'
|
4
|
+
require 'dc/metrics/configuration'
|
5
|
+
require 'dc/metrics/logger'
|
6
|
+
|
7
|
+
module Dc
|
8
|
+
module Metrics
|
9
|
+
class Error < StandardError; end
|
10
|
+
# Your code goes here...
|
11
|
+
|
12
|
+
def self.debug(message, metadata)
|
13
|
+
logger.log(:debug, message, metadata)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.info(message, metadata)
|
17
|
+
logger.log(:info, message, metadata)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.warn(message, metadata)
|
21
|
+
logger.log(:warn, message, metadata)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.error(message, metadata)
|
25
|
+
logger.log(:error, message, metadata)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.logger
|
29
|
+
@logger ||= Metrics::Logger.new
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.configuration
|
33
|
+
@configuration ||= Configuration.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.reset
|
37
|
+
@configuration = Configuration.new
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.configure
|
41
|
+
yield(configuration)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.add_pending_thread(t)
|
45
|
+
threads_to_finish << t
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.finish_threads
|
49
|
+
threads_to_finish.each{ |t| t.join }
|
50
|
+
threads_to_finish = []
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.clean_pending_threads
|
54
|
+
if threads_to_finish.size > 100
|
55
|
+
finish_threads
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.disable
|
60
|
+
@configuration = Configuration.new
|
61
|
+
@configuration.disable
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def self.threads_to_finish
|
67
|
+
@threads_to_finish ||= []
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
at_exit do
|
73
|
+
Dc::Metrics.finish_threads
|
74
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"type": "service_account",
|
3
|
+
"project_id": "deliverycenter-stag",
|
4
|
+
"private_key_id": "8e6f3ea24cbcb2013b88592ce7bea0ee8c66856a",
|
5
|
+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDX/ppuhoZssCM2\nY1vc0s4z1ZnzU5XMLIfizha3OMx7O89uHg/wUJW2a+HnESM49t8cGYysZ3uJQynr\nD8eStNx/raPzRQAnqyvLrMM7qwkPClWZAewbLbVGJTPtIoIB6ZVA+lq/MGgXqJEK\n4FpycdHMCJfR6wzb6Rz3QR/8BKj4gbXz9lHnMUfqrdGlWuAld6gUqAjH3hct2Rs9\nTLIsl7dCyXfNuO9xo6n0fIwIlEfvxSd0d5XrvefeHuR3bQb0zUhU9XqgkUtcVS0V\nA2/dBP46+tWBR5x2PkW0d7mKdXe49ePB5H68z7RHUL5/1L0ccxGIYehLC9nG70Gf\nu9Rv8YMVAgMBAAECggEAEjNrqwWd/TmodfRQcN64roiA1Q7FkDNube/E3UKlhHrp\nQ1O4Lx1zSDB2FEUO7UVsTo9emcaMk+f7d8nYHOYtsHqe1qiJV05mvd58gyIp/MD3\nrpGJZk7nOBZ5djGSt/uJbrTKAdNf6iJzunFmXb92mNVeibtfVYaiwLkVq2RvIqWP\n3ea78UltbBBRSe88McpyPZmTiWLqaaF2IeDe2n6FZpCxnzZA0dTLS2VatnPp4W9t\nZxEPmvjCE/zA97RTSNd1s9uvGO0DFVOCSXEq+8b/pR/Cm/SQ/xOUc0O/CBqE+4gO\n2FUUhqYn+Q3S56Ivy7HkmVeu/efUElzqCtMYUKeSsQKBgQDwwrZoSiOTIvoglEdT\n8efKPCiREpw2rbfbf880+nj28TcOOrBui7ECCqQBhL3b5DQafggQWvHN6bQxVn9y\nF0i2s2w5dmVvfJ+J0GnYWlPJQkjOb1kWhQLulARVm33C6r+h7bNq6ySNvwXtewTM\n23T1pjrjMjQy07AqY2r7YWrLDQKBgQDlqpTSCmPHfC1b/foF1n8DySmiK/Qf1/Tx\nnWlt7YTykHjuY1yvKE0LPsNIKmNf6C7Ol1ae5cYYk2zPncAtLsqcRzGk5OkhFzFy\n6864E/jgaas/tPT9+V0b++Pb6MbX3w92il+gDtOdDfIMCB9ZauO4BaXba0V4Wo0Q\nzePQAXt2KQKBgQCGZas9fGVvdU77cMqAacFie0KJ+UGKpF7GAQrCIC/2aaC6KLjk\nfMZKxXXYAymY3kLXpxMJTjs9HwCfqhFqtuS4WGBJk3X8Ti0g2V68j2/GIWJTGoU4\ntPd2BtqEj1Acxr5CvlYxkSHOnpvIfauoT7lyh2DIAvZwiQsGHolR2oeq4QKBgHro\ntGZH+ygqE5hUrnZrWWQsRuSsQyS7jTG0/VRANdMecCmb8WEn3ztyZk37qV0NQ+d5\n5Hh7HW3Pj/74PH2xueqyyyWlAAKeh+8ptWKcBagLxQL+E9LLngG45zOsOqYSkRLu\ncMiWxrcZXH0F58kRxDaahy2LFg2X4ECq/w01jd4pAoGAWVaci75ReRI4VhY+pA0E\nPqFCX9W9RzQhzMGGmZajDWXLgBo64pw8asYX0o/zJaygH44/VOIB6UN5Sd82nePW\nOus6m+eRiz+2CMwBXRFgnpB2wRA+EsVUC8djxDtAMijX2E+R6ZwKFGrWExVf/DO7\nhOLDfQbMG2z6YZX6ZKSPpI8=\n-----END PRIVATE KEY-----\n",
|
6
|
+
"client_email": "cloudbuildtest@deliverycenter-stag.iam.gserviceaccount.com",
|
7
|
+
"client_id": "103062070047530150068",
|
8
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
9
|
+
"token_uri": "https://oauth2.googleapis.com/token",
|
10
|
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
11
|
+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/cloudbuildtest%40deliverycenter-stag.iam.gserviceaccount.com"
|
12
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dc
|
4
|
+
module Metrics
|
5
|
+
class Configuration
|
6
|
+
attr_accessor :caller, :environment, :gcp_project_id, :gcp_credentials_path, :pubsub_topic_name
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@caller = nil
|
10
|
+
@environment = nil
|
11
|
+
@gcp_project_id = nil
|
12
|
+
@pubsub_topic_name = nil
|
13
|
+
@gcp_credentials_path = nil
|
14
|
+
@disabled = false
|
15
|
+
end
|
16
|
+
|
17
|
+
def disable
|
18
|
+
@disabled = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def disabled?
|
22
|
+
@disabled
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dc/metrics/pub_sub'
|
4
|
+
require 'json'
|
5
|
+
require 'protos/metrics_pb'
|
6
|
+
require 'time'
|
7
|
+
|
8
|
+
module Dc
|
9
|
+
module Metrics
|
10
|
+
class Logger
|
11
|
+
def log(level, message, metadata)
|
12
|
+
begin
|
13
|
+
return if Metrics.configuration.disabled?
|
14
|
+
|
15
|
+
base_model = build_base_model(level, message, metadata)
|
16
|
+
|
17
|
+
log_to_stdout(base_model)
|
18
|
+
log_to_metrics(base_model)
|
19
|
+
rescue StandardError => e
|
20
|
+
puts "[Error][Dc::Metrics] #{e.message}" if e.message != nil
|
21
|
+
puts "[Error][Dc::Metrics] #{e.backtrace[0]}" if e.backtrace[0] != nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def log_to_stdout(base_model)
|
28
|
+
stdout_payload = build_stdout_payload(base_model)
|
29
|
+
puts JSON(stdout_payload)
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_stdout_payload(base_model)
|
33
|
+
{
|
34
|
+
message: base_model[:message],
|
35
|
+
modelLog: base_model,
|
36
|
+
severity: base_model[:level]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def log_to_metrics(base_model)
|
41
|
+
metrics_payload = build_metrics_payload(base_model)
|
42
|
+
make_metrics_request(metrics_payload)
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_metrics_payload(base_model)
|
46
|
+
metrics_data = base_model.reject { |k, _v| %i[message payload].include?(k) }
|
47
|
+
metrics_data[:create_timestamp] = to_google_timestamp(metrics_data[:create_timestamp])
|
48
|
+
DeliveryCenter::Logging::Integration::V1::WriteMetricsRequest.new(metrics_data)
|
49
|
+
end
|
50
|
+
|
51
|
+
def make_metrics_request(write_metrics_request_protob)
|
52
|
+
Metrics::PubSub.new.publish(write_metrics_request_protob)
|
53
|
+
end
|
54
|
+
|
55
|
+
def build_base_model(level, message, metadata)
|
56
|
+
{
|
57
|
+
level: level.to_s.upcase,
|
58
|
+
message: message,
|
59
|
+
caller: Metrics.configuration.caller,
|
60
|
+
environment: Metrics.configuration.environment,
|
61
|
+
correlation_id: build_correlation_id(metadata),
|
62
|
+
create_timestamp: Time.now.to_i * (10**9) + Time.now.nsec,
|
63
|
+
action: metadata[:action],
|
64
|
+
direction: metadata[:direction],
|
65
|
+
source_type: metadata[:source_type],
|
66
|
+
source_name: metadata[:source_name],
|
67
|
+
duration_ms: metadata[:duration_ms],
|
68
|
+
root_resource_type: metadata[:root_resource_type],
|
69
|
+
ext_root_resource_id: metadata[:ext_root_resource_id].to_s,
|
70
|
+
int_root_resource_id: metadata[:int_root_resource_id].to_s,
|
71
|
+
child_resource_type: metadata[:child_resource_type],
|
72
|
+
child_resource_id: metadata[:child_resource_id].to_s,
|
73
|
+
ext_store_id: metadata[:ext_store_id].to_s,
|
74
|
+
int_store_id: metadata[:int_store_id].to_s,
|
75
|
+
error_code: metadata[:error_code],
|
76
|
+
payload: metadata[:payload]
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def to_google_timestamp(nanoseconds)
|
81
|
+
Google::Protobuf::Timestamp.new(
|
82
|
+
seconds: nanoseconds / 1_000_000_000,
|
83
|
+
nanos: nanoseconds % 1_000_000_000
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def build_correlation_id(metadata)
|
88
|
+
[
|
89
|
+
metadata[:source_type],
|
90
|
+
metadata[:source_name],
|
91
|
+
metadata[:ext_root_resource_id],
|
92
|
+
metadata[:int_root_resource_id]
|
93
|
+
].join('-')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'protos/metrics_pb'
|
4
|
+
require 'base64'
|
5
|
+
require 'google/cloud/pubsub'
|
6
|
+
|
7
|
+
module Dc
|
8
|
+
module Metrics
|
9
|
+
class PubSub
|
10
|
+
attr_reader :pub_sub, :topic
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@pub_sub = Google::Cloud::PubSub.new(**cloud_params)
|
14
|
+
@topic = pub_sub.topic(Metrics.configuration.pubsub_topic_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def publish(message)
|
18
|
+
t = Thread.new{
|
19
|
+
begin
|
20
|
+
encoded_data = DeliveryCenter::Logging::Integration::V1::WriteMetricsRequest.encode(message)
|
21
|
+
response = topic.publish(encoded_data)
|
22
|
+
rescue StandardError => e
|
23
|
+
puts "[Error][Dc::Metrics] #{e.message}" if e.message != nil
|
24
|
+
puts "[Error][Dc::Metrics] #{e.backtrace[0]}" if e.backtrace[0] != nil
|
25
|
+
puts "[Error][Dc::Metrics] #{e.backtrace[1]}" if e.backtrace[1] != nil
|
26
|
+
end
|
27
|
+
}
|
28
|
+
Metrics.add_pending_thread(t)
|
29
|
+
Metrics.clean_pending_threads
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def cloud_params
|
35
|
+
{
|
36
|
+
project_id: Metrics.configuration.gcp_project_id,
|
37
|
+
credentials: Metrics.configuration.gcp_credentials_path
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
+
# source: metrics.proto
|
5
|
+
|
6
|
+
require 'google/protobuf'
|
7
|
+
|
8
|
+
require 'google/protobuf/timestamp_pb'
|
9
|
+
require 'google/protobuf/empty_pb'
|
10
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
+
add_file('metrics.proto', syntax: :proto3) do
|
12
|
+
add_message 'logging.deliverycenter.integration.v1.WriteMetricsRequest' do
|
13
|
+
optional :correlation_id, :string, 1
|
14
|
+
optional :environment, :string, 2
|
15
|
+
optional :level, :string, 3
|
16
|
+
optional :direction, :string, 4
|
17
|
+
optional :source_type, :string, 5
|
18
|
+
optional :source_name, :string, 6
|
19
|
+
optional :caller, :string, 7
|
20
|
+
optional :action, :string, 8
|
21
|
+
optional :create_timestamp, :message, 9, 'google.protobuf.Timestamp'
|
22
|
+
optional :duration_ms, :int32, 10
|
23
|
+
optional :root_resource_type, :string, 11
|
24
|
+
optional :ext_root_resource_id, :string, 12
|
25
|
+
optional :int_root_resource_id, :string, 13
|
26
|
+
optional :child_resource_type, :string, 14
|
27
|
+
optional :child_resource_id, :string, 15
|
28
|
+
optional :ext_store_id, :string, 16
|
29
|
+
optional :int_store_id, :string, 17
|
30
|
+
optional :error_code, :string, 18
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module DeliveryCenter
|
36
|
+
module Logging
|
37
|
+
module Integration
|
38
|
+
module V1
|
39
|
+
WriteMetricsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('logging.deliverycenter.integration.v1.WriteMetricsRequest').msgclass
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dc-metrics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lucas Braz
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: google-protobuf
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: google-cloud-pubsub
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Ruby implementation for DeliveryCenter's structured logging format.
|
98
|
+
email:
|
99
|
+
- dev.ti@deliverycenter.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files:
|
103
|
+
- README.md
|
104
|
+
- LICENSE.txt
|
105
|
+
files:
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- lib/dc/metrics.rb
|
109
|
+
- lib/dc/metrics/auth.json
|
110
|
+
- lib/dc/metrics/configuration.rb
|
111
|
+
- lib/dc/metrics/logger.rb
|
112
|
+
- lib/dc/metrics/pub_sub.rb
|
113
|
+
- lib/dc/metrics/version.rb
|
114
|
+
- lib/protos/metrics_pb.rb
|
115
|
+
homepage: https://github.com/deliverycenter/dc.libs.metrics.ruby
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options:
|
121
|
+
- "--title"
|
122
|
+
- Dc Metrics - ruby implementation
|
123
|
+
- "--main"
|
124
|
+
- README.md
|
125
|
+
- "--line-numbers"
|
126
|
+
- "--inline-source"
|
127
|
+
- "--quiet"
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubygems_version: 3.1.2
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: Ruby implementation for DeliveryCenter's structured logging format.
|
145
|
+
test_files: []
|