Skip to content

Commit

Permalink
move common datadog config for services
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathBorn committed May 13, 2020
1 parent ea092cc commit 56f8b60
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 30 deletions.
6 changes: 6 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
default['vitess']['version']['vtctl'] = 'v6.0-9fe7fd3'
default['vitess']['version']['vtexplain'] = 'v6.0-9fe7fd3'
default['vitess']['version']['vtbench'] = 'v6.0-9fe7fd3'

# host to send spans to. if empty, no tracing will be done
default['vitess']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['datadog-agent-port'] = nil
6 changes: 0 additions & 6 deletions attributes/mysqlctld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
# write cpu profile to file
default['vitess']['mysqlctld']['cpu_profile'] = nil

# host to send spans to. if empty, no tracing will be done
default['vitess']['mysqlctld']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['mysqlctld']['datadog-agent-port'] = nil

# deprecated: use db_charset (default "utf8")
default['vitess']['mysqlctld']['db-config-dba-charset'] = 'utf8'

Expand Down
6 changes: 0 additions & 6 deletions attributes/vtctld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
# write cpu profile to file
default['vitess']['vtctld']['cpu_profile'] = nil

# host to send spans to. if empty, no tracing will be done
default['vitess']['vtctld']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['vtctld']['datadog-agent-port'] = nil

# db credentials file; send SIGHUP to reload this file
default['vitess']['vtctld']['db-credentials-file'] = nil

Expand Down
6 changes: 0 additions & 6 deletions attributes/vtgate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
# write cpu profile to file
default['vitess']['vtgate']['cpu_profile'] = nil

# host to send spans to. if empty, no tracing will be done
default['vitess']['vtgate']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['vtgate']['datadog-agent-port'] = nil

# The default tablet type to set for queries, when one is not explicitly selected (default MASTER)
default['vitess']['vtgate']['default_tablet_type'] = 'MASTER'

Expand Down
6 changes: 0 additions & 6 deletions attributes/vttablet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@
# write cpu profile to file
default['vitess']['vttablet']['cpu_profile'] = nil

# host to send spans to. if empty, no tracing will be done
default['vitess']['vttablet']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['vttablet']['datadog-agent-port'] = nil

# deprecated: use db_charset (default "utf8")
default['vitess']['vttablet']['db-config-allprivs-charset'] = 'utf8'

Expand Down
6 changes: 0 additions & 6 deletions attributes/vtworker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
# write cpu profile to file
default['vitess']['vtworker']['cpu_profile'] = nil

# host to send spans to. if empty, no tracing will be done
default['vitess']['vtworker']['datadog-agent-host'] = nil

# port to send spans to. if empty, no tracing will be done
default['vitess']['vtworker']['datadog-agent-port'] = nil

# db credentials file; send SIGHUP to reload this file
default['vitess']['vtworker']['db-credentials-file'] = nil

Expand Down
12 changes: 12 additions & 0 deletions libraries/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ class VitessBaseService < Chef::Resource
kind_of: String,
default: lazy { node['vitess']['topo_implementation'] }
)
attribute(
:datadog_agent_host,
kind_of: String,
default: lazy { node['vitess']['datadog-agent-host'] }
)
attribute(
:datadog_agent_port,
kind_of: String,
default: lazy { node['vitess']['datadog-agent-port'] }
)

attribute(:vtroot, kind_of: String, default: '/var/lib/vt')
attribute(:vtdataroot, kind_of: String, default: '/var/lib/vtdataroot')
Expand Down Expand Up @@ -88,6 +98,8 @@ def additional_args
'topo_global_server_address' => new_resource.topo_global_server_address,
'topo_implementation' => new_resource.topo_implementation,
}
args['datadog-agent-host'] = new_resource.datadog_agent_host if !new_resource.datadog_agent_host.nil?
args['datadog-agent-port'] = new_resource.datadog_agent_port if !new_resource.datadog_agent_port.nil?
args['log_dir'] = service_log_dir if new_resource.args['log_dir'].nil?
args
end
Expand Down

0 comments on commit 56f8b60

Please sign in to comment.