mirror of https://github.com/status-im/consul.git
OSS merge: Update error handling login when applying extensions (#17740)
This commit is contained in:
parent
fa40654885
commit
9289e680d6
|
@ -492,6 +492,7 @@ func applyEnvoyExtension(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot,
|
||||||
extender, err := envoyextensions.ConstructExtension(ext)
|
extender, err := envoyextensions.ConstructExtension(ext)
|
||||||
metrics.MeasureSinceWithLabels([]string{"envoy_extension", "validate_arguments"}, now, getMetricLabels(err))
|
metrics.MeasureSinceWithLabels([]string{"envoy_extension", "validate_arguments"}, now, getMetricLabels(err))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
errorParams = append(errorParams, "error", err)
|
||||||
logFn("failed to construct extension", errorParams...)
|
logFn("failed to construct extension", errorParams...)
|
||||||
|
|
||||||
if ext.Required {
|
if ext.Required {
|
||||||
|
@ -507,6 +508,7 @@ func applyEnvoyExtension(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorParams = append(errorParams, "error", err)
|
errorParams = append(errorParams, "error", err)
|
||||||
logFn("failed to validate extension arguments", errorParams...)
|
logFn("failed to validate extension arguments", errorParams...)
|
||||||
|
|
||||||
if ext.Required {
|
if ext.Required {
|
||||||
return status.Errorf(codes.InvalidArgument, "failed to validate arguments for extension %q for service %q", ext.Name, svc.Name)
|
return status.Errorf(codes.InvalidArgument, "failed to validate arguments for extension %q for service %q", ext.Name, svc.Name)
|
||||||
}
|
}
|
||||||
|
@ -517,9 +519,13 @@ func applyEnvoyExtension(logger hclog.Logger, cfgSnap *proxycfg.ConfigSnapshot,
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
_, err = extender.Extend(resources, &runtimeConfig)
|
_, err = extender.Extend(resources, &runtimeConfig)
|
||||||
metrics.MeasureSinceWithLabels([]string{"envoy_extension", "extend"}, now, getMetricLabels(err))
|
metrics.MeasureSinceWithLabels([]string{"envoy_extension", "extend"}, now, getMetricLabels(err))
|
||||||
logFn("failed to apply envoy extension", errorParams...)
|
if err != nil {
|
||||||
if err != nil && ext.Required {
|
errorParams = append(errorParams, "error", err)
|
||||||
return status.Errorf(codes.InvalidArgument, "failed to patch xDS resources in the %q extension: %v", ext.Name, err)
|
logFn("failed to apply envoy extension", errorParams...)
|
||||||
|
|
||||||
|
if ext.Required {
|
||||||
|
return status.Errorf(codes.InvalidArgument, "failed to patch xDS resources in the %q extension: %v", ext.Name, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue