Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cassandra, mysql] Add support for max_returned_metrics and dbm options #751

Merged
merged 3 commits into from
Oct 13, 2022
Merged
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
13 changes: 8 additions & 5 deletions manifests/integrations/cassandra.pp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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