google-cloud-logging 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +10 -1
- data/README.md +21 -12
- data/lib/google-cloud-logging.rb +5 -4
- data/lib/google/cloud/logging.rb +7 -351
- data/lib/google/cloud/logging/logger.rb +2 -2
- data/lib/google/cloud/logging/middleware.rb +2 -2
- data/lib/google/cloud/logging/rails.rb +2 -1
- data/lib/google/cloud/logging/v2.rb +1 -0
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +2 -0
- data/lib/google/cloud/logging/v2/credentials.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +2 -1
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +5 -4
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +14 -8
- data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +7 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +1 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +9 -6
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +2 -0
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +2 -0
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/log_entry_pb.rb +1 -0
- data/lib/google/logging/v2/logging_config_pb.rb +1 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +1 -0
- data/lib/google/logging/v2/logging_metrics_pb.rb +1 -0
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +1 -0
- data/lib/google/logging/v2/logging_pb.rb +1 -0
- data/lib/google/logging/v2/logging_services_pb.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8b7a06296878a5094bc4de7d45d87b988297de5cec70e212c17b55639f07485
|
4
|
+
data.tar.gz: '090cc3fe558e01f326240b6c7ba23cc9607e480454f39be71ec0da9844cefa0e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fda5da167d780b2ad5dd119037291730e935927b57da558266168db82f587665608fc0e1df14b983dd8f87ac0d217b790a810ab037edaba2497b7558bdd19305
|
7
|
+
data.tar.gz: bb7324f057ca44e027fcaf532360b66e5ec25a377ff32ae20f88accae7f0b2097117f61c626d966dac18e67998b9fe95ef8a55f8fe817a38fa248e842c17fa03
|
data/.yardopts
CHANGED
@@ -3,7 +3,16 @@
|
|
3
3
|
--exclude _pb\.rb$
|
4
4
|
--markup markdown
|
5
5
|
--markup-provider redcarpet
|
6
|
+
--main OVERVIEW.md
|
6
7
|
|
7
8
|
./lib/**/*.rb
|
8
9
|
-
|
9
|
-
|
10
|
+
OVERVIEW.md
|
11
|
+
AUTHENTICATION.md
|
12
|
+
INSTRUMENTATION.md
|
13
|
+
LOGGING.md
|
14
|
+
CONTRIBUTING.md
|
15
|
+
TROUBLESHOOTING.md
|
16
|
+
CHANGELOG.md
|
17
|
+
CODE_OF_CONDUCT.md
|
18
|
+
LICENSE
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[Stackdriver Logging](https://cloud.google.com/logging/) ([docs](https://cloud.google.com/logging/docs/)) allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services (AWS). It supports ingestion of any custom log data from any source. Stackdriver Logging is a fully-managed service that performs at scale and can ingest application and system log data from thousands of VMs. Even better, you can analyze all that log data in real-time.
|
4
4
|
|
5
|
-
- [google-cloud-logging API documentation](http://googlecloudplatform.github.io/google-cloud-ruby
|
5
|
+
- [google-cloud-logging API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest)
|
6
6
|
- [google-cloud-logging on RubyGems](https://rubygems.org/gems/google-cloud-logging)
|
7
7
|
- [Stackdriver Logging documentation](https://cloud.google.com/logging/docs/)
|
8
8
|
|
@@ -112,7 +112,7 @@ logger.
|
|
112
112
|
### Configuring the framework integration
|
113
113
|
|
114
114
|
You can customize the behavior of the Stackdriver Logging framework integration
|
115
|
-
for Ruby. See the [configuration guide](../stackdriver/
|
115
|
+
for Ruby. See the [configuration guide](../stackdriver/CONFIGURATION.md) for a
|
116
116
|
list of possible configuration options.
|
117
117
|
|
118
118
|
## Authentication
|
@@ -153,12 +153,12 @@ end
|
|
153
153
|
```
|
154
154
|
|
155
155
|
See the [Authentication
|
156
|
-
Guide](https://googlecloudplatform.github.io/google-cloud-ruby
|
156
|
+
Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/file.AUTHENTICATION).
|
157
157
|
for more ways to authenticate the client library.
|
158
158
|
|
159
159
|
## Enabling Logging
|
160
160
|
|
161
|
-
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below, or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby
|
161
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below, or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/Google/Cloud/Logging/Logger) that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb) and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
162
162
|
|
163
163
|
Configuring a Ruby stdlib logger:
|
164
164
|
|
@@ -183,9 +183,9 @@ end
|
|
183
183
|
This library is supported on Ruby 2.3+.
|
184
184
|
|
185
185
|
Google provides official support for Ruby versions that are actively supported
|
186
|
-
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
187
|
-
|
188
|
-
|
186
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or in
|
187
|
+
security maintenance, and not end of life. Currently, this means Ruby 2.3 and
|
188
|
+
later. Older versions of Ruby _may_ still work, but are unsupported and not
|
189
189
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
190
190
|
about the Ruby support schedule.
|
191
191
|
|
@@ -197,15 +197,24 @@ This library follows [Semantic Versioning](http://semver.org/).
|
|
197
197
|
|
198
198
|
Contributions to this library are always welcome and highly encouraged.
|
199
199
|
|
200
|
-
See the [Contributing
|
200
|
+
See the [Contributing
|
201
|
+
Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/file.CONTRIBUTING)
|
202
|
+
for more information on how to get started.
|
201
203
|
|
202
|
-
Please note that this project is released with a Contributor Code of Conduct. By
|
204
|
+
Please note that this project is released with a Contributor Code of Conduct. By
|
205
|
+
participating in this project you agree to abide by its terms. See [Code of
|
206
|
+
Conduct](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/file.CODE_OF_CONDUCT)
|
207
|
+
for more information.
|
203
208
|
|
204
209
|
## License
|
205
210
|
|
206
|
-
This library is licensed under Apache 2.0. Full license text is available in
|
211
|
+
This library is licensed under Apache 2.0. Full license text is available in
|
212
|
+
[LICENSE](https://googlecloudplatform.github.io/google-cloud-ruby/docs/google-cloud-logging/latest/file.LICENSE).
|
207
213
|
|
208
214
|
## Support
|
209
215
|
|
210
|
-
Please [report bugs at the project on
|
211
|
-
|
216
|
+
Please [report bugs at the project on
|
217
|
+
Github](https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues). Don't
|
218
|
+
hesitate to [ask
|
219
|
+
questions](http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby)
|
220
|
+
about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
data/lib/google-cloud-logging.rb
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
##
|
16
17
|
# This file is here to be autorequired by bundler, so that the
|
17
18
|
# Google::Cloud.logging and Google::Cloud#logging methods can be available, but
|
@@ -29,8 +30,8 @@ module Google
|
|
29
30
|
# Creates a new object for connecting to the Stackdriver Logging service.
|
30
31
|
# Each call creates a new connection.
|
31
32
|
#
|
32
|
-
# For more information on connecting to Google Cloud see the
|
33
|
-
# Guide
|
33
|
+
# For more information on connecting to Google Cloud see the
|
34
|
+
# {file:AUTHENTICATION.md Authentication Guide}.
|
34
35
|
#
|
35
36
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
36
37
|
# set of resources and operations that the connection can access. See
|
@@ -75,8 +76,8 @@ module Google
|
|
75
76
|
# Creates a new object for connecting to the Stackdriver Logging service.
|
76
77
|
# Each call creates a new connection.
|
77
78
|
#
|
78
|
-
# For more information on connecting to Google Cloud see the
|
79
|
-
# Guide
|
79
|
+
# For more information on connecting to Google Cloud see the
|
80
|
+
# {file:AUTHENTICATION.md Authentication Guide}.
|
80
81
|
#
|
81
82
|
# @param [String] project_id Project identifier for the Stackdriver Logging
|
82
83
|
# service you are connecting to. If not present, the default project for
|
data/lib/google/cloud/logging.rb
CHANGED
@@ -29,358 +29,15 @@ module Google
|
|
29
29
|
# programmatic control over your projects' logs. You can use the Stackdriver
|
30
30
|
# Logging API to:
|
31
31
|
#
|
32
|
-
# *
|
33
|
-
# *
|
34
|
-
#
|
35
|
-
# *
|
36
|
-
# Cloud Monitoring
|
37
|
-
# * [Write log entries](#writing-log-entries)
|
32
|
+
# * Read and filter log entries
|
33
|
+
# * Export your log entries to Cloud Storage, BigQuery, or Cloud Pub/Sub
|
34
|
+
# * Create logs-based metrics for use in Cloud Monitoring
|
35
|
+
# * Write log entries
|
38
36
|
#
|
39
37
|
# For general information about Stackdriver Logging, read [Stackdriver
|
40
38
|
# Logging Documentation](https://cloud.google.com/logging/docs/).
|
41
39
|
#
|
42
|
-
#
|
43
|
-
# Rubyists. Your authentication credentials are detected automatically in
|
44
|
-
# Google Cloud Platform environments such as Google Compute Engine, Google
|
45
|
-
# App Engine and Google Kubernetes Engine. In other environments you can
|
46
|
-
# configure authentication easily, either directly in your code or via
|
47
|
-
# environment variables. Read more about the options for connecting in the
|
48
|
-
# [Authentication
|
49
|
-
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
50
|
-
#
|
51
|
-
# If you just want to write your application's logs to the Stackdriver
|
52
|
-
# Logging service, you may find it easiest to use the [Stackdriver Logging
|
53
|
-
# Instrumentation](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/instrumentation)
|
54
|
-
# or the [Ruby Logger
|
55
|
-
# implementation](#creating-a-ruby-logger-implementation) provided by this
|
56
|
-
# library. Otherwise, read on to learn more about the Logging API.
|
57
|
-
#
|
58
|
-
# ## Enabling Logging
|
59
|
-
#
|
60
|
-
# To enable logging for this library, set the logger for the underlying
|
61
|
-
# [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The
|
62
|
-
# logger that you set may be a Ruby stdlib
|
63
|
-
# [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html)
|
64
|
-
# as shown below, or a
|
65
|
-
# [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
66
|
-
# that will write logs to [Stackdriver
|
67
|
-
# Logging](https://cloud.google.com/logging/). See
|
68
|
-
# [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
69
|
-
# and the gRPC
|
70
|
-
# [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb)
|
71
|
-
# for additional information.
|
72
|
-
#
|
73
|
-
# Configuring a Ruby stdlib logger:
|
74
|
-
#
|
75
|
-
# ```ruby
|
76
|
-
# require "logger"
|
77
|
-
#
|
78
|
-
# module MyLogger
|
79
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
80
|
-
# def logger
|
81
|
-
# LOGGER
|
82
|
-
# end
|
83
|
-
# end
|
84
|
-
#
|
85
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
86
|
-
# module GRPC
|
87
|
-
# extend MyLogger
|
88
|
-
# end
|
89
|
-
# ```x
|
90
|
-
#
|
91
|
-
# ## Listing log entries
|
92
|
-
#
|
93
|
-
# Stackdriver Logging gathers log entries from many services, including
|
94
|
-
# Google App Engine and Google Compute Engine. (See the [List of Log
|
95
|
-
# Types](https://cloud.google.com/logging/docs/view/logs_index).) In
|
96
|
-
# addition, you can write your own log entries to the service.
|
97
|
-
#
|
98
|
-
# {Google::Cloud::Logging::Project#entries} returns the
|
99
|
-
# {Google::Cloud::Logging::Entry} records belonging to your project:
|
100
|
-
#
|
101
|
-
# ```ruby
|
102
|
-
# require "google/cloud/logging"
|
103
|
-
#
|
104
|
-
# logging = Google::Cloud::Logging.new
|
105
|
-
# entries = logging.entries
|
106
|
-
# entries.each do |e|
|
107
|
-
# puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
|
108
|
-
# end
|
109
|
-
# ```
|
110
|
-
#
|
111
|
-
# You can narrow the results to a single log using an [advanced logs
|
112
|
-
# filter](https://cloud.google.com/logging/docs/view/advanced_filters). A
|
113
|
-
# log is a named collection of entries. Logs can be produced by Google Cloud
|
114
|
-
# Platform services, by third-party services, or by your applications. For
|
115
|
-
# example, the log `compute.googleapis.com/activity_log` is produced by
|
116
|
-
# Google Compute Engine. Logs are simply referenced by name in google-cloud.
|
117
|
-
# There is no `Log` type in google-cloud or `Log` resource in the
|
118
|
-
# Stackdriver Logging API.
|
119
|
-
#
|
120
|
-
# ```ruby
|
121
|
-
# require "google/cloud/logging"
|
122
|
-
#
|
123
|
-
# logging = Google::Cloud::Logging.new
|
124
|
-
# entries = logging.entries filter: "logName:syslog"
|
125
|
-
# entries.each do |e|
|
126
|
-
# puts "[#{e.timestamp}] #{e.payload.inspect}"
|
127
|
-
# end
|
128
|
-
# ```
|
129
|
-
#
|
130
|
-
# You can also order the log entries by `timestamp`.
|
131
|
-
#
|
132
|
-
# ```ruby
|
133
|
-
# require "google/cloud/logging"
|
134
|
-
#
|
135
|
-
# logging = Google::Cloud::Logging.new
|
136
|
-
# entries = logging.entries order: "timestamp desc"
|
137
|
-
# entries.each do |e|
|
138
|
-
# puts "[#{e.timestamp}] #{e.log_name}"
|
139
|
-
# end
|
140
|
-
# ```
|
141
|
-
#
|
142
|
-
# ## Exporting log entries
|
143
|
-
#
|
144
|
-
# Stackdriver Logging lets you export log entries to destinations including
|
145
|
-
# Google Cloud Storage buckets (for long term log storage), Google BigQuery
|
146
|
-
# datasets (for log analysis), and Google Pub/Sub (for streaming to other
|
147
|
-
# applications).
|
148
|
-
#
|
149
|
-
# ### Creating sinks
|
150
|
-
#
|
151
|
-
# A {Google::Cloud::Logging::Sink} is an object that lets you to specify a
|
152
|
-
# set of log entries to export.
|
153
|
-
#
|
154
|
-
# In addition to the name of the sink and the export destination,
|
155
|
-
# {Google::Cloud::Logging::Project#create_sink} accepts an [advanced logs
|
156
|
-
# filter](https://cloud.google.com/logging/docs/view/advanced_filters) to
|
157
|
-
# narrow the collection.
|
158
|
-
#
|
159
|
-
# Before creating the sink, ensure that you have granted
|
160
|
-
# `cloud-logs@google.com` permission to write logs to the destination. See
|
161
|
-
# [Exporting Logs
|
162
|
-
# (V2)](https://cloud.google.com/logging/docs/export/configure_export_v2).
|
163
|
-
#
|
164
|
-
# ```ruby
|
165
|
-
# require "google/cloud/storage"
|
166
|
-
# require "google/cloud/logging"
|
167
|
-
#
|
168
|
-
# storage = Google::Cloud::Storage.new
|
169
|
-
#
|
170
|
-
# bucket = storage.create_bucket "my-logs-bucket"
|
171
|
-
#
|
172
|
-
# # Grant owner permission to Stackdriver Logging service
|
173
|
-
# email = "cloud-logs@google.com"
|
174
|
-
# bucket.acl.add_owner "group-#{email}"
|
175
|
-
#
|
176
|
-
# logging = Google::Cloud::Logging.new
|
177
|
-
#
|
178
|
-
# sink = logging.create_sink "my-sink",
|
179
|
-
# "storage.googleapis.com/#{bucket.id}"
|
180
|
-
# ```
|
181
|
-
#
|
182
|
-
# When you create a sink, only new log entries are exported. Stackdriver
|
183
|
-
# Logging does not send previously-ingested log entries to the sink's
|
184
|
-
# destination.
|
185
|
-
#
|
186
|
-
# ### Listing sinks
|
187
|
-
#
|
188
|
-
# You can also list the sinks belonging to your project with
|
189
|
-
# {Google::Cloud::Logging::Project#sinks}.
|
190
|
-
#
|
191
|
-
# ```ruby
|
192
|
-
# require "google/cloud/logging"
|
193
|
-
#
|
194
|
-
# logging = Google::Cloud::Logging.new
|
195
|
-
# sinks = logging.sinks
|
196
|
-
# sinks.each do |s|
|
197
|
-
# puts "#{s.name}: #{s.filter} -> #{s.destination}"
|
198
|
-
# end
|
199
|
-
# ```
|
200
|
-
#
|
201
|
-
# ## Creating logs-based metrics
|
202
|
-
#
|
203
|
-
# You can use log entries in your project as the basis for [Google Cloud
|
204
|
-
# Monitoring](https://cloud.google.com/monitoring/docs) metrics. These
|
205
|
-
# metrics can then be used to produce Cloud Monitoring reports and alerts.
|
206
|
-
#
|
207
|
-
# ### Creating metrics
|
208
|
-
#
|
209
|
-
# A metric is a measured value that can be used to assess a system. Use
|
210
|
-
# {Google::Cloud::Logging::Project#create_metric} to configure a
|
211
|
-
# {Google::Cloud::Logging::Metric} based on a collection of log entries
|
212
|
-
# matching an [advanced logs
|
213
|
-
# filter](https://cloud.google.com/logging/docs/view/advanced_filters).
|
214
|
-
#
|
215
|
-
# ```ruby
|
216
|
-
# require "google/cloud/logging"
|
217
|
-
#
|
218
|
-
# logging = Google::Cloud::Logging.new
|
219
|
-
# metric = logging.create_metric "errors", "severity>=ERROR"
|
220
|
-
# ```
|
221
|
-
#
|
222
|
-
# ### Listing metrics
|
223
|
-
#
|
224
|
-
# You can also list the metrics belonging to your project with
|
225
|
-
# {Google::Cloud::Logging::Project#metrics}.
|
226
|
-
#
|
227
|
-
# ```ruby
|
228
|
-
# require "google/cloud/logging"
|
229
|
-
#
|
230
|
-
# logging = Google::Cloud::Logging.new
|
231
|
-
# metrics = logging.metrics
|
232
|
-
# metrics.each do |m|
|
233
|
-
# puts "#{m.name}: #{m.filter}"
|
234
|
-
# end
|
235
|
-
# ```
|
236
|
-
#
|
237
|
-
# ## Writing log entries
|
238
|
-
#
|
239
|
-
# An {Google::Cloud::Logging::Entry} is composed of metadata and a payload.
|
240
|
-
# The payload is traditionally a message string, but in Stackdriver Logging
|
241
|
-
# it can also be a JSON or protocol buffer object. A single log can have
|
242
|
-
# entries with different payload types. In addition to the payload, your
|
243
|
-
# argument(s) to {Google::Cloud::Logging::Project#write_entries} must also
|
244
|
-
# contain a log name and a resource.
|
245
|
-
#
|
246
|
-
# ```ruby
|
247
|
-
# require "google/cloud/logging"
|
248
|
-
#
|
249
|
-
# logging = Google::Cloud::Logging.new
|
250
|
-
#
|
251
|
-
# entry = logging.entry
|
252
|
-
# entry.payload = "Job started."
|
253
|
-
# entry.log_name = "my_app_log"
|
254
|
-
# entry.resource.type = "gae_app"
|
255
|
-
# entry.resource.labels[:module_id] = "1"
|
256
|
-
# entry.resource.labels[:version_id] = "20150925t173233"
|
257
|
-
#
|
258
|
-
# logging.write_entries entry
|
259
|
-
# ```
|
260
|
-
#
|
261
|
-
# To write a JSON payload to the log, simply pass a hash argument:
|
262
|
-
#
|
263
|
-
# ```ruby
|
264
|
-
# require "google/cloud/logging"
|
265
|
-
#
|
266
|
-
# logging = Google::Cloud::Logging.new
|
267
|
-
#
|
268
|
-
# entry = logging.entry
|
269
|
-
# entry.payload = { "stats" => { "a" => 8, "b" => 12.5} }
|
270
|
-
# entry.log_name = "my_app_log"
|
271
|
-
# entry.resource.type = "gae_app"
|
272
|
-
# entry.resource.labels[:module_id] = "1"
|
273
|
-
# entry.resource.labels[:version_id] = "20150925t173233"
|
274
|
-
#
|
275
|
-
# logging.write_entries entry
|
276
|
-
# ```
|
277
|
-
#
|
278
|
-
# If you write a collection of log entries, you can provide the log name,
|
279
|
-
# resource, and/or labels hash to be used for all of the entries, and omit
|
280
|
-
# these values from the individual entries.
|
281
|
-
#
|
282
|
-
# ```ruby
|
283
|
-
# require "google/cloud/logging"
|
284
|
-
#
|
285
|
-
# logging = Google::Cloud::Logging.new
|
286
|
-
#
|
287
|
-
# entry1 = logging.entry
|
288
|
-
# entry1.payload = "Job started."
|
289
|
-
# entry2 = logging.entry
|
290
|
-
# entry2.payload = "Job completed."
|
291
|
-
# labels = { job_size: "large", job_code: "red" }
|
292
|
-
#
|
293
|
-
# resource = logging.resource "gae_app",
|
294
|
-
# "module_id" => "1",
|
295
|
-
# "version_id" => "20150925t173233"
|
296
|
-
#
|
297
|
-
# logging.write_entries [entry1, entry2],
|
298
|
-
# log_name: "my_app_log",
|
299
|
-
# resource: resource,
|
300
|
-
# labels: labels
|
301
|
-
# ```
|
302
|
-
#
|
303
|
-
# Normally, writing log entries is done synchronously; the call to
|
304
|
-
# {Google::Cloud::Logging::Project#write_entries} will block until it has
|
305
|
-
# either completed transmitting the data or encountered an error. To "fire
|
306
|
-
# and forget" without blocking, use {Google::Cloud::Logging::AsyncWriter};
|
307
|
-
# it spins up a background thread that writes log entries in batches. Calls
|
308
|
-
# to {Google::Cloud::Logging::AsyncWriter#write_entries} simply add entries
|
309
|
-
# to its work queue and return immediately.
|
310
|
-
#
|
311
|
-
# ```ruby
|
312
|
-
# require "google/cloud/logging"
|
313
|
-
#
|
314
|
-
# logging = Google::Cloud::Logging.new
|
315
|
-
# async = logging.async_writer
|
316
|
-
#
|
317
|
-
# entry1 = logging.entry
|
318
|
-
# entry1.payload = "Job started."
|
319
|
-
# entry2 = logging.entry
|
320
|
-
# entry2.payload = "Job completed."
|
321
|
-
# labels = { job_size: "large", job_code: "red" }
|
322
|
-
#
|
323
|
-
# resource = logging.resource "gae_app",
|
324
|
-
# "module_id" => "1",
|
325
|
-
# "version_id" => "20150925t173233"
|
326
|
-
#
|
327
|
-
# async.write_entries [entry1, entry2],
|
328
|
-
# log_name: "my_app_log",
|
329
|
-
# resource: resource,
|
330
|
-
# labels: labels,
|
331
|
-
# partial_success: true
|
332
|
-
# ```
|
333
|
-
#
|
334
|
-
# ### Creating a Ruby Logger implementation
|
335
|
-
#
|
336
|
-
# If your environment requires a logger instance that is API-compatible with
|
337
|
-
# Ruby's standard library
|
338
|
-
# [Logger](http://ruby-doc.org/stdlib/libdoc/logger/rdoc), you can use
|
339
|
-
# {Google::Cloud::Logging::Project#logger} to create one.
|
340
|
-
#
|
341
|
-
# ```ruby
|
342
|
-
# require "google/cloud/logging"
|
343
|
-
#
|
344
|
-
# logging = Google::Cloud::Logging.new
|
345
|
-
#
|
346
|
-
# resource = logging.resource "gae_app",
|
347
|
-
# module_id: "1",
|
348
|
-
# version_id: "20150925t173233"
|
349
|
-
#
|
350
|
-
# logger = logging.logger "my_app_log", resource, env: :production
|
351
|
-
# logger.info "Job started."
|
352
|
-
# ```
|
353
|
-
#
|
354
|
-
# By default, the logger instance writes log entries asynchronously in a
|
355
|
-
# background thread using an {Google::Cloud::Logging::AsyncWriter}. If you
|
356
|
-
# want to customize or disable asynchronous writing, you may call the
|
357
|
-
# Logger constructor directly.
|
358
|
-
#
|
359
|
-
# ```ruby
|
360
|
-
# require "google/cloud/logging"
|
361
|
-
#
|
362
|
-
# logging = Google::Cloud::Logging.new
|
363
|
-
#
|
364
|
-
# resource = logging.resource "gae_app",
|
365
|
-
# module_id: "1",
|
366
|
-
# version_id: "20150925t173233"
|
367
|
-
#
|
368
|
-
# logger = Google::Cloud::Logging::Logger.new logging,
|
369
|
-
# "my_app_log",
|
370
|
-
# resource,
|
371
|
-
# {env: :production}
|
372
|
-
# logger.info "Log entry written synchronously."
|
373
|
-
# ```
|
374
|
-
#
|
375
|
-
# ## Configuring timeout
|
376
|
-
#
|
377
|
-
# You can configure the request `timeout` value in seconds.
|
378
|
-
#
|
379
|
-
# ```ruby
|
380
|
-
# require "google/cloud/logging"
|
381
|
-
#
|
382
|
-
# logging = Google::Cloud::Logging.new timeout: 120
|
383
|
-
# ```
|
40
|
+
# See {file:OVERVIEW.md Stackdriver Logging Overview}.
|
384
41
|
#
|
385
42
|
module Logging
|
386
43
|
##
|
@@ -388,8 +45,7 @@ module Google
|
|
388
45
|
# Each call creates a new connection.
|
389
46
|
#
|
390
47
|
# For more information on connecting to Google Cloud see the
|
391
|
-
#
|
392
|
-
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
|
48
|
+
# {file:AUTHENTICATION.md Authentication Guide}.
|
393
49
|
#
|
394
50
|
# @param [String] project_id Project identifier for the Stackdriver
|
395
51
|
# Logging service you are connecting to. If not present, the default
|
@@ -482,7 +138,7 @@ module Google
|
|
482
138
|
# Rack environment.
|
483
139
|
#
|
484
140
|
# See the [Configuration
|
485
|
-
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby
|
141
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION)
|
486
142
|
# for full configuration parameters.
|
487
143
|
#
|
488
144
|
# @return [Google::Cloud::Config] The configuration object
|
@@ -64,7 +64,7 @@ module Google
|
|
64
64
|
RequestInfo = ::Struct.new :trace_id, :log_name, :env
|
65
65
|
|
66
66
|
##
|
67
|
-
# The Google Cloud writer object that calls to
|
67
|
+
# The Google Cloud writer object that calls to `#write_entries` are made
|
68
68
|
# on. Either an AsyncWriter or Project object.
|
69
69
|
attr_reader :writer
|
70
70
|
|
@@ -131,7 +131,7 @@ module Google
|
|
131
131
|
# entries. Generally, to create a logger that blocks on transmitting
|
132
132
|
# log entries, pass the Project; otherwise, to create a logger that
|
133
133
|
# transmits log entries in the background, pass an AsyncWriter. You
|
134
|
-
# may also pass any other object that responds to
|
134
|
+
# may also pass any other object that responds to `#write_entries`.
|
135
135
|
# @param [String] log_name A log resource name to be associated with the
|
136
136
|
# written log entries.
|
137
137
|
# @param [Google::Cloud::Logging::Resource] resource The monitored
|
@@ -43,9 +43,9 @@ module Google
|
|
43
43
|
# to track Stackdriver request trace ID. It also properly sets
|
44
44
|
# env["rack.logger"] to this assigned logger for accessing. If not
|
45
45
|
# specified, a default logger with be used.
|
46
|
-
# @param [Hash]
|
46
|
+
# @param [Hash] kwargs Hash of configuration settings. Used for
|
47
47
|
# backward API compatibility. See the [Configuration
|
48
|
-
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby
|
48
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION)
|
49
49
|
# for the prefered way to set configuration parameters.
|
50
50
|
#
|
51
51
|
# @return [Google::Cloud::Logging::Middleware] A new
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/logging"
|
16
17
|
|
17
18
|
module Google
|
@@ -36,7 +37,7 @@ module Google
|
|
36
37
|
# before the `Rails::Rack::Logger Middleware`, which allows it to set the
|
37
38
|
# `env['rack.logger']` in place of Rails's default logger.
|
38
39
|
# See the [Configuration
|
39
|
-
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby
|
40
|
+
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/docs/stackdriver/latest/file.INSTRUMENTATION_CONFIGURATION)
|
40
41
|
# on how to configure the Railtie and Middleware.
|
41
42
|
#
|
42
43
|
class Railtie < ::Rails::Railtie
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/logging/v2/config_service_v2_client"
|
16
17
|
require "google/cloud/logging/v2/logging_service_v2_client"
|
17
18
|
require "google/cloud/logging/v2/metrics_service_v2_client"
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
21
|
|
22
|
+
|
22
23
|
require "json"
|
23
24
|
require "pathname"
|
24
25
|
|
@@ -37,6 +38,7 @@ module Google
|
|
37
38
|
# @!attribute [r] config_service_v2_stub
|
38
39
|
# @return [Google::Logging::V2::ConfigServiceV2::Stub]
|
39
40
|
class ConfigServiceV2Client
|
41
|
+
# @private
|
40
42
|
attr_reader :config_service_v2_stub
|
41
43
|
|
42
44
|
# The default address of the service.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Api
|
17
18
|
# Defines a metric type and its schema. Once a metric descriptor is created,
|
@@ -106,7 +107,7 @@ module Google
|
|
106
107
|
#
|
107
108
|
# * +Annotation+ is just a comment if it follows a +UNIT+ and is
|
108
109
|
# equivalent to +1+ if it is used alone. For examples,
|
109
|
-
#
|
110
|
+
# +\\{requests}/s == 1/s+, +By\\{transmitted}/s == By/s+.
|
110
111
|
# * +NAME+ is a sequence of non-blank printable ASCII characters not
|
111
112
|
# containing '{' or '}'.
|
112
113
|
# * +1+ represents dimensionless value 1, such as in +1/s+.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Api
|
17
18
|
# An object that describes the schema of a {Google::Api::MonitoredResource MonitoredResource} object using a
|
@@ -26,11 +27,11 @@ module Google
|
|
26
27
|
# @!attribute [rw] name
|
27
28
|
# @return [String]
|
28
29
|
# Optional. The resource name of the monitored resource descriptor:
|
29
|
-
# +"projects
|
30
|
-
# {type} is the value of the +type+ field in this object and
|
31
|
-
# {project_id} is a project ID that provides API-specific context for
|
30
|
+
# +"projects/\\{project_id}/monitoredResourceDescriptors/\\{type}"+ where
|
31
|
+
# \\{type} is the value of the +type+ field in this object and
|
32
|
+
# \\{project_id} is a project ID that provides API-specific context for
|
32
33
|
# accessing the type. APIs that do not use project information can use the
|
33
|
-
# resource name format +"monitoredResourceDescriptors
|
34
|
+
# resource name format +"monitoredResourceDescriptors/\\{type}"+.
|
34
35
|
# @!attribute [rw] type
|
35
36
|
# @return [String]
|
36
37
|
# Required. The monitored resource type. For example, the type
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +Any+ contains an arbitrary serialized protocol buffer message along with a
|
@@ -95,17 +96,18 @@ module Google
|
|
95
96
|
# }
|
96
97
|
# @!attribute [rw] type_url
|
97
98
|
# @return [String]
|
98
|
-
# A URL/resource name
|
99
|
-
#
|
99
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
+
# protocol buffer message. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# +path/google.protobuf.Duration+). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
100
104
|
#
|
101
|
-
#
|
102
|
-
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme +http+, +https+, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
103
109
|
#
|
104
110
|
# * If no scheme is provided, +https+ is assumed.
|
105
|
-
# * The last segment of the URL's path must represent the fully
|
106
|
-
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
107
|
-
# The name should be in a canonical form (e.g., leading "." is
|
108
|
-
# not accepted).
|
109
111
|
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
110
112
|
# value in binary format, or produce an error.
|
111
113
|
# * Applications are allowed to cache lookup results based on the
|
@@ -114,6 +116,10 @@ module Google
|
|
114
116
|
# on changes to types. (Use versioned type names to manage
|
115
117
|
# breaking changes.)
|
116
118
|
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
117
123
|
# Schemes other than +http+, +https+ (or the empty scheme) might be
|
118
124
|
# used with implementation specific semantics.
|
119
125
|
# @!attribute [rw] value
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +FieldMask+ represents a set of symbolic field paths, for example:
|
@@ -215,6 +216,12 @@ module Google
|
|
215
216
|
#
|
216
217
|
# Note that oneof type names ("test_oneof" in this case) cannot be used in
|
217
218
|
# paths.
|
219
|
+
#
|
220
|
+
# == Field Mask Verification
|
221
|
+
#
|
222
|
+
# The implementation of any API method which has a FieldMask type field in the
|
223
|
+
# request should verify the included field paths, and return an
|
224
|
+
# +INVALID_ARGUMENT+ error if any path is duplicated or unmappable.
|
218
225
|
# @!attribute [rw] paths
|
219
226
|
# @return [Array<String>]
|
220
227
|
# The set of field mask paths.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# A Timestamp represents a point in time independent of any time zone
|
@@ -72,12 +73,14 @@ module Google
|
|
72
73
|
#
|
73
74
|
# In JSON format, the Timestamp type is encoded as a string in the
|
74
75
|
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
75
|
-
# format is "{year}
|
76
|
-
# where {year} is always expressed using four digits while {month}, {day},
|
77
|
-
# {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
76
|
+
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
77
|
+
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
78
|
+
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
78
79
|
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
79
80
|
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
80
|
-
# is required
|
81
|
+
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
82
|
+
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
83
|
+
# able to accept both UTC and other timezones (as indicated by an offset).
|
81
84
|
#
|
82
85
|
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
83
86
|
# 01:30 UTC on January 15, 2017.
|
@@ -88,8 +91,8 @@ module Google
|
|
88
91
|
# to this format using [+strftime+](https://docs.python.org/2/library/time.html#time.strftime)
|
89
92
|
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
90
93
|
# can use the Joda Time's [+ISODateTimeFormat.dateTime()+](
|
91
|
-
# http://joda-time
|
92
|
-
# to obtain a formatter capable of generating timestamps in this format.
|
94
|
+
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
|
95
|
+
# ) to obtain a formatter capable of generating timestamps in this format.
|
93
96
|
# @!attribute [rw] seconds
|
94
97
|
# @return [Integer]
|
95
98
|
# Represents seconds of UTC time since Unix epoch
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
21
|
|
22
|
+
|
22
23
|
require "json"
|
23
24
|
require "pathname"
|
24
25
|
|
@@ -36,6 +37,7 @@ module Google
|
|
36
37
|
# @!attribute [r] logging_service_v2_stub
|
37
38
|
# @return [Google::Logging::V2::LoggingServiceV2::Stub]
|
38
39
|
class LoggingServiceV2Client
|
40
|
+
# @private
|
39
41
|
attr_reader :logging_service_v2_stub
|
40
42
|
|
41
43
|
# The default address of the service.
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
21
|
|
22
|
+
|
22
23
|
require "json"
|
23
24
|
require "pathname"
|
24
25
|
|
@@ -36,6 +37,7 @@ module Google
|
|
36
37
|
# @!attribute [r] metrics_service_v2_stub
|
37
38
|
# @return [Google::Logging::V2::MetricsServiceV2::Stub]
|
38
39
|
class MetricsServiceV2Client
|
40
|
+
# @private
|
39
41
|
attr_reader :metrics_service_v2_stub
|
40
42
|
|
41
43
|
# The default address of the service.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -197,16 +197,16 @@ dependencies:
|
|
197
197
|
name: yard-doctest
|
198
198
|
requirement: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
|
-
- - "
|
200
|
+
- - "~>"
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version: 0.1.
|
202
|
+
version: 0.1.13
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
205
|
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
|
-
- - "
|
207
|
+
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.1.
|
209
|
+
version: 0.1.13
|
210
210
|
- !ruby/object:Gem::Dependency
|
211
211
|
name: railties
|
212
212
|
requirement: !ruby/object:Gem::Requirement
|