Skip to content

Commit

Permalink
Allow metric exporters to be provided as a string (#365)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Crump <[email protected]>
Co-authored-by: Carson Long <[email protected]>
  • Loading branch information
acrmp and ctlong authored Aug 16, 2023
1 parent b1c1005 commit 02b7b52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions jobs/otel-collector-windows/templates/config.yml.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<%=
if p('metric_exporters').keys.any?{|k| k.include?('/cf-internal')}
metric_exporters = p('metric_exporters')
unless metric_exporters.respond_to?(:keys)
metric_exporters = YAML::load(metric_exporters)
end
if metric_exporters.keys.any?{|k| k.include?('/cf-internal')}
raise 'Metric exporters cannot be defined under cf-internal namespace'
end

Expand All @@ -19,10 +23,10 @@ config = {
}
}
},
"exporters"=>p('metric_exporters'),
"exporters"=>metric_exporters,
"service"=>{
"telemetry"=>{"metrics"=>{"level"=>"none"}},
"pipelines"=>{"metrics"=>{"receivers"=>["otlp"], "exporters"=>p('metric_exporters').keys}}
"pipelines"=>{"metrics"=>{"receivers"=>["otlp"], "exporters"=>metric_exporters.keys}}
}
}

Expand Down
10 changes: 7 additions & 3 deletions jobs/otel-collector/templates/config.yml.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<%=
if p('metric_exporters').keys.any?{|k| k.include?('/cf-internal')}
metric_exporters = p('metric_exporters')
unless metric_exporters.respond_to?(:keys)
metric_exporters = YAML::load(metric_exporters)
end
if metric_exporters.keys.any?{|k| k.include?('/cf-internal')}
raise 'Metric exporters cannot be defined under cf-internal namespace'
end

Expand All @@ -19,10 +23,10 @@ config = {
}
}
},
"exporters"=>p('metric_exporters'),
"exporters"=>metric_exporters,
"service"=>{
"telemetry"=>{"metrics"=>{"level"=>"none"}},
"pipelines"=>{"metrics"=>{"receivers"=>["otlp"], "exporters"=>p('metric_exporters').keys}}
"pipelines"=>{"metrics"=>{"receivers"=>["otlp"], "exporters"=>metric_exporters.keys}}
}
}

Expand Down

0 comments on commit 02b7b52

Please sign in to comment.