Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrometheusMetricsProvider is invalid #4154

Closed
jihwong opened this issue Dec 13, 2023 · 8 comments
Closed

PrometheusMetricsProvider is invalid #4154

jihwong opened this issue Dec 13, 2023 · 8 comments

Comments

@jihwong
Copy link

jihwong commented Dec 13, 2023

https://bookkeeper.apache.org/docs/reference/config/#statistics
The document indicates that PrometheusMetricsProvider is enabled by default. But it didn't start listening to port 8000.

root@ubuntu:~# ss -antpl
State        Recv-Q        Send-Q                Local Address:Port                Peer Address:Port                                                 
LISTEN       0             50                          0.0.0.0:41341                    0.0.0.0:*           users:(("java",pid=31958,fd=156))        
LISTEN       0             4096                        0.0.0.0:3181                     0.0.0.0:*           users:(("java",pid=31958,fd=178))        
LISTEN       0             4096                        0.0.0.0:8080                     0.0.0.0:*           users:(("java",pid=31958,fd=207))  

I also tried to add PrometheusMetricsProvider configuration.
conf

  BK_enableStatistics: "true"
  BK_statsProviderClass: "org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider"
  BK_prometheusStatsHttpPort: "8000"
  BK_prometheusStatsHttpAddress: "0.0.0.0"

log

  "statsProviderClass" : "org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider",
  "prometheusStatsHttpPort" : "8000",
  "prometheusStatsHttpAddress" : "0.0.0.0",
@jihwong
Copy link
Author

jihwong commented Dec 13, 2023

image: apache/bookkeeper:4.16.2

@zwOvO
Copy link
Contributor

zwOvO commented Dec 13, 2023

The default configuration declared on the bookkeeper.apache.org website has been annotated and is invalid. You need to change the configuration

@zwOvO
Copy link
Contributor

zwOvO commented Dec 13, 2023

    public Class<? extends StatsProvider> getStatsProviderClass()
        throws ConfigurationException {
        return ReflectionUtils.getClass(this, STATS_PROVIDER_CLASS,
                                        NullStatsProvider.class, StatsProvider.class,
                                        DEFAULT_LOADER);
    }
    public static <T> Class<? extends T> getClass(Configuration conf,
                                                  String name, Class<? extends T> defaultValue,
                                                  Class<T> xface, ClassLoader classLoader)
        throws ConfigurationException
@SuppressFBWarnings("EI_EXPOSE_REP2")
public class NullStatsProvider implements StatsProvider {

    final StatsLogger nullStatsLogger = new NullStatsLogger();

    @Override
    public void start(Configuration conf) {
        // nop
    }

    @Override
    public void stop() {
        // nop
    }

    @Override
    public StatsLogger getStatsLogger(String scope) {
        return nullStatsLogger;
    }

}

@zwOvO
Copy link
Contributor

zwOvO commented Dec 13, 2023

@jihwong
Copy link
Author

jihwong commented Dec 14, 2023

The default configuration declared on the bookkeeper.apache.org website has been annotated and is invalid. You need to change the configuration

I changed the configuration and the log also printed out that the configuration was successfully loaded, but failed to listen to port 8000
image

root@ubuntu:~# ss -antpl
State        Recv-Q        Send-Q                Local Address:Port                Peer Address:Port                                                 
LISTEN       0             4096                        0.0.0.0:3181                     0.0.0.0:*           users:(("java",pid=13184,fd=178))        
LISTEN       0             4096                        0.0.0.0:8080                     0.0.0.0:*           users:(("java",pid=13184,fd=207))        
LISTEN       0             50                          0.0.0.0:42387                    0.0.0.0:*           users:(("java",pid=13184,fd=156))    

@zwOvO
Copy link
Contributor

zwOvO commented Dec 28, 2023

docker run -it
--name=bookie-issue-4154
--rm
--env BK_journalDirectory=/tmp/bk-data
--env BK_ledgerDirectories=/tmp/bk-data
--env BK_indexDirectories=/tmp/bk-data
--env BK_statsProviderClass=org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
--env BK_httpServerEnabled=true
--env BK_zkServers=192.168.124.222:2181
dockerproxy.com/apache/bookkeeper:4.16.2
/opt/bookkeeper/bin/bookkeeper bookie

image

@zwOvO
Copy link
Contributor

zwOvO commented Dec 28, 2023

2023-12-28T11:35:57,969 - INFO - [main:BookieServer@91] - {
"storage.cluster.controller.schedule.interval.ms" : "30000",
"statsProviderClass" : "org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider",
"zkLedgersRootPath" : "/ledgers",
"httpServerTrustStorePath" : "",
"httpServerPort" : "8080",
"httpServerHost" : "0.0.0.0",
"ledgerDirectories" : "/tmp/bk-data",
"zkTimeout" : "10000",
"httpServerClass" : "org.apache.bookkeeper.http.vertx.VertxHttpServer",
"metadataServiceUri" : "zk://192.168.124.222:2181/ledgers",
"dlog.bkcEnsembleSize" : "3",
"httpServerKeyStorePath" : "",
"gcEntryLogMetadataCacheEnabled" : "false",
"zkEnableSecurity" : "false",
"dlog.bkcAckQuorumSize" : "2",
"indexDirectories" : "/tmp/bk-data",
"zkServers" : "192.168.124.222:2181",
"storage.range.store.dirs" : "data/bookkeeper/ranges",
"dlog.bkcWriteQuorumSize" : "2",
"bookiePort" : "3181",
"storage.serve.readonly.tables" : "false",
"httpServerTlsEnable" : "false",
"httpServerEnabled" : "true",
"httpServerTrustStorePassword" : "",
"httpServerKeyStorePassword" : "",
"storageserver.grpc.port" : "4181",
"journalDirectory" : "/tmp/bk-data"
}

@jihwong
Copy link
Author

jihwong commented Jan 3, 2024

2023-12-28T11:35:57,969 - 信息 - [main:BookieServer@91] - {
“storage.cluster.controller.schedule.interval.ms”:“30000”,
“statsProviderClass”:“org.apache.bookkeeper。 stats.prometheus.PrometheusMetricsProvider”、
“zkLedgersRootPath”:“/ledgers”、
“httpServerTrustStorePath”:“”、
“httpServerPort”:“8080”、
“httpServerHost”:“0.0.0.0”、
“ledgerDirectories”:“/tmp/bk -data",
"zkTimeout": "10000",
"httpServerClass": "org.apache.bookkeeper.http.vertx.VertxHttpServer",
"metadataServiceUri": "zk://192.168.124.222:2181/ledgers",
"dlog .bkcEnsembleSize”:“3”、
“httpServerKeyStorePath”:“”、
“gcEntryLogMetadataCacheEnabled”:“假”、
“zkEnableSecurity”:“假”、
“dlog.bkcAckQuorumSize”:“2”、
“indexDirectories”:“/tmp/bk -data”,
“zkServers”:“192.168.124.222:2181”,“storage.range.store.dirs ”


数据/bookkeeper/ranges”,“dlog.bkcWriteQuorumSize”:“2”,“bookiePort”:“3181 ”、
“storage.serve.readonly.tables”:“假”、
“httpServerTlsEnable”:“假”、
“httpServerEnabled”:“真”、
“httpServerTrustStorePassword”:“”、
“httpServerKeyStorePassword”:“”、
“storageserver.grpc” .port”:“4181”,
“journalDirectory”:“/tmp/bk-data”
}

Thank you very much. I can now obtain the metrics information.
PrometheusStatsHttpPort and PrometheusStatsHttpAddress are invalid configurations.
https://bookkeeper.apache.org/docs/reference/config#prometheus-metrics-provider-settings

@jihwong jihwong closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants