sijie closed pull request #2735: Collect metrics on number of logs lines printed URL: https://github.com/apache/pulsar/pull/2735
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/conf/log4j2.yaml b/conf/log4j2.yaml index 45ed5d9940..2ecfd19293 100644 --- a/conf/log4j2.yaml +++ b/conf/log4j2.yaml @@ -22,6 +22,7 @@ Configuration: status: INFO monitorInterval: 30 name: pulsar + packages: io.prometheus.client.log4j2 Properties: Property: @@ -43,7 +44,7 @@ Configuration: language: JavaScript path: ./conf/log4j2-scripts/filter.js charset: UTF-8 - + Appenders: # Console @@ -81,6 +82,9 @@ Configuration: IfLastModified: age: 30d + Prometheus: + name: Prometheus + # Routing Routing: name: RoutingAppender @@ -129,10 +133,12 @@ Configuration: # Default root logger configuration Root: level: info - additivity: false + additivity: true AppenderRef: - ref: "${sys:pulsar.log.appender}" level: "${sys:pulsar.log.level}" + - ref: Prometheus + level: info Logger: - name: org.apache.bookkeeper.bookie.BookieShell @@ -146,7 +152,7 @@ Configuration: additivity: false AppenderRef: - ref: Console - + # Logger to inject filter script # - name: org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl # level: debug @@ -158,4 +164,4 @@ Configuration: # onMisMatch: DENY # ScriptRef: # ref: filter.js - + diff --git a/distribution/server/pom.xml b/distribution/server/pom.xml index 6a16d62084..72af9a2d23 100644 --- a/distribution/server/pom.xml +++ b/distribution/server/pom.xml @@ -99,6 +99,11 @@ <artifactId>prometheus-metrics-provider</artifactId> </dependency> + <dependency> + <groupId>io.prometheus</groupId> + <artifactId>simpleclient_log4j2</artifactId> + </dependency> + <dependency> <groupId>${project.groupId}</groupId> <artifactId>pulsar-zookeeper</artifactId> diff --git a/distribution/server/src/assemble/LICENSE.bin.txt b/distribution/server/src/assemble/LICENSE.bin.txt index 66a05762a4..970808cd2b 100644 --- a/distribution/server/src/assemble/LICENSE.bin.txt +++ b/distribution/server/src/assemble/LICENSE.bin.txt @@ -357,6 +357,7 @@ The Apache Software License, Version 2.0 - io.prometheus-simpleclient_common-0.0.23.jar - io.prometheus-simpleclient_hotspot-0.0.23.jar - io.prometheus-simpleclient_servlet-0.0.23.jar + - io.prometheus-simpleclient_log4j2-0.0.23.jar * Bean Validation API -- javax.validation-validation-api-1.1.0.Final.jar * Log4J - log4j-log4j-1.2.17.jar diff --git a/pom.xml b/pom.xml index ff78b65be0..90818d44f0 100644 --- a/pom.xml +++ b/pom.xml @@ -674,6 +674,12 @@ flexible messaging model and an intuitive client API.</description> <version>${prometheus.version}</version> </dependency> + <dependency> + <groupId>io.prometheus</groupId> + <artifactId>simpleclient_log4j2</artifactId> + <version>${prometheus.version}</version> + </dependency> + <dependency> <groupId>io.prometheus</groupId> <artifactId>simpleclient_servlet</artifactId> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services