获取非Spring Java应用程序的详细指标数据

huangapple go评论73阅读模式
英文:

Fetch detailed Metrics data of non-Spring Java application

问题

我正在使用 JMX 服务器 来获取在 Karaf 容器中运行的应用程序的指标数据。

使用的 JMX exporter 服务器:https://github.com/prometheus/jmx_exporter

我尝试使用示例的 Spring 应用程序,并使用 Micrometer 依赖项,指标日志非常详细,包含有关请求数量等数据。

但是,我的目标应用程序不是基于 Spring 的。[它运行在 Talend 上]

我收到的日志中没有显示应用程序接收到的 REST 请求数量等数据。

如何获取更多详细信息,例如请求数量等,需要采取哪些附加/替代措施?

英文:

I am using JMX Server, to fetch Metrics data of my application running at Karaf container.

JMX exporter server used: https://github.com/prometheus/jmx_exporter

I tried with Sample Spring application, using Micrometer dependency, the Metric logs were very detailed, bearing data about the number of requests, etc data.

But, my target application is not based on Spring. [It runs on Talend]

The logs I received over this, do not show any data about the number of REST requests received by the application.

What additional/alternative should I do, to fetch more details, like Number of requests, etc ?


Metrics logs received for my application:


# HELP jmx_config_reload_success_total Number of times configuration have successfully been reloaded.
# TYPE jmx_config_reload_success_total counter
jmx_config_reload_success_total 0.0
# HELP jmx_config_reload_failure_total Number of times configuration have failed to be reloaded.
# TYPE jmx_config_reload_failure_total counter
jmx_config_reload_failure_total 0.0
# HELP jmx_exporter_build_info A metric with a constant '1' value labeled with the version of the JMX exporter.
# TYPE jmx_exporter_build_info gauge
jmx_exporter_build_info{version="0.12.1-SNAPSHOT",name="jmx_prometheus_httpserver",} 1.0
# HELP org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_stopTimeout The stop timeout in milliseconds (org.ops4j.pax.web.service.jetty.internal<type=jettyserverwrapper, id=0><>stopTimeout)
# TYPE org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_stopTimeout untyped
org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_stopTimeout{id="0",} 30000.0
# HELP org_apache_karaf_instance_Instances_SSH_Port This type describes Karaf instance (org.apache.karaf<type=instance, name=trun, Name=trun><Instances>SSH Port)
# TYPE org_apache_karaf_instance_Instances_SSH_Port untyped
org_apache_karaf_instance_Instances_SSH_Port{name="trun",Name="trun",} 8101.0
# HELP jmx4perl_Config_Debug Attribute exposed for management (jmx4perl<type=Config><>Debug)
# TYPE jmx4perl_Config_Debug untyped
jmx4perl_Config_Debug 0.0
# HELP org_eclipse_jetty_server_session_hashsessionidmanager_stopTimeout The stop timeout in milliseconds (org.eclipse.jetty.server.session<type=hashsessionidmanager, id=0><>stopTimeout)
# TYPE org_eclipse_jetty_server_session_hashsessionidmanager_stopTimeout untyped
org_eclipse_jetty_server_session_hashsessionidmanager_stopTimeout{id="0",} 30000.0
# HELP org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_outputAggregationSize The maximum size in bytes for HTTP output to be aggregated (org.eclipse.jetty.server<context=SSL|HTTP/1.1@4ef474b6, type=httpconfiguration, id=0><>outputAggregationSize)
# TYPE org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_outputAggregationSize untyped
org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_outputAggregationSize{type="httpconfiguration",id="0",} 8192.0
# HELP java_lang_Threading_ThreadContentionMonitoringSupported ThreadContentionMonitoringSupported (java.lang<type=Threading><>ThreadContentionMonitoringSupported)
# TYPE java_lang_Threading_ThreadContentionMonitoringSupported untyped
java_lang_Threading_ThreadContentionMonitoringSupported 1.0
# HELP org_eclipse_jetty_server_HTTP_1_1_15470990_outputAggregationSize The maximum size in bytes for HTTP output to be aggregated (org.eclipse.jetty.server<context=HTTP/1.1@15470990, type=httpconfiguration, id=0><>outputAggregationSize)
# TYPE org_eclipse_jetty_server_HTTP_1_1_15470990_outputAggregationSize untyped
org_eclipse_jetty_server_HTTP_1_1_15470990_outputAggregationSize{type="httpconfiguration",id="0",} 8192.0
# HELP java_lang_Runtime_StartTime StartTime (java.lang<type=Runtime><>StartTime)
# TYPE java_lang_Runtime_StartTime untyped
java_lang_Runtime_StartTime 1.586172506622E12
# HELP org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptQueueSize Accept Queue size (org.eclipse.jetty.server<context=HTTP/1.1@137f82d0, type=serverconnector, id=0><>acceptQueueSize)
# TYPE org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptQueueSize untyped
org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptQueueSize{type="serverconnector",id="0",} 0.0
# HELP org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout The stop timeout in milliseconds (org.eclipse.jetty.io<context=HTTP/1.1@15470990, type=managedselector, id=0><>stopTimeout)
# TYPE org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout untyped
org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout{type="managedselector",id="0",} 30000.0
org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout{type="managedselector",id="1",} 30000.0
org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout{type="managedselector",id="3",} 30000.0
org_eclipse_jetty_io_HTTP_1_1_15470990_stopTimeout{type="managedselector",id="2",} 30000.0
# HELP java_lang_MemoryPool_UsageThreshold UsageThreshold (java.lang<type=MemoryPool, name=Code Cache><>UsageThreshold)
# TYPE java_lang_MemoryPool_UsageThreshold untyped
java_lang_MemoryPool_UsageThreshold{name="Code Cache",} 0.0
java_lang_MemoryPool_UsageThreshold{name="PS Old Gen",} 0.0
java_lang_MemoryPool_UsageThreshold{name="Compressed Class Space",} 0.0
java_lang_MemoryPool_UsageThreshold{name="Metaspace",} 0.0
# HELP java_lang_Threading_PeakThreadCount PeakThreadCount (java.lang<type=Threading><>PeakThreadCount)
# TYPE java_lang_Threading_PeakThreadCount untyped
java_lang_Threading_PeakThreadCount 109.0
# HELP org_eclipse_jetty_server_HTTP_1_1_15470990_sendServerVersion Whether to send the Server header in responses (org.eclipse.jetty.server<context=HTTP/1.1@15470990, type=httpconfiguration, id=0><>sendServerVersion)
# TYPE org_eclipse_jetty_server_HTTP_1_1_15470990_sendServerVersion untyped
org_eclipse_jetty_server_HTTP_1_1_15470990_sendServerVersion{type="httpconfiguration",id="0",} 1.0
# HELP java_lang_ClassLoading_TotalLoadedClassCount TotalLoadedClassCount (java.lang<type=ClassLoading><>TotalLoadedClassCount)
# TYPE java_lang_ClassLoading_TotalLoadedClassCount untyped
java_lang_ClassLoading_TotalLoadedClassCount 14393.0
# HELP org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_blockingTimeout Total timeout in ms for blocking I/O operations. (org.eclipse.jetty.server<context=SSL|HTTP/1.1@4ef474b6, type=httpconfiguration, id=0><>blockingTimeout)
# TYPE org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_blockingTimeout untyped
org_eclipse_jetty_server_SSL_HTTP_1_1_4ef474b6_blockingTimeout{type="httpconfiguration",id="0",} -1.0
# HELP org_eclipse_jetty_server_HTTP_1_1_15470990_blockingTimeout Total timeout in ms for blocking I/O operations. (org.eclipse.jetty.server<context=HTTP/1.1@15470990, type=httpconfiguration, id=0><>blockingTimeout)
# TYPE org_eclipse_jetty_server_HTTP_1_1_15470990_blockingTimeout untyped
org_eclipse_jetty_server_HTTP_1_1_15470990_blockingTimeout{type="httpconfiguration",id="0",} -1.0
# HELP org_apache_karaf_instance_Instances_Pid This type describes Karaf instance (org.apache.karaf<type=instance, name=trun, Name=trun><Instances>Pid)
# TYPE org_apache_karaf_instance_Instances_Pid untyped
org_apache_karaf_instance_Instances_Pid{name="trun",Name="trun",} 2600.0
# HELP org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptorPriorityDelta The priority delta to apply to acceptor threads (org.eclipse.jetty.server<context=HTTP/1.1@137f82d0, type=serverconnector, id=0><>acceptorPriorityDelta)
# TYPE org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptorPriorityDelta untyped
org_eclipse_jetty_server_HTTP_1_1_137f82d0_acceptorPriorityDelta{type="serverconnector",id="0",} -2.0
# HELP org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_dumpBeforeStop dump state to stderr before stop (org.ops4j.pax.web.service.jetty.internal<type=jettyserverwrapper, id=0><>dumpBeforeStop)
# TYPE org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_dumpBeforeStop untyped
org_ops4j_pax_web_service_jetty_internal_jettyserverwrapper_dumpBeforeStop{id="0",} 0.0
# HELP org_eclipse_jetty_server_HTTP_1_1_15470990_requestHeaderSize The maximum allowed size in bytes for a HTTP request header (org.eclipse.jetty.server<context=HTTP/1.1@15470990, type=httpconfiguration, id=0><>requestHeaderSize)
# TYPE org_eclipse_jetty_server_HTTP_1_1_15470990_requestHeaderSize untyped
org_eclipse_jetty_server_HTTP_1_1_15470990_requestHeaderSize{type="httpconfiguration",id="0",} 8192.0
# HELP org_apache_cxf_Shared_WorkQueueMaxSize The WorkQueueMaxSize (org.apache.cxf<bus.id=Shared, type=WorkQueues, name=default, instance.id=131247914><>WorkQueueMaxSize)
# TYPE org_apache_cxf_Shared_WorkQueueMaxSize untyped
org_apache_cxf_Shared_WorkQueueMaxSize{type="WorkQueues",name="default",instance_id="131247914",} 50.0
# HELP java_lang_MemoryPool_PeakUsage_committed java.lang.management.MemoryUsage (java.lang<type=MemoryPool, name=Code Cache><PeakUsage>committed)
# TYPE java_lang_MemoryPool_PeakUsage_committed untyped
java_lang_MemoryPool_PeakUsage_committed{name="Code Cache",} 2.3003136E7
java_lang_MemoryPool_PeakUsage_committed{name="PS Old Gen",} 2.7000832E8
java_lang_MemoryPool_PeakUsage_committed{name="Compressed Class Space",} 1.245184E7
java_lang_MemoryPool_PeakUsage_committed{name="Metaspace",} 8.7031808E7
java_lang_MemoryPool_PeakUsage_committed{name="PS Eden Space",} 2.92028416E8
java_lang_MemoryPool_PeakUsage_committed{name="PS Survivor Space",} 2.3068672E7
# HELP org_eclipse_jetty_server_HTTP_1_1_15470990_acceptors number of acceptor threads (org.eclipse.jetty.server<context=HTTP/1.1@15470990, type=serverconnector, id=0><>acceptors)
# TYPE org_eclipse_jetty_server_HTTP_1_1_15470990_acceptors untyped
org_eclipse_jetty_server_HTTP_1_1_15470990_acceptors{type="serverconnector",id="0",} 1.0
# HELP org_eclipse_jetty_server_HTTP_1_1_137f82d0_delayDispatchUntilContent Whether to delay the application dispatch until content is available (org.eclipse.jetty.server<context=HTTP/1.1@137f82d0, type=httpconfiguration, id=0><>delayDispatchUntilContent)
# TYPE org_eclipse_jetty_server_HTTP_1_1_137f82d0_delayDispatchUntilContent untyped
org_eclipse_jetty_server_HTTP_1_1_137f82d0_delayDispatchUntilContent{type="httpconfiguration",id="0",} 1.0
# HELP org_apache_aries_blueprint_blueprintState_LastEvents_Replay Blueprint event (org.apache.aries.blueprint<service=blueprintState, version=1.0, BundleId=192><LastEvents>Replay)
# TYPE org_apache_aries_blueprint_blueprintState_LastEvents_Replay untyped
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="192",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="98",} 1.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="194",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="198",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="199",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="201",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="204",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="12",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="205",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="46",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="112",} 1.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="241",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="246",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="248",} 0.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="25",} 1.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="26",} 1.0
org_apache_aries_blueprint_blueprintState_LastEvents_Replay{version="1.0",BundleId="221",} 1.0
# HELP java_nio_BufferPool_Count Count (java.nio<type=BufferPool, name=direct><>Count)
# TYPE java_nio_BufferPool_Count untyped
java_nio_BufferPool_Count{name="direct",} 5.0
java_nio_BufferPool_Count{name="mapped",} 0.0
# HELP java_lang_Threading_ThreadAllocatedMemoryEnabled ThreadAllocatedMemoryEnabled (java.lang<type=Threading><>ThreadAllocatedMemoryEnabled)
# TYPE java_lang_Threading_ThreadAllocatedMemoryEnabled untyped
java_lang_Threading_ThreadAllocatedMemoryEnabled 1.0
# HELP jolokia_Config_HistoryMaxEntries Attribute exposed for management (jolokia<type=Config><>HistoryMaxEntries)
# TYPE jolokia_Config_HistoryMaxEntries untyped
jolokia_Config_HistoryMaxEntries 10.0
# HELP java_lang_OperatingSystem_ProcessCpuLoad ProcessCpuLoad (java.lang<type=OperatingSystem><>ProcessCpuLoad)
# TYPE java_lang_OperatingSystem_ProcessCpuLoad untyped
java_lang_OperatingSystem_ProcessCpuLoad 0.12238162074777716
# HELP org_eclipse_jetty_server_HTTP_1_1_137f82d0_localPort local port (org.eclipse.jetty.server<context=HTTP/1.1@137f82d0, type=serverconnector, id=0><>localPort)
# TYPE org_eclipse_jetty_server_HTTP_1_1_137f82d0_localPort untyped
org_eclipse_jetty_server_HTTP_1_1_137f82d0_localPort{type="serverconnector",id="0",} 8040.0
org_apache_cxf_Shared_LowWaterMark{type="WorkQueues",name="default",instance_id="131247914",} 5.0
# HELP jmx_scrape_duration_seconds Time this JMX scrape took, in seconds.
# TYPE jmx_scrape_duration_seconds gauge
jmx_scrape_duration_seconds 7.527235
# HELP jmx_scrape_error Non-zero if this scrape failed.
# TYPE jmx_scrape_error gauge
jmx_scrape_error 0.0

答案1

得分: 1

以下是翻译好的内容:

Apache CXF库为我提供了这些数据。

附上了同样内容的jconsole的屏幕截图,我可以从中获取REST请求的次数。

在进行了5次HTTP POST请求后收集的数据。

获取非Spring Java应用程序的详细指标数据

英文:

Apache CXF library provided me these data.

attaching screenshot of jconsole for same, where I am getting count for number of REST hits.

Data collected after 5 HTTP POST requests.

获取非Spring Java应用程序的详细指标数据

huangapple
  • 本文由 发表于 2020年4月7日 18:43:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/61078202.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定