opentelemetry-logs-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +9 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +201 -0
- data/lib/opentelemetry/internal/proxy_logger.rb +56 -0
- data/lib/opentelemetry/internal/proxy_logger_provider.rb +60 -0
- data/lib/opentelemetry/logs/log_record.rb +12 -0
- data/lib/opentelemetry/logs/logger.rb +58 -0
- data/lib/opentelemetry/logs/logger_provider.rb +25 -0
- data/lib/opentelemetry/logs/severity_number.rb +37 -0
- data/lib/opentelemetry/logs/version.rb +12 -0
- data/lib/opentelemetry/logs.rb +22 -0
- data/lib/opentelemetry-logs-api.rb +41 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3bb9223e68b6d10c62aac57bcb003d4316db6e80f2c59718ce10bba0723e243a
|
4
|
+
data.tar.gz: fc302dd210b61845febd53f7dbe64c706400144d6237ed8b257af5d61dde7209
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c41ed6234a6b579b2ef71ed70856ad85a4a901db4754f9c15ada814e87e58c808290f38bff364206c6ac23caad5ff290e07e353261121d22c640aae19fe54d0c
|
7
|
+
data.tar.gz: 20019007124465c5b7e5b17bf69bafb4b7b94159b8e0b467139c1ac6902db5b5f9adb1d9af2992414536b7c39365059354aa9a679f743b176ad37e4cc2767212
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright The OpenTelemetry Authors
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Internal
|
9
|
+
# @api private
|
10
|
+
#
|
11
|
+
# {ProxyLogger} is an implementation of {OpenTelemetry::Logs::Logger}. It is returned from
|
12
|
+
# the ProxyLoggerProvider until a delegate logger provider is installed. After the delegate
|
13
|
+
# logger provider is installed, the ProxyLogger will delegate to the corresponding "real"
|
14
|
+
# logger.
|
15
|
+
class ProxyLogger < Logs::Logger
|
16
|
+
attr_writer :delegate
|
17
|
+
|
18
|
+
# Returns a new {ProxyLogger} instance.
|
19
|
+
#
|
20
|
+
# @return [ProxyLogger]
|
21
|
+
def initialize
|
22
|
+
@delegate = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def on_emit(
|
26
|
+
timestamp: nil,
|
27
|
+
observed_timestamp: nil,
|
28
|
+
severity_number: nil,
|
29
|
+
severity_text: nil,
|
30
|
+
body: nil,
|
31
|
+
trace_id: nil,
|
32
|
+
span_id: nil,
|
33
|
+
trace_flags: nil,
|
34
|
+
attributes: nil,
|
35
|
+
context: nil
|
36
|
+
)
|
37
|
+
unless @delegate.nil?
|
38
|
+
return @delegate.on_emit(
|
39
|
+
timestamp: nil,
|
40
|
+
observed_timestamp: nil,
|
41
|
+
severity_number: nil,
|
42
|
+
severity_text: nil,
|
43
|
+
body: nil,
|
44
|
+
trace_id: nil,
|
45
|
+
span_id: nil,
|
46
|
+
trace_flags: nil,
|
47
|
+
attributes: nil,
|
48
|
+
context: nil
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
super
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Internal
|
9
|
+
# @api private
|
10
|
+
#
|
11
|
+
# {ProxyLoggerProvider} is an implementation of {OpenTelemetry::Logs::LoggerProvider}.
|
12
|
+
# It is the default global logger provider returned by OpenTelemetry.logger_provider.
|
13
|
+
# It delegates to a "real" LoggerProvider after the global logger provider is registered.
|
14
|
+
# It returns {ProxyLogger} instances until the delegate is installed.
|
15
|
+
class ProxyLoggerProvider < Logs::LoggerProvider
|
16
|
+
Key = Struct.new(:name, :version)
|
17
|
+
private_constant(:Key)
|
18
|
+
# Returns a new {ProxyLoggerProvider} instance.
|
19
|
+
#
|
20
|
+
# @return [ProxyLoggerProvider]
|
21
|
+
def initialize
|
22
|
+
super
|
23
|
+
|
24
|
+
@mutex = Mutex.new
|
25
|
+
@registry = {}
|
26
|
+
@delegate = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# Set the delegate logger provider. If this is called more than once, a warning will
|
30
|
+
# be logged and superfluous calls will be ignored.
|
31
|
+
#
|
32
|
+
# @param [LoggerProvider] provider The logger provider to delegate to
|
33
|
+
def delegate=(provider)
|
34
|
+
unless @delegate.nil?
|
35
|
+
OpenTelemetry.logger.warn 'Attempt to reset delegate in ProxyLoggerProvider ignored.'
|
36
|
+
return
|
37
|
+
end
|
38
|
+
|
39
|
+
@mutex.synchronize do
|
40
|
+
@delegate = provider
|
41
|
+
@registry.each { |key, logger| logger.delegate = provider.logger(key.name, key.version) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns a {Logger} instance.
|
46
|
+
#
|
47
|
+
# @param [optional String] name Instrumentation package name
|
48
|
+
# @param [optional String] version Instrumentation package version
|
49
|
+
#
|
50
|
+
# @return [Logger]
|
51
|
+
def logger(name = nil, version = nil)
|
52
|
+
@mutex.synchronize do
|
53
|
+
return @delegate.logger(name, version) unless @delegate.nil?
|
54
|
+
|
55
|
+
@registry[Key.new(name, version)] ||= ProxyLogger.new
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Logs
|
9
|
+
# No-op implementation of an emitted log and its associated attributes.
|
10
|
+
class LogRecord; end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Logs
|
9
|
+
# No-op implementation of logger.
|
10
|
+
class Logger
|
11
|
+
# rubocop:disable Style/EmptyMethod
|
12
|
+
|
13
|
+
# Emit a {LogRecord} to the processing pipeline.
|
14
|
+
#
|
15
|
+
# @param timestamp [optional Time] Time when the event occurred.
|
16
|
+
# @param observed_timestamp [optional Time] Time when the event was
|
17
|
+
# observed by the collection system.
|
18
|
+
# @param context [optional Context] The Context to associate with the
|
19
|
+
# LogRecord. Intended default: OpenTelemetry::Context.current
|
20
|
+
# @param severity_number [optional Integer] Numerical value of the
|
21
|
+
# severity. Smaller numerical values correspond to less severe events
|
22
|
+
# (such as debug events), larger numerical values correspond to more
|
23
|
+
# severe events (such as errors and critical events).
|
24
|
+
# @param [optional String] severity_text Original string representation of
|
25
|
+
# the severity as it is known at the source. Also known as log level.
|
26
|
+
# @param [optional String, Numeric, Boolean, Array<String, Numeric,
|
27
|
+
# Boolean>, Hash{String => String, Numeric, Boolean, Array<String,
|
28
|
+
# Numeric, Boolean>}] body A value containing the body of the log record.
|
29
|
+
# @param [optional String] trace_id The trace ID associated with the
|
30
|
+
# current context.
|
31
|
+
# @param [optional String] span_id The span ID associated with the
|
32
|
+
# current context.
|
33
|
+
# @param [optional TraceFlags] trace_flags The trace flags associated
|
34
|
+
# with the current context.
|
35
|
+
# @param [optional Hash{String => String, Numeric, Boolean,
|
36
|
+
# Array<String, Numeric, Boolean>}] attributes Additional information
|
37
|
+
# about the event.
|
38
|
+
# @param [optional Context] context The Context to associate with the
|
39
|
+
# LogRecord. Intended default: OpenTelemetry::Context.current
|
40
|
+
#
|
41
|
+
# @api public
|
42
|
+
def on_emit(
|
43
|
+
timestamp: nil,
|
44
|
+
observed_timestamp: nil,
|
45
|
+
severity_number: nil,
|
46
|
+
severity_text: nil,
|
47
|
+
body: nil,
|
48
|
+
trace_id: nil,
|
49
|
+
span_id: nil,
|
50
|
+
trace_flags: nil,
|
51
|
+
attributes: nil,
|
52
|
+
context: nil
|
53
|
+
)
|
54
|
+
end
|
55
|
+
# rubocop:enable Style/EmptyMethod
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Logs
|
9
|
+
# No-op implementation of a logger provider.
|
10
|
+
class LoggerProvider
|
11
|
+
NOOP_LOGGER = OpenTelemetry::Logs::Logger.new
|
12
|
+
private_constant :NOOP_LOGGER
|
13
|
+
|
14
|
+
# Returns an {OpenTelemetry::Logs::Logger} instance.
|
15
|
+
#
|
16
|
+
# @param [optional String] name Instrumentation package name
|
17
|
+
# @param [optional String] version Instrumentation package version
|
18
|
+
#
|
19
|
+
# @return [OpenTelemetry::Logs::Logger]
|
20
|
+
def logger(name = nil, version = nil)
|
21
|
+
@logger ||= NOOP_LOGGER
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Logs
|
9
|
+
class SeverityNumber
|
10
|
+
SEVERITY_NUMBER_UNSPECIFIED = 0
|
11
|
+
SEVERITY_NUMBER_TRACE = 1
|
12
|
+
SEVERITY_NUMBER_TRACE2 = 2
|
13
|
+
SEVERITY_NUMBER_TRACE3 = 3
|
14
|
+
SEVERITY_NUMBER_TRACE4 = 4
|
15
|
+
SEVERITY_NUMBER_DEBUG = 5
|
16
|
+
SEVERITY_NUMBER_DEBUG2 = 7
|
17
|
+
SEVERITY_NUMBER_DEBUG3 = 6
|
18
|
+
SEVERITY_NUMBER_DEBUG4 = 8
|
19
|
+
SEVERITY_NUMBER_INFO = 9
|
20
|
+
SEVERITY_NUMBER_INFO2 = 10
|
21
|
+
SEVERITY_NUMBER_INFO3 = 11
|
22
|
+
SEVERITY_NUMBER_INFO4 = 12
|
23
|
+
SEVERITY_NUMBER_WARN = 13
|
24
|
+
SEVERITY_NUMBER_WARN2 = 14
|
25
|
+
SEVERITY_NUMBER_WARN3 = 15
|
26
|
+
SEVERITY_NUMBER_WARN4 = 16
|
27
|
+
SEVERITY_NUMBER_ERROR = 17
|
28
|
+
SEVERITY_NUMBER_ERROR2 = 18
|
29
|
+
SEVERITY_NUMBER_ERROR3 = 19
|
30
|
+
SEVERITY_NUMBER_ERROR4 = 20
|
31
|
+
SEVERITY_NUMBER_FATAL = 21
|
32
|
+
SEVERITY_NUMBER_FATAL2 = 22
|
33
|
+
SEVERITY_NUMBER_FATAL3 = 23
|
34
|
+
SEVERITY_NUMBER_FATAL4 = 24
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
# The Logs API records a timestamped record with metadata.
|
9
|
+
# In OpenTelemetry, any data that is not part of a distributed trace or a
|
10
|
+
# metric is a log. For example, events are a specific type of log.
|
11
|
+
#
|
12
|
+
# This API is provided for logging library authors to build log
|
13
|
+
# appenders/bridges. It should NOT be used directly by application
|
14
|
+
# developers.
|
15
|
+
module Logs
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'opentelemetry/logs/log_record'
|
20
|
+
require 'opentelemetry/logs/logger'
|
21
|
+
require 'opentelemetry/logs/logger_provider'
|
22
|
+
require 'opentelemetry/logs/severity_number'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
require 'opentelemetry'
|
8
|
+
require 'opentelemetry/logs'
|
9
|
+
require 'opentelemetry/logs/version'
|
10
|
+
require 'opentelemetry/internal/proxy_logger_provider'
|
11
|
+
require 'opentelemetry/internal/proxy_logger'
|
12
|
+
|
13
|
+
# OpenTelemetry is an open source observability framework, providing a
|
14
|
+
# general-purpose API, SDK, and related tools required for the instrumentation
|
15
|
+
# of cloud-native software, frameworks, and libraries.
|
16
|
+
#
|
17
|
+
# The OpenTelemetry module in the Logs API gem provides global accessors
|
18
|
+
# for logs-related objects.
|
19
|
+
module OpenTelemetry
|
20
|
+
@logger_provider = Internal::ProxyLoggerProvider.new
|
21
|
+
|
22
|
+
# Register the global logger provider.
|
23
|
+
#
|
24
|
+
# @param [LoggerProvider] provider A logger provider to register as the
|
25
|
+
# global instance.
|
26
|
+
def logger_provider=(provider)
|
27
|
+
@mutex.synchronize do
|
28
|
+
if @logger_provider.instance_of? Internal::ProxyLoggerProvider
|
29
|
+
logger.debug("Upgrading default proxy logger provider to #{provider.class}")
|
30
|
+
@logger_provider.delegate = provider
|
31
|
+
end
|
32
|
+
@logger_provider = provider
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Object, Logs::LoggerProvider] registered logger provider or a
|
37
|
+
# default no-op implementation of the logger provider.
|
38
|
+
def logger_provider
|
39
|
+
@mutex.synchronize { @logger_provider }
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opentelemetry-logs-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OpenTelemetry Authors
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opentelemetry-api
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.17'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.19'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.19'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.65'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.65'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.22'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.22'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.9'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.9'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard-doctest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.1'
|
125
|
+
description:
|
126
|
+
email:
|
127
|
+
- cncf-opentelemetry-contributors@lists.cncf.io
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".yardopts"
|
133
|
+
- CHANGELOG.md
|
134
|
+
- LICENSE
|
135
|
+
- lib/opentelemetry-logs-api.rb
|
136
|
+
- lib/opentelemetry/internal/proxy_logger.rb
|
137
|
+
- lib/opentelemetry/internal/proxy_logger_provider.rb
|
138
|
+
- lib/opentelemetry/logs.rb
|
139
|
+
- lib/opentelemetry/logs/log_record.rb
|
140
|
+
- lib/opentelemetry/logs/logger.rb
|
141
|
+
- lib/opentelemetry/logs/logger_provider.rb
|
142
|
+
- lib/opentelemetry/logs/severity_number.rb
|
143
|
+
- lib/opentelemetry/logs/version.rb
|
144
|
+
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
145
|
+
licenses:
|
146
|
+
- Apache-2.0
|
147
|
+
metadata:
|
148
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-logs-api/v0.1.0/file.CHANGELOG.html
|
149
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/logs_api
|
150
|
+
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
151
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-logs-api/v0.1.0
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '3.0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubygems_version: 3.2.33
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: Logs API implementation for OpenTelemetry
|
171
|
+
test_files: []
|