lordgamez commented on code in PR #1587:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1587#discussion_r1263846980
##########
extensions/prometheus/PrometheusExposerWrapper.cpp:
##########
@@ -20,9 +20,27 @@
namespace org::apache::nifi::minifi::extensions::prometheus {
-PrometheusExposerWrapper::PrometheusExposerWrapper(uint32_t port)
- : exposer_(std::to_string(port)) {
- logger_->log_info("Started Prometheus metrics publisher on port %" PRIu32,
port);
+PrometheusExposerWrapper::PrometheusExposerWrapper(const
PrometheusExposerConfig& config)
+ : exposer_(parseExposerConfig(config)) {
+ logger_->log_info("Started Prometheus metrics publisher on port %" PRIu32,
config.port);
Review Comment:
Updated in 45f72a651e07636f89cb177f8536a78cf3fe67d3
##########
docker/test/integration/cluster/containers/PrometheusContainer.py:
##########
@@ -16,13 +16,53 @@
import os
import tempfile
import docker.types
+
from .Container import Container
+from OpenSSL import crypto
+from ssl_utils.SSL_cert_utils import make_cert_without_extended_usage
class PrometheusContainer(Container):
- def __init__(self, feature_context, name, vols, network, image_store,
command=None):
- super().__init__(feature_context, name, 'prometheus', vols, network,
image_store, command)
- prometheus_yml_content = """
+ def __init__(self, feature_context, name, vols, network, image_store,
command=None, ssl=False):
+ engine = "prometheus-ssl" if ssl else "prometheus"
+ super().__init__(feature_context, name, engine, vols, network,
image_store, command)
+ self.ssl = ssl
+ if ssl:
+ prometheus_cert, prometheus_key =
make_cert_without_extended_usage(f"prometheus-{feature_context.id}",
feature_context.root_ca_cert, feature_context.root_ca_key)
+
+ self.root_ca_file = tempfile.NamedTemporaryFile(delete=False)
+
self.root_ca_file.write(crypto.dump_certificate(type=crypto.FILETYPE_PEM,
cert=feature_context.root_ca_cert))
+ self.root_ca_file.close()
+ os.chmod(self.root_ca_file.name, 0o644)
+
+ self.prometheus_cert_file =
tempfile.NamedTemporaryFile(delete=False)
+
self.prometheus_cert_file.write(crypto.dump_certificate(type=crypto.FILETYPE_PEM,
cert=prometheus_cert))
+ self.prometheus_cert_file.close()
+ os.chmod(self.prometheus_cert_file.name, 0o644)
+
+ self.prometheus_key_file =
tempfile.NamedTemporaryFile(delete=False)
+
self.prometheus_key_file.write(crypto.dump_privatekey(type=crypto.FILETYPE_PEM,
pkey=prometheus_key))
+ self.prometheus_key_file.close()
+ os.chmod(self.prometheus_key_file.name, 0o644)
+
+ prometheus_yml_content = """
+global:
+ scrape_interval: 2s
+ evaluation_interval: 15s
+scrape_configs:
+ - job_name: "minifi"
+ static_configs:
+ - targets: ["minifi-cpp-flow-{feature_id}:9936"]
+ scheme: https
+ tls_config:
+ ca_file: /etc/prometheus/certs/root-ca.pem
+""".format(feature_id=self.feature_context.id)
+ self.yaml_file = tempfile.NamedTemporaryFile(delete=False)
+ self.yaml_file.write(prometheus_yml_content.encode())
+ self.yaml_file.close()
+ os.chmod(self.yaml_file.name, 0o644)
+ else:
+ prometheus_yml_content = """
Review Comment:
Updated in 45f72a651e07636f89cb177f8536a78cf3fe67d3
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]