Rename collector to external RPS

Signed-off-by: Lucas Thiesen <lucas.thiesen@zalando.de>
This commit is contained in:
Lucas Thiesen
2023-05-23 15:40:56 +02:00
parent a276b64576
commit b89ca19e6a
3 changed files with 41 additions and 41 deletions

View File

@ -65,7 +65,7 @@ func NewCommandStartAdapterServer(stopCh <-chan struct{}) *cobra.Command {
MetricsAddress: ":7979",
ZMONTokenName: "zmon",
CredentialsDir: "/meta/credentials",
HostnameRPSMetricName: "skipper_serve_host_duration_seconds_count",
ExternalRPSMetricName: "skipper_serve_host_duration_seconds_count",
}
cmd := &cobra.Command{
@ -133,9 +133,9 @@ func NewCommandStartAdapterServer(stopCh <-chan struct{}) *cobra.Command {
flags.DurationVar(&o.DefaultScheduledScalingWindow, "scaling-schedule-default-scaling-window", 10*time.Minute, "Default rampup and rampdown window duration for ScalingSchedules")
flags.IntVar(&o.RampSteps, "scaling-schedule-ramp-steps", 10, "Number of steps used to rampup and rampdown ScalingSchedules. It's used to guarantee won't avoid reaching the max scaling due to the 10% minimum change rule.")
flags.StringVar(&o.DefaultTimeZone, "scaling-schedule-default-time-zone", "Europe/Berlin", "Default time zone to use for ScalingSchedules.")
flags.StringVar(&o.HostnameRPSMetricName, "hostname-rps-metric-name", o.HostnameRPSMetricName, ""+
flags.StringVar(&o.ExternalRPSMetricName, "hostname-rps-metric-name", o.ExternalRPSMetricName, ""+
"The name of the metric that should be used to query prometheus for RPS per hostname.")
flags.BoolVar(&o.HostnameRPSMetrics, "hostname-rps-metrics", o.HostnameRPSMetrics, ""+
flags.BoolVar(&o.ExternalRPSMetrics, "hostname-rps-metrics", o.ExternalRPSMetrics, ""+
"whether to enable hostname RPS metric collector or not")
return cmd
}
@ -224,13 +224,13 @@ func (o AdapterServerOptions) RunCustomMetricsAdapterServer(stopCh <-chan struct
}
}
// Hostname collector, like skipper's, depends on prometheus being enabled.
// External RPS collector, like skipper's, depends on prometheus being enabled.
// Also, to enable hostname metric its necessary to pass the metric name that
// will be used. This was built this way so we can support hostname metrics to
// any ingress provider, e.g. Skipper, Nginx, envoy etc, in a simple way.
if o.HostnameRPSMetrics && o.HostnameRPSMetricName != "" {
hostnamePlugin, err := collector.NewHostnameCollectorPlugin(promPlugin, o.HostnameRPSMetricName)
collectorFactory.RegisterExternalCollector([]string{collector.HostnameMetricType}, hostnamePlugin)
if o.ExternalRPSMetrics && o.ExternalRPSMetricName != "" {
externalRPSPlugin, err := collector.NewExternalRPSCollectorPlugin(promPlugin, o.ExternalRPSMetricName)
collectorFactory.RegisterExternalCollector([]string{collector.ExternalRPSMetricType}, externalRPSPlugin)
if err != nil {
return fmt.Errorf("failed to register hostname collector plugin: %v", err)
}
@ -462,8 +462,8 @@ type AdapterServerOptions struct {
RampSteps int
// Default time zone to use for ScalingSchedules.
DefaultTimeZone string
// Feature flag to enable hostname rps metric collector
HostnameRPSMetrics bool
// Name of the Prometheus metric that stores RPS by hostname for Hostname RPS metrics.
HostnameRPSMetricName string
// Feature flag to enable external rps metric collector
ExternalRPSMetrics bool
// Name of the Prometheus metric that stores RPS by hostname for external RPS metrics.
ExternalRPSMetricName string
}