Skip to content

Commit

Permalink
pkg/ansible,helm: Update metrics function
Browse files Browse the repository at this point in the history
  • Loading branch information
lilic committed Jun 14, 2019
1 parent a6bfb37 commit c9be3f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pkg/ansible/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ func Run(flags *aoflags.AnsibleOperatorFlags) error {
return err
}

metricsService := []metrics.MetricService{
{Port: 8383, PortName: metrics.OperatorPortName},
}
// TODO: probably should expose the port as an environment variable
_, err = metrics.ExposeMetricsPort(context.TODO(), 8383)
_, err = metrics.CreateMetricsService(context.TODO(), metricsService)
if err != nil {
log.Error(err, "Exposing metrics port failed.")
return err
Expand Down
8 changes: 6 additions & 2 deletions pkg/helm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ func Run(flags *hoflags.HelmOperatorFlags) error {
return err
}

// Create Service object to expose the metrics port.
_, err = metrics.ExposeMetricsPort(ctx, metricsPort)
// Add to the below struct any other metrics ports you want to expose.
metricsService := []metrics.MetricService{
{Port: metricsPort, PortName: metrics.OperatorPortName},
}
// Create Service object to expose the metrics port(s).
_, err = metrics.CreateMetricsService(ctx, metricsService)
if err != nil {
log.Info(err.Error())
}
Expand Down

0 comments on commit c9be3f2

Please sign in to comment.