private static void registerCertMetrics(Meter meter, X509Certificate cert, String certType, String prefix) {
        String subject = cert.getSubjectX500Principal().getName();
        Date expiryDate = cert.getNotAfter();
        long daysRemaining = (expiryDate.getTime() - System.currentTimeMillis()) / (1000 * 3600 * 24);

        // Create and register Gauge metrics
        Attributes attributes = Attributes.builder()
                .put("cert_type", certType)
                .put("cert_subject", subject)
                .build();

        ObservableLongGauge observableCertExpireMills = meter.gaugeBuilder(prefix + "cert_expiry_timestamp")
                .setDescription("The expiry timestamp of the TLS certificate")
                .setUnit("milliseconds")
                .ofLongs()
                .buildWithCallback(result -> result.record(expiryDate.getTime(), attributes));
        CERT_OBSERVABLE_LONG_GAUGES.add(observableCertExpireMills);

        ObservableLongGauge observableCertExpireDays = meter.gaugeBuilder(prefix + "cert_days_remaining")
                .setDescription("The remaining days until the TLS certificate expires")
                .setUnit("days")
                .ofLongs()
                .buildWithCallback(result -> result.record(daysRemaining, attributes));
        CERT_OBSERVABLE_LONG_GAUGES.add(observableCertExpireDays);
    }
Register certificate metrics.

@param meter    The OpenTelemetry meter to use for creating metrics.
@param cert     The X509 certificate to register metrics for.
@param certType The type of the certificate (e.g., "server_cert", "truststore_cert").
@param prefix   The prefix for the metric names.
server-common/src/main/java/org/apache/kafka/server/metrics/s3stream/S3StreamKafkaMetricsManager.java