func()

in pkg/controller/sync/sync.go [274:308]


func (s impl) observeSslCertificateCreationLatency(ctx context.Context, sslCertificateName string,
	id types.Id, managedCertificate v1.ManagedCertificate) error {

	entry, err := s.state.Get(id)
	if err != nil {
		return err
	}

	if entry.ExcludedFromSLO {
		klog.Infof(`Skipping reporting SslCertificate creation metric,
			because %s is marked as excluded from SLO calculations.`, id.String())

		return nil
	}

	if entry.SslCertificateCreationReported {
		klog.Infof(`Skipping reporting SslCertificate creation metric,
			already reported for %s.`, id.String())

		return nil
	}

	creationTime, err := time.Parse(time.RFC3339,
		managedCertificate.CreationTimestamp.Format(time.RFC3339))
	if err != nil {
		return err
	}

	s.metrics.ObserveSslCertificateCreationLatency(creationTime)
	if err := s.state.SetSslCertificateCreationReported(ctx, id); err != nil {
		return err
	}

	return nil
}