Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
fail-fast: false
matrix:
rvm:
- 2.7
- 3.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.2
Exclude:
# Generated files.
- 'lib/google/**/*'
Expand Down
8 changes: 4 additions & 4 deletions fluent-plugin-google-cloud.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Gem::Specification.new do |gem|
gem.homepage =
'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
gem.license = 'Apache-2.0'
gem.version = '0.13.4'
gem.version = '0.13.5'
gem.authors = ['Stackdriver Agents Team']
gem.email = ['stackdriver-agents@google.com']
gem.required_ruby_version = Gem::Requirement.new('>= 2.7')
gem.required_ruby_version = Gem::Requirement.new('>= 3.2')

gem.files = Dir['**/*'].keep_if { |file| File.file?(file) }
gem.test_files = gem.files.grep(/^(test)/)
Expand All @@ -22,14 +22,14 @@ Gem::Specification.new do |gem|
# NOTE: In order to update the Fluentd version, please update both here and
# also the fluentd version in
# https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/config/software/fluentd.rb.
gem.add_runtime_dependency 'fluentd', '1.16.2'
gem.add_runtime_dependency 'fluentd', '1.19.0'
gem.add_runtime_dependency 'google-api-client', '0.53.0'
gem.add_runtime_dependency 'googleapis-common-protos', '1.4.0'
gem.add_runtime_dependency 'googleauth', '1.3.0'
gem.add_runtime_dependency 'google-cloud-logging', '2.3.2'
gem.add_runtime_dependency 'google-cloud-monitoring-v3', '0.10.0'
gem.add_runtime_dependency 'google-protobuf', '3.25.5'
gem.add_runtime_dependency 'grpc', '1.65.2'
gem.add_runtime_dependency 'grpc', '1.70.1'
gem.add_runtime_dependency 'json', '2.6.3'
gem.add_runtime_dependency 'opencensus', '0.5.0'
gem.add_runtime_dependency 'opencensus-stackdriver', '0.4.1'
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/plugin/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def get_location(platform, zone, use_aws_availability_zone)
# Create a monitored resource from type and labels.
def create_monitored_resource(type, labels)
Google::Apis::LoggingV2::MonitoredResource.new(
type: type, labels: labels.to_h
type:, labels: labels.to_h
)
end

Expand Down
7 changes: 3 additions & 4 deletions lib/fluent/plugin/filter_analyze_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
require 'googleauth'
require 'google/apis/logging_v2'
require 'open-uri'
require 'set'

require_relative 'common'
require_relative 'monitoring'
Expand Down Expand Up @@ -336,9 +335,9 @@ def configure(conf)
end
enabled_plugins_counter.increment(
labels: {
plugin_name: plugin_name,
is_default_plugin: is_default_plugin,
has_default_config: has_default_config,
plugin_name:,
is_default_plugin:,
has_default_config:,
has_ruby_snippet: embedded_ruby?(e)
},
by: 1
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/plugin/monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def counter(name, labels, docstring, prefix, aggregation)
@recorders[prefix].register_view(
OpenCensus::Stats::View.new(
name: translator.name,
measure: measure,
measure:,
aggregation: stats_aggregation,
description: docstring,
columns: translator.view_labels.map(&:to_s)
Expand Down
40 changes: 20 additions & 20 deletions lib/fluent/plugin/out_google_cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,8 @@ def write(chunk)
)}"

requests_to_send << {
entries: entries,
log_name: log_name,
entries:,
log_name:,
resource: group_level_resource,
labels: group_level_common_labels
}
Expand Down Expand Up @@ -847,7 +847,7 @@ def construct_log_entry_in_grpc_format(labels,
ts_secs,
ts_nanos)
entry = Google::Cloud::Logging::V2::LogEntry.new(
labels: labels,
labels:,
resource: Google::Api::MonitoredResource.new(
type: resource.type,
labels: resource.labels.to_h
Expand Down Expand Up @@ -876,9 +876,9 @@ def construct_log_entry_in_rest_format(labels,
# Remove the labels if we didn't populate them with anything.
resource.labels = nil if resource.labels.empty?
Google::Apis::LoggingV2::LogEntry.new(
labels: labels,
resource: resource,
severity: severity,
labels:,
resource:,
severity:,
timestamp: {
seconds: ts_secs,
nanos: ts_nanos
Expand All @@ -893,8 +893,8 @@ def write_request_via_grpc(entries:,
client = api_client
entries_count = entries.length
client.write_log_entries(
entries: entries,
log_name: log_name,
entries:,
log_name:,
# Leave resource nil if it's nil.
resource: if resource
Google::Api::MonitoredResource.new(
Expand Down Expand Up @@ -1026,10 +1026,10 @@ def write_request_via_rest(entries:,
entries_count = entries.length
client.write_entry_log_entries(
Google::Apis::LoggingV2::WriteLogEntriesRequest.new(
entries: entries,
log_name: log_name,
resource: resource,
labels: labels,
entries:,
log_name:,
resource:,
labels:,
partial_success: true
),
options: { api_format_version: '2' }
Expand Down Expand Up @@ -1657,13 +1657,13 @@ def parse_latency(latency)
nanos = (match['decimal'].to_f * 1000 * 1000 * 1000).round
if @use_grpc
Google::Protobuf::Duration.new(
seconds: seconds,
nanos: nanos
seconds:,
nanos:
)
else
{
seconds: seconds,
nanos: nanos
seconds:,
nanos:
}.delete_if { |_, v| v.zero? }
end
end
Expand Down Expand Up @@ -2125,7 +2125,7 @@ def monitored_resource_from_local_resource_id(local_resource_id)
end
constructed_resource = Google::Apis::LoggingV2::MonitoredResource.new(
type: resource_type,
labels: labels
labels:
)
@log.debug("Constructed #{resource_type} resource locally: " \
"#{constructed_resource.inspect}")
Expand Down Expand Up @@ -2157,7 +2157,7 @@ def increment_failed_requests_count(code)
return unless @failed_requests_count

@failed_requests_count.increment(
labels: { grpc: @use_grpc, code: code }
labels: { grpc: @use_grpc, code: }
)
end

Expand All @@ -2177,7 +2177,7 @@ def increment_dropped_entries_count(count, code)
return unless @dropped_entries_count

@dropped_entries_count.increment(
labels: { grpc: @use_grpc, code: code }, by: count
labels: { grpc: @use_grpc, code: }, by: count
)
end

Expand All @@ -2187,7 +2187,7 @@ def increment_retried_entries_count(count, code)
return unless @retried_entries_count

@retried_entries_count.increment(
labels: { grpc: @use_grpc, code: code }, by: count
labels: { grpc: @use_grpc, code: }, by: count
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fluent/plugin/statusz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def response(plugin)
minutes: (uptime / 60) % 60,
seconds: uptime % 60)
ERB.new(STATUSZ_TMPL).result_with_hash(
plugin: plugin,
uptime_str: uptime_str
plugin:,
uptime_str:
)
end
end
Expand Down
22 changes: 11 additions & 11 deletions test/plugin/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ def test_metrics
retried_entries_count,
'agent.googleapis.com/agent',
OpenCensus::Stats::Aggregation::Sum, d,
grpc: use_grpc, code: code)
grpc: use_grpc, code:)
# Skip failure assertions when code indicates success, because the
# assertion will fail in the case when a single metric contains time
# series with success and failure events.
Expand All @@ -2120,12 +2120,12 @@ def test_metrics
failed_requests_count,
'agent.googleapis.com/agent',
OpenCensus::Stats::Aggregation::Sum, d,
grpc: use_grpc, code: code)
grpc: use_grpc, code:)
assert_metric_value.call(:stackdriver_dropped_entries_count,
dropped_entries_count,
'agent.googleapis.com/agent',
OpenCensus::Stats::Aggregation::Sum, d,
grpc: use_grpc, code: code)
grpc: use_grpc, code:)
end
end
end
Expand All @@ -2152,15 +2152,15 @@ def container_log_entry_with_metadata(
log, container_name = K8S_CONTAINER_NAME
)
{
log: log,
log:,
stream: K8S_STREAM,
time: K8S_TIMESTAMP,
kubernetes: {
namespace_id: CONTAINER_NAMESPACE_ID,
namespace_name: K8S_NAMESPACE_NAME,
pod_id: CONTAINER_POD_ID,
pod_name: K8S_POD_NAME,
container_name: container_name,
container_name:,
labels: {
CONTAINER_LABEL_KEY => CONTAINER_LABEL_VALUE
}
Expand All @@ -2170,16 +2170,16 @@ def container_log_entry_with_metadata(

def container_log_entry(log, stream = K8S_STREAM)
{
log: log,
stream: stream,
log:,
stream:,
time: K8S_TIMESTAMP
}
end

def k8s_container_log_entry(log,
local_resource_id: K8S_LOCAL_RESOURCE_ID)
{
log: log,
log:,
stream: K8S_STREAM,
time: K8S_TIMESTAMP,
LOCAL_RESOURCE_ID_KEY => local_resource_id
Expand All @@ -2188,7 +2188,7 @@ def k8s_container_log_entry(log,

def k8s_pod_log_entry(log)
{
log: log,
log:,
stream: K8S_STREAM,
time: K8S_TIMESTAMP,
LOCAL_RESOURCE_ID_KEY =>
Expand All @@ -2200,7 +2200,7 @@ def k8s_pod_log_entry(log)

def k8s_node_log_entry(log)
{
log: log,
log:,
stream: K8S_STREAM,
time: K8S_TIMESTAMP,
LOCAL_RESOURCE_ID_KEY =>
Expand All @@ -2219,7 +2219,7 @@ def dataflow_log_entry(index)
def dataproc_log_entry(message, source_class = 'com.example.Example',
filename = 'test.log')
{
filename: filename,
filename:,
class: source_class,
message: log_entry(message)
}
Expand Down
10 changes: 5 additions & 5 deletions test/plugin/test_out_google_cloud_grpc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,11 @@ def write_log_entries(entries:,
labels: nil,
partial_success: nil)
request = Google::Apis::LoggingV2::WriteLogEntriesRequest.new(
log_name: log_name,
resource: resource,
labels: labels,
entries: entries,
partial_success: partial_success
log_name:,
resource:,
labels:,
entries:,
partial_success:
)
@requests_received << request
WriteLogEntriesResponse.new
Expand Down