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

Add supervisory_authority plugin #754

Merged
merged 4 commits into from
Aug 29, 2019
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
47 changes: 47 additions & 0 deletions manifests/plugin/supervisory_authority.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# == Class: Foreman supervisory_authority Plugin
#
# This class installs the supervisory_authority plugin and configuration file.
#
# === Parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to split this up into Parameters and Advanced Parameters? If not, I prefer the puppet-strings syntax since it's the officially supported one. However, RDoc has the feature of parameter groups which we do use in our installer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the "Advanced Parameters" section with all parameters which are optional.
The doc-block was taken from another plugin (memcache) to be consistent with whats already there.
I think we should rework the RDoc in all the Puppet files at once to not have different styles of documenting stuff.
What do you think?

#
# $server_url:: The URL for your APM Server. The URL must be fully qualified, including protocol (http or https) and port.
#
# $secret_token:: This string is used to ensure that only your agents can send data to your APM server.
#
# $service_name:: The name of your service. This is used to keep all the errors and transactions of your service together.
#
# === Advanced Parameters:
#
# $log_level:: Log severity level: 0 (debug), 1 (info), 2 (warn), 3 (error), 4 (fatal), 5 (unknown)
#
# $pool_size:: Size of Elastic APM thread pool to send its data to APM Server.
#
# $api_buffer_size:: Maximum amount of objects kept in queue, before sending to APM Server.
#
# $api_request_size:: Maximum amount of bytes sent over one request to APM Server.
#
# $api_request_time:: Maximum duration of a single streaming request to APM Server before opening a new one.
#
# $transaction_max_spans:: Limits the amount of spans that are recorded per transaction.
#
# $http_compression:: Defines if http compression is used to send data to APM Server.
#
# $metrics_interval:: Specify the interval for reporting metrics to APM Server.
#
class foreman::plugin::supervisory_authority (
Stdlib::HTTPUrl $server_url,
String $secret_token,
Pattern[/^[a-zA-Z0-9 _-]+$/] $service_name,
Integer[0,5] $log_level = 1,
Integer[0] $pool_size = 1,
Integer[0] $api_buffer_size = 256,
String $api_request_size = '750kb',
String $api_request_time = '10s',
Integer[0] $transaction_max_spans = 500,
Boolean $http_compression = false,
String $metrics_interval = '30s',
) {
foreman::plugin { 'supervisory_authority':
config => template('foreman/foreman_supervisory_authority.yaml.erb'),
}
}
12 changes: 12 additions & 0 deletions spec/classes/plugin/supervisory_authority_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe 'foreman::plugin::supervisory_authority' do
let(:params) do
{
'server_url' => 'https://example.com',
'secret_token' => 'secret_example',
'service_name' => 'foreman prod',
}
end
include_examples 'basic foreman plugin tests', 'supervisory_authority'
end
12 changes: 12 additions & 0 deletions templates/foreman_supervisory_authority.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:foreman_supervisory_authority:
server_url: <%= @server_url %>
secret_token: '<%= @secret_token %>'
service_name: '<%= @service_name %>'
log_level: <%= @log_level %>
pool_size: <%= @pool_size %>
api_buffer_size: <%= @api_buffer_size %>
api_request_size: '<%= @api_request_size %>'
api_request_time: '<%= @api_request_time %>'
transaction_max_spans: <%= @transaction_max_spans %>
http_compression: <%= @http_compression ? 'true' : 'false' %>
metrics_interval: '<%= @metrics_interval %>'