Skip to content

Commit

Permalink
Enable global port listening
Browse files Browse the repository at this point in the history
  • Loading branch information
jbooherl committed Feb 28, 2024
1 parent 5d2fa34 commit 24d217b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions jobs/otel-collector-windows/spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ properties:
enabled:
description: "Enable OTel Collector"
default: true
ingress.grpc.internal_only:
description: "Only allow listening on local VM to receive OTLP over gRPC"
default: true
ingress.grpc.port:
description: "Port the collector is listening on to receive OTLP over gRPC"
default: 9100
Expand Down
4 changes: 3 additions & 1 deletion jobs/otel-collector-windows/templates/config.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ if metric_exporters.keys.any?{|k| k.include?('/cf-internal')}
raise 'Metric exporters cannot be defined under cf-internal namespace'
end

local_listening = p('ingress.grpc.local_only')

config = {
"receivers"=> {
"otlp"=>{
"protocols"=>{
"grpc"=>{
"endpoint"=>"127.0.0.1:#{p('ingress.grpc.port')}",
"endpoint"=>local_listening ? "127.0.0.1:#{p('ingress.grpc.port')}" : ":#{p('ingress.grpc.port')}",
"tls"=>{
"client_ca_file"=>"/var/vcap/jobs/otel-collector-windows/config/certs/otel-collector-ca.crt",
"cert_file"=>"/var/vcap/jobs/otel-collector-windows/config/certs/otel-collector.crt",
Expand Down
3 changes: 3 additions & 0 deletions jobs/otel-collector/spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ properties:
enabled:
description: "Enable OTel Collector"
default: true
ingress.grpc.local_only:
description: "Allow only local VM listening to receive OTLP over gRPC"
default: true
ingress.grpc.port:
description: "Port the collector is listening on to receive OTLP over gRPC"
default: 9100
Expand Down
4 changes: 3 additions & 1 deletion jobs/otel-collector/templates/config.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ if metric_exporters.any?{|k, v| k.start_with?('prometheus') && v['endpoint'] &&
raise 'Cannot define prometheus exporter listening on port 8889 (reserved for BBS API port)'
end

local_listening = p('ingress.grpc.local_only')

config = {
"receivers"=> {
"otlp"=>{
"protocols"=>{
"grpc"=>{
"endpoint"=>"127.0.0.1:#{p('ingress.grpc.port')}",
"endpoint"=>local_listening ? "127.0.0.1:#{p('ingress.grpc.port')}" : ":#{p('ingress.grpc.port')}",
"tls"=>{
"client_ca_file"=>"/var/vcap/jobs/otel-collector/config/certs/otel-collector-ca.crt",
"cert_file"=>"/var/vcap/jobs/otel-collector/config/certs/otel-collector.crt",
Expand Down

0 comments on commit 24d217b

Please sign in to comment.