lsslog 0.1.6 → 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
2
  SHA256:
3
- metadata.gz: fbddb05ebae4c811f7633a4c4324d70aa573cefdbff89f214466073aee2c14d0
4
- data.tar.gz: 963b1153ce2a32f2c5fc36f57819afa158187726e8970fa16e9df382ed7f0ad9
3
+ metadata.gz: c54ea01fcda20826706329171d37135a08c73ae0190f1b402897e8229dca69e0
4
+ data.tar.gz: c4dbafeec49895ca9a66beead4e733ded235299c7532189e260beac05c95e80e
5
5
  SHA512:
6
- metadata.gz: 5ff9e997c47852ee1277b8e716d204486c1613cef6c9986ecaa3d894d7c1cbb6d2bd231ea9d95d6bcc63f94d529d6a420298d352be122397e61d3a1d504e8962
7
- data.tar.gz: 6979b53ce59f7beb421ec86f486df1b51072cbd5b23382454014a066f071fc716a0488335c2543509d5e5d203fb95445337cb5c3c3be2185a7c141c7e78643b6
6
+ metadata.gz: 3f0ccd031ff62377ec36f27e849f948ae6009b2e8279d0b7517fc1676af20c1601fbcb72fd55c519f32e7213f0256ae045442183a39f0ef14ad10891427c4c2b
7
+ data.tar.gz: e5f335ae47adabf3079f91fb2117c401f049b4b6c496c3bcd78b9b5621d97b1e47d7b3b19c9d97a2b321d295599aca9867c2369b1f1aeb4147b490fac9a76a96
@@ -0,0 +1,35 @@
1
+ require 'grpc'
2
+ require "lsslog_services_pb"
3
+
4
+ module Lsslog
5
+ module Services
6
+ module V2
7
+ class Base
8
+ attr_reader :client
9
+
10
+ def initialize
11
+ @client = ::Lsslog::V2::Stub.new(lss_host, :this_channel_is_insecure)
12
+ end
13
+
14
+ def self.call(*args)
15
+ response = new.call(*args)
16
+
17
+ Lsslog.logger.info "#{self.name.demodulize}: #{response.to_json}"
18
+
19
+ response
20
+ rescue GRPC::BadStatus => e
21
+ Lsslog.logger.info "ERROR: #{e.message}"
22
+ end
23
+
24
+ private
25
+
26
+ def lss_host
27
+ @lss_host ||= ::Lsslog.configuration.lss_host
28
+ raise 'Lsslog.configuration.lss_host is missing' unless @lss_host
29
+
30
+ @lss_host
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ module Lsslog
2
+ module Services
3
+ module V2
4
+ class Log < ::Lsslog::Services::V2::Base
5
+ def call(message)
6
+ client.log(Lsslog::LogVer2.new(message))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Lsslog
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/lsslog.rb CHANGED
@@ -10,6 +10,9 @@ require 'lsslog/services/set_lss_config'
10
10
  require 'lsslog/services/set_trans_exp_time'
11
11
  require 'lsslog/services/write_log'
12
12
 
13
+ require 'lsslog/services/v2/base'
14
+ require 'lsslog/services/v2/log'
15
+
13
16
  module Lsslog
14
17
  class Error < StandardError; end
15
18
 
data/lib/lsslog_pb.rb CHANGED
@@ -1,96 +1,16 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: lsslog.proto
3
4
 
4
5
  require 'google/protobuf'
5
6
 
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("lsslog.proto", :syntax => :proto3) do
8
- add_message "lsslog.LssLog" do
9
- optional :transaction_id, :string, 1
10
- optional :flow_id, :string, 3
11
- optional :subflow_id, :string, 4
12
- optional :flow_dir, :enum, 2, "lsslog.FlowDirection"
13
- optional :flow_depth, :int32, 5
14
- optional :system_id, :string, 6
15
- optional :flow_body, :string, 7
16
- optional :request_method, :string, 8
17
- optional :request_url, :string, 9
18
- optional :status, :int32, 10
19
- optional :response_size, :int64, 11
20
- optional :user_agent, :string, 12
21
- optional :remote_ip, :string, 13
22
- optional :server_ip, :string, 14
23
- optional :latency, :int32, 15
24
- optional :protocol, :string, 16
25
- optional :start_time, :int64, 17
26
- optional :end_time, :int64, 18
27
- optional :created_at, :int64, 19
28
- optional :recevied_at, :int64, 20
29
- optional :is_completed, :bool, 21
30
- optional :tenant_id, :string, 22
31
- end
32
- add_message "lsslog.LssRes" do
33
- optional :body, :string, 1
34
- optional :code, :int32, 2
35
- end
36
- add_message "lsslog.VersionOut" do
37
- optional :api_verion, :string, 1
38
- optional :branch, :string, 2
39
- optional :commit, :string, 3
40
- optional :date, :string, 4
41
- optional :go_version, :string, 5
42
- optional :os_arch, :string, 6
43
- end
44
- add_message "lsslog.EmptyIn" do
45
- end
46
- add_message "lsslog.TransExpTime" do
47
- optional :flow_exp_time, :int32, 1
48
- optional :subflow_exp_time, :int32, 2
49
- end
50
- add_message "lsslog.LssConfig" do
51
- optional :flow_id, :string, 1
52
- optional :flow_name, :string, 2
53
- optional :enforce_sequence, :bool, 3
54
- optional :number_subflow, :int32, 4
55
- end
56
- add_message "lsslog.LssConfigRes" do
57
- repeated :data, :message, 1, "lsslog.LssConfig"
58
- optional :trans_exp_time, :message, 2, "lsslog.TransExpTime"
59
- end
60
- add_message "lsslog.ProdDetails" do
61
- optional :sku, :string, 1
62
- optional :vm_id, :string, 2
63
- optional :stg_id, :string, 3
64
- optional :nat_gw_id, :string, 4
65
- optional :peer_id, :string, 5
66
- optional :ec_id, :string, 6
67
- optional :subnet_id, :string, 7
68
- optional :elastic_ipa, :string, 8
69
- optional :nic_id, :string, 9
70
- optional :workload_id, :string, 10
71
- end
72
- add_message "lsslog.PurchasedItem" do
73
- optional :zone_id, :string, 1
74
- optional :region_id, :string, 2
75
- optional :item_cnt, :string, 3
76
- repeated :skus, :string, 5
77
- optional :detail, :message, 6, "lsslog.ProdDetails"
78
- end
79
- add_message "lsslog.ProdTransaction" do
80
- optional :transaction_id, :string, 1
81
- optional :tenant_id, :string, 2
82
- repeated :details, :message, 3, "lsslog.PurchasedItem"
83
- optional :region_id, :string, 4
84
- optional :zone_id, :string, 5
85
- optional :provisioned_at, :int64, 6
86
- optional :created_at, :int64, 7
87
- end
88
- add_enum "lsslog.FlowDirection" do
89
- value :REQUEST, 0
90
- value :RESPONSE, 1
91
- end
92
- end
93
- end
7
+ require 'google/protobuf/struct_pb'
8
+
9
+
10
+ descriptor_data = "\n\x0clsslog.proto\x12\x06lsslog\x1a\x1cgoogle/protobuf/struct.proto\"\xd1\x03\n\x06LssLog\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\x12\x0f\n\x07\x66low_id\x18\x03 \x01(\t\x12\x12\n\nsubflow_id\x18\x04 \x01(\t\x12\'\n\x08\x66low_dir\x18\x02 \x01(\x0e\x32\x15.lsslog.FlowDirection\x12\x12\n\nflow_depth\x18\x05 \x01(\x05\x12\x11\n\tsystem_id\x18\x06 \x01(\t\x12\x11\n\tflow_body\x18\x07 \x01(\t\x12\x16\n\x0erequest_method\x18\x08 \x01(\t\x12\x13\n\x0brequest_url\x18\t \x01(\t\x12\x0e\n\x06status\x18\n \x01(\x05\x12\x15\n\rresponse_size\x18\x0b \x01(\x03\x12\x12\n\nuser_agent\x18\x0c \x01(\t\x12\x11\n\tremote_ip\x18\r \x01(\t\x12\x11\n\tserver_ip\x18\x0e \x01(\t\x12\x0f\n\x07latency\x18\x0f \x01(\x05\x12\x10\n\x08protocol\x18\x10 \x01(\t\x12\x12\n\nstart_time\x18\x11 \x01(\x03\x12\x10\n\x08\x65nd_time\x18\x12 \x01(\x03\x12\x12\n\ncreated_at\x18\x13 \x01(\x03\x12\x13\n\x0brecevied_at\x18\x14 \x01(\x03\x12\x14\n\x0cis_completed\x18\x15 \x01(\x08\x12\x11\n\ttenant_id\x18\x16 \x01(\t\"$\n\x06LssRes\x12\x0c\n\x04\x62ody\x18\x01 \x01(\t\x12\x0c\n\x04\x63ode\x18\x02 \x01(\x05\"s\n\nVersionOut\x12\x12\n\napi_verion\x18\x01 \x01(\t\x12\x0e\n\x06\x62ranch\x18\x02 \x01(\t\x12\x0e\n\x06\x63ommit\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x04 \x01(\t\x12\x12\n\ngo_version\x18\x05 \x01(\t\x12\x0f\n\x07os_arch\x18\x06 \x01(\t\"\t\n\x07\x45mptyIn\"?\n\x0cTransExpTime\x12\x15\n\rflow_exp_time\x18\x01 \x01(\x05\x12\x18\n\x10subflow_exp_time\x18\x02 \x01(\x05\"a\n\tLssConfig\x12\x0f\n\x07\x66low_id\x18\x01 \x01(\t\x12\x11\n\tflow_name\x18\x02 \x01(\t\x12\x18\n\x10\x65nforce_sequence\x18\x03 \x01(\x08\x12\x16\n\x0enumber_subflow\x18\x04 \x01(\x05\"]\n\x0cLssConfigRes\x12\x1f\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x11.lsslog.LssConfig\x12,\n\x0etrans_exp_time\x18\x02 \x01(\x0b\x32\x14.lsslog.TransExpTime\"\xb9\x01\n\x0bProdDetails\x12\x0b\n\x03sku\x18\x01 \x01(\t\x12\r\n\x05vm_id\x18\x02 \x01(\t\x12\x0e\n\x06stg_id\x18\x03 \x01(\t\x12\x11\n\tnat_gw_id\x18\x04 \x01(\t\x12\x0f\n\x07peer_id\x18\x05 \x01(\t\x12\r\n\x05\x65\x63_id\x18\x06 \x01(\t\x12\x11\n\tsubnet_id\x18\x07 \x01(\t\x12\x13\n\x0b\x65lastic_ipa\x18\x08 \x01(\t\x12\x0e\n\x06nic_id\x18\t \x01(\t\x12\x13\n\x0bworkload_id\x18\n \x01(\t\"x\n\rPurchasedItem\x12\x0f\n\x07zone_id\x18\x01 \x01(\t\x12\x11\n\tregion_id\x18\x02 \x01(\t\x12\x10\n\x08item_cnt\x18\x03 \x01(\t\x12\x0c\n\x04skus\x18\x05 \x03(\t\x12#\n\x06\x64\x65tail\x18\x06 \x01(\x0b\x32\x13.lsslog.ProdDetails\"\xb4\x01\n\x0fProdTransaction\x12\x16\n\x0etransaction_id\x18\x01 \x01(\t\x12\x11\n\ttenant_id\x18\x02 \x01(\t\x12&\n\x07\x64\x65tails\x18\x03 \x03(\x0b\x32\x15.lsslog.PurchasedItem\x12\x11\n\tregion_id\x18\x04 \x01(\t\x12\x0f\n\x07zone_id\x18\x05 \x01(\t\x12\x16\n\x0eprovisioned_at\x18\x06 \x01(\x03\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\"x\n\x07LogVer2\x12\x10\n\x08severity\x18\x01 \x01(\t\x12\x11\n\ttimestamp\x18\x02 \x01(\t\x12\x0b\n\x03\x61pi\x18\x03 \x01(\t\x12\x11\n\tcomponent\x18\x04 \x01(\t\x12(\n\x07message\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\"0\n\x0fLogResponseVer2\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\ttimestamp\x18\x02 \x01(\r**\n\rFlowDirection\x12\x0b\n\x07REQUEST\x10\x00\x12\x0c\n\x08RESPONSE\x10\x01\x32\x98\x03\n\rLssLogService\x12,\n\x08WriteLog\x12\x0e.lsslog.LssLog\x1a\x0e.lsslog.LssRes\"\x00\x12\x33\n\nGetVersion\x12\x0f.lsslog.EmptyIn\x1a\x12.lsslog.VersionOut\"\x00\x12\x33\n\x0cSetLssConfig\x12\x11.lsslog.LssConfig\x1a\x0e.lsslog.LssRes\"\x00\x12\x39\n\x0cGetLssConfig\x12\x11.lsslog.LssConfig\x1a\x14.lsslog.LssConfigRes\"\x00\x12\x36\n\x0fRemoveLssConfig\x12\x11.lsslog.LssConfig\x1a\x0e.lsslog.LssRes\"\x00\x12\x39\n\x0fSetTransExpTime\x12\x14.lsslog.TransExpTime\x1a\x0e.lsslog.LssRes\"\x00\x12\x41\n\x14WriteProdTransaction\x12\x17.lsslog.ProdTransaction\x1a\x0e.lsslog.LssRes\"\x00\x32\x37\n\x02V2\x12\x31\n\x03Log\x12\x0f.lsslog.LogVer2\x1a\x17.lsslog.LogResponseVer2\"\x00\x62\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
94
14
 
95
15
  module Lsslog
96
16
  LssLog = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.LssLog").msgclass
@@ -103,5 +23,7 @@ module Lsslog
103
23
  ProdDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.ProdDetails").msgclass
104
24
  PurchasedItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.PurchasedItem").msgclass
105
25
  ProdTransaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.ProdTransaction").msgclass
26
+ LogVer2 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.LogVer2").msgclass
27
+ LogResponseVer2 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.LogResponseVer2").msgclass
106
28
  FlowDirection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lsslog.FlowDirection").enummodule
107
29
  end
@@ -8,7 +8,7 @@ module Lsslog
8
8
  module LssLogService
9
9
  class Service
10
10
 
11
- include GRPC::GenericService
11
+ include ::GRPC::GenericService
12
12
 
13
13
  self.marshal_class_method = :encode
14
14
  self.unmarshal_class_method = :decode
@@ -23,6 +23,20 @@ module Lsslog
23
23
  rpc :WriteProdTransaction, ::Lsslog::ProdTransaction, ::Lsslog::LssRes
24
24
  end
25
25
 
26
+ Stub = Service.rpc_stub_class
27
+ end
28
+ module V2
29
+ class Service
30
+
31
+ include ::GRPC::GenericService
32
+
33
+ self.marshal_class_method = :encode
34
+ self.unmarshal_class_method = :decode
35
+ self.service_name = 'lsslog.V2'
36
+
37
+ rpc :Log, ::Lsslog::LogVer2, ::Lsslog::LogResponseVer2
38
+ end
39
+
26
40
  Stub = Service.rpc_stub_class
27
41
  end
28
42
  end
data/lsslog-0.1.6.gem ADDED
Binary file
data/proto/lsslog.proto CHANGED
@@ -1,5 +1,6 @@
1
1
  syntax = "proto3";
2
2
  package lsslog;
3
+ import "google/protobuf/struct.proto";
3
4
 
4
5
  enum FlowDirection {
5
6
  REQUEST = 0;
@@ -95,6 +96,19 @@ message ProdTransaction {
95
96
  int64 created_at = 7;
96
97
  }
97
98
 
99
+ message LogVer2 {
100
+ string severity = 1;
101
+ string timestamp = 2;
102
+ string api = 3;
103
+ string component = 4;
104
+ google.protobuf.Struct message = 5;
105
+ }
106
+
107
+ message LogResponseVer2 {
108
+ string id = 1;
109
+ uint32 timestamp = 2;
110
+ }
111
+
98
112
  service LssLogService {
99
113
  rpc WriteLog(LssLog) returns (LssRes) {};
100
114
  rpc GetVersion(EmptyIn) returns (VersionOut) {};
@@ -104,3 +118,7 @@ service LssLogService {
104
118
  rpc SetTransExpTime(TransExpTime) returns (LssRes) {};
105
119
  rpc WriteProdTransaction(ProdTransaction) returns (LssRes) {};
106
120
  }
121
+
122
+ service V2 {
123
+ rpc Log(LogVer2) returns (LogResponseVer2) {};
124
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thanh Ngo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -101,6 +101,8 @@ files:
101
101
  - lib/lsslog/services/remove_lss_config.rb
102
102
  - lib/lsslog/services/set_lss_config.rb
103
103
  - lib/lsslog/services/set_trans_exp_time.rb
104
+ - lib/lsslog/services/v2/base.rb
105
+ - lib/lsslog/services/v2/log.rb
104
106
  - lib/lsslog/services/write_log.rb
105
107
  - lib/lsslog/services/write_prod_transaction.rb
106
108
  - lib/lsslog/version.rb
@@ -111,6 +113,7 @@ files:
111
113
  - lsslog-0.1.3.gem
112
114
  - lsslog-0.1.3.pre.rc1.gem
113
115
  - lsslog-0.1.5.gem
116
+ - lsslog-0.1.6.gem
114
117
  - lsslog.gemspec
115
118
  - proto/README.md
116
119
  - proto/lsslog.proto