connectors_utility 8.4.0.0 → 8.5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/connectors/connector_status.rb +31 -0
- data/lib/connectors/crawler/scheduler.rb +26 -0
- data/lib/connectors/sync_status.rb +21 -0
- data/lib/connectors_utility.rb +8 -2
- data/lib/core/connector_settings.rb +142 -0
- data/lib/core/elastic_connector_actions.rb +269 -0
- data/lib/core/scheduler.rb +138 -0
- data/lib/utility/constants.rb +20 -0
- data/lib/utility/cron.rb +81 -0
- data/lib/utility/elasticsearch/index/mappings.rb +68 -42
- data/lib/utility/environment.rb +33 -0
- data/lib/utility/errors.rb +132 -0
- data/lib/utility/es_client.rb +84 -0
- data/lib/utility/exception_tracking.rb +64 -0
- data/lib/utility/extension_mapping_util.rb +123 -0
- data/lib/utility/logger.rb +58 -0
- data/lib/utility.rb +16 -0
- metadata +117 -4
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'logger'
|
8
|
+
require 'active_support/core_ext/module'
|
9
|
+
require 'active_support/core_ext/string/filters'
|
10
|
+
require 'ecs_logging/logger'
|
11
|
+
|
12
|
+
module Utility
|
13
|
+
class Logger
|
14
|
+
SUPPORTED_LOG_LEVELS = %i[fatal error warn info debug].freeze
|
15
|
+
MAX_SHORT_MESSAGE_LENGTH = 1000.freeze
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
delegate :formatter, :formatter=, :to => :logger
|
20
|
+
|
21
|
+
def level=(log_level)
|
22
|
+
logger.level = log_level
|
23
|
+
end
|
24
|
+
|
25
|
+
def logger
|
26
|
+
@logger ||= Settings[:ecs_logging] ? EcsLogging::Logger.new(STDOUT) : ::Logger.new(STDOUT)
|
27
|
+
end
|
28
|
+
|
29
|
+
SUPPORTED_LOG_LEVELS.each do |level|
|
30
|
+
define_method(level) do |message|
|
31
|
+
if logger.is_a?(EcsLogging::Logger)
|
32
|
+
logger.public_send(level, message, service: { name: 'connectors-ruby' })
|
33
|
+
else
|
34
|
+
logger.public_send(level, message)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def error_with_backtrace(message: nil, exception: nil, prog_name: nil)
|
40
|
+
logger.error(prog_name) { message } if message
|
41
|
+
logger.error exception.message if exception
|
42
|
+
logger.error exception.backtrace.join("\n") if exception
|
43
|
+
end
|
44
|
+
|
45
|
+
def new_line
|
46
|
+
logger.info("\n")
|
47
|
+
end
|
48
|
+
|
49
|
+
def generate_trace_id
|
50
|
+
SecureRandom.uuid
|
51
|
+
end
|
52
|
+
|
53
|
+
def abbreviated_message(message)
|
54
|
+
message.gsub(/\s+/, ' ').strip.truncate(MAX_SHORT_MESSAGE_LENGTH)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/utility.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'utility/constants'
|
8
|
+
require 'utility/cron'
|
9
|
+
require 'utility/errors'
|
10
|
+
require 'utility/es_client'
|
11
|
+
require 'utility/environment'
|
12
|
+
require 'utility/exception_tracking'
|
13
|
+
require 'utility/extension_mapping_util'
|
14
|
+
require 'utility/logger'
|
15
|
+
require 'utility/elasticsearch/index/mappings'
|
16
|
+
require 'utility/elasticsearch/index/text_analysis_settings'
|
metadata
CHANGED
@@ -1,15 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connectors_utility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
12
|
-
dependencies:
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ecs-logging
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.2.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.2.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mime-types
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tzinfo-data
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tzinfo
|
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
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: nokogiri
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.13.6
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.13.6
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: fugit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.5.3
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.5.3
|
13
111
|
description: ''
|
14
112
|
email: ent-search-dev@elastic.co
|
15
113
|
executables: []
|
@@ -18,15 +116,30 @@ extra_rdoc_files: []
|
|
18
116
|
files:
|
19
117
|
- LICENSE
|
20
118
|
- NOTICE.txt
|
119
|
+
- lib/connectors/connector_status.rb
|
120
|
+
- lib/connectors/crawler/scheduler.rb
|
121
|
+
- lib/connectors/sync_status.rb
|
21
122
|
- lib/connectors_utility.rb
|
123
|
+
- lib/core/connector_settings.rb
|
124
|
+
- lib/core/elastic_connector_actions.rb
|
125
|
+
- lib/core/scheduler.rb
|
126
|
+
- lib/utility.rb
|
127
|
+
- lib/utility/constants.rb
|
128
|
+
- lib/utility/cron.rb
|
22
129
|
- lib/utility/elasticsearch/index/language_data.yml
|
23
130
|
- lib/utility/elasticsearch/index/mappings.rb
|
24
131
|
- lib/utility/elasticsearch/index/text_analysis_settings.rb
|
132
|
+
- lib/utility/environment.rb
|
133
|
+
- lib/utility/errors.rb
|
134
|
+
- lib/utility/es_client.rb
|
135
|
+
- lib/utility/exception_tracking.rb
|
136
|
+
- lib/utility/extension_mapping_util.rb
|
137
|
+
- lib/utility/logger.rb
|
25
138
|
homepage: https://github.com/elastic/connectors-ruby
|
26
139
|
licenses:
|
27
140
|
- Elastic-2.0
|
28
141
|
metadata:
|
29
|
-
revision:
|
142
|
+
revision: bf9b1793112d26e3f02f75d34874a3e8f0f02f5e
|
30
143
|
repository: git@github.com:elastic/connectors.git
|
31
144
|
post_install_message:
|
32
145
|
rdoc_options: []
|