-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #356 from sap-contributions/add-config-flag-to-dis…
…able-prom_scraper Add config flag to disable prom_scraper
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
jobs/cloud_controller_ng/templates/prom_scraper_config.yml.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<% if p("cc.prom_scraper.disabled") != true -%> | ||
port: <%= p("cc.prom_metrics_server_tls_port") %> | ||
source_id: "cloud_controller_ng" | ||
instance_id: <%= spec.id || spec.index.to_s %> | ||
scheme: https | ||
server_name: <%= p("cc.internal_service_hostname") %> | ||
path: /internal/v4/metrics | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec' | ||
require 'bosh/template/test' | ||
|
||
module Bosh | ||
module Template | ||
module Test | ||
describe 'prom_scraper config template rendering' do | ||
let(:release_path) { File.join(File.dirname(__FILE__), '../..') } | ||
let(:release) { ReleaseDir.new(release_path) } | ||
let(:job) { release.job('cloud_controller_ng') } | ||
|
||
describe 'prom_scraper_config.yml' do | ||
let(:template) { job.template('config/prom_scraper_config.yml') } | ||
let(:manifest_properties) { {} } | ||
|
||
before do | ||
@rendered_file = template.render(manifest_properties, consumes: {}) | ||
end | ||
|
||
it 'renders default values' do | ||
expect(@rendered_file).to include('port: 9025') | ||
end | ||
|
||
context 'when prom_scraper is disabled' do | ||
let(:manifest_properties) { { 'cc' => { 'prom_scraper' => { 'disabled' => true } } } } | ||
|
||
it 'renders an empty file' do | ||
expect(@rendered_file).not_to include('port: 9025') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |