Navigation Menu

Skip to content

Commit

Permalink
[cassandra, mysql] Add support for max_returned_metrics and dbm optio…
Browse files Browse the repository at this point in the history
…ns (#751)

* Add database monitoring flag to config

* tagging fix for yaml

* correcting cassandra test

Co-authored-by: Gergo Rozsa <gergo.rozsa@goto.com>
  • Loading branch information
rgergo and Gergo Rozsa committed Oct 13, 2022
1 parent a9fc9e5 commit 0752342
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
13 changes: 8 additions & 5 deletions manifests/integrations/cassandra.pp
Expand Up @@ -14,6 +14,8 @@
# The password for the datadog user
# $tags
# Optional array of tags
# $max_returned_metrics
# Optional number of maximum returned metrics, default 350
#
# Sample Usage:
#
Expand All @@ -26,11 +28,12 @@
#
#
class datadog_agent::integrations::cassandra(
String $host = 'localhost',
Integer $port = 7199,
Optional[String] $user = undef,
Optional[String] $password = undef,
Optional[Hash] $tags = {},
String $host = 'localhost',
Integer $port = 7199,
Optional[String] $user = undef,
Optional[String] $password = undef,
Optional[Hash] $tags = {},
Optional[Integer] $max_returned_metrics = undef,
) inherits datadog_agent::params {
require ::datadog_agent

Expand Down
5 changes: 5 additions & 0 deletions manifests/integrations/mysql.pp
Expand Up @@ -27,6 +27,8 @@
# schema size metrics
# $disable_innodb_metrics
# disable innodb metrics, used with older versions of MySQL without innodb engine support.
# $dbm
# Database Monitoring for Application Performance Monitoring (APM)
# $queries
# Custom metrics based on MySQL query
# Sample Usage:
Expand All @@ -51,6 +53,7 @@
# extra_performance_metrics => 'true',
# schema_size_metrics => 'true',
# disable_innodb_metrics => 'false',
# dbm => 'false',
# queries => [
# {
# query => 'SELECT TIMESTAMPDIFF(second,MAX(create_time),NOW()) as last_accessed FROM requests',
Expand All @@ -77,6 +80,7 @@
Boolean $extra_performance_metrics = false,
Boolean $schema_size_metrics = false,
Boolean $disable_innodb_metrics = false,
Optional[Boolean] $dbm = undef,
Optional[Array] $queries = [],
Optional[Array] $instances = undef,
Optional[Array] $logs = [],
Expand All @@ -103,6 +107,7 @@
'extra_performance_metrics' => $extra_performance_metrics,
'schema_size_metrics' => $schema_size_metrics,
'disable_innodb_metrics' => $disable_innodb_metrics,
'dbm' => $dbm,
'queries' => $queries,
}]
} elsif !$instances{
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/datadog_agent_integrations_cassandra_spec.rb
Expand Up @@ -65,7 +65,7 @@
}
end

it { is_expected.to contain_file(conf_file).with_content(%r{tags:\s+foo: bar\s+baz: ama\s*?[^-]}m) }
it { is_expected.to contain_file(conf_file).with_content(%r{tags:\s+-\s+foo:bar\s+-\s+baz:ama\s*?[^-]}m) }
end

context 'tags not hash' do
Expand Down
5 changes: 4 additions & 1 deletion templates/agent-conf.d/cassandra.yaml.erb
Expand Up @@ -11,9 +11,12 @@ instances:
<% if @tags.length > 0 -%>
tags:
<%- @tags.each do |tag_name, tag_value| -%>
<%= tag_name %>: <%= tag_value %>
- <%= tag_name %>:<%= tag_value %>
<% end -%>
<% end -%>
<% if @max_returned_metrics -%>
max_returned_metrics: <%= @max_returned_metrics %>
<% end -%>

init_config:

Expand Down
3 changes: 3 additions & 0 deletions templates/agent-conf.d/mysql.yaml.erb
Expand Up @@ -21,6 +21,9 @@ instances:
<% if instance['sock'] and instance['sock'] != :undef -%>
sock: <%= instance['sock'] %>
<% end -%>
<% if instance['dbm'] and instance['dbm'] != :undef -%>
dbm: <%= instance['dbm'] %>
<% end -%>
<% if instance['tags'] and ! instance['tags'].empty? -%>
tags:
Expand Down

0 comments on commit 0752342

Please sign in to comment.