{"id":20980713,"url":"https://github.com/statful/statful-micrometer-registry","last_synced_at":"2025-03-13T10:17:36.406Z","repository":{"id":56514090,"uuid":"198843136","full_name":"statful/statful-micrometer-registry","owner":"statful","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-03T05:27:31.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T06:34:51.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statful.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T14:06:47.000Z","updated_at":"2020-11-03T05:27:22.000Z","dependencies_parsed_at":"2022-08-15T20:10:31.065Z","dependency_job_id":null,"html_url":"https://github.com/statful/statful-micrometer-registry","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-micrometer-registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-micrometer-registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-micrometer-registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statful%2Fstatful-micrometer-registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statful","download_url":"https://codeload.github.com/statful/statful-micrometer-registry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243382934,"owners_count":20282051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T05:29:47.808Z","updated_at":"2025-03-13T10:17:36.377Z","avatar_url":"https://github.com/statful.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# statful-micrometer-registry\n\nConfiguration for gathering metrics from springboot actuator and send them to Statful. \n \n## Table of Contents\n\n* [Supported Versions](#supported-versions)\n* [Requirements](#requirements)\n* [Quick Start](#quick-start)\n* [Examples](#examples)\n* [Reference](#reference)\n* [Authors](#authors)\n* [License](#license)\n\n## Supported Versions\n\n| Statful client version | Tested Java versions  | Tested Spring Boot versions\n|:---|:---|:---|\n| 2.x.x | `Java 8` | `2.1.0.RELEASE` |\n\n## Requirements\n\nThis client has the following requirements:\n\n* [springboot-actuator](https://github.com/spring-projects/spring-boot/tree/master/spring-boot-actuator) in order to collect system, datasource, http, etc. metrics.\n* [statful-client-java](https://github.com/statful/statful-client-java) in order to send metrics into Statful.\n\n## Quick start\nTo use this simply add the maven dependency:\n\n```\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.statful.client.framework\u003c/groupId\u003e\n   \u003cartifactId\u003estatful-micrometer-registry\u003c/artifactId\u003e\n   \u003cversion\u003e${statful-micrometer-registry.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAnd then config a `StatfulMetricRegistry` bean in a `@Configuration` class. Keep in mind than you need to enable `StatfulMetricsProperties` using `@EnableConfigurationProperties`:\n\n```\n@Configuration\n@EnableConfigurationProperties(value = StatfulMetricsProperties.class)\npublic class StatfulRegistryConfiguration {\n\n    @Resource\n    private StatfulMetricRegistryConfig statfulMetricRegistryConfig;\n\n    @Resource\n    private StatfulClient statfulClient;\n\n    @Bean\n    public MeterRegistry metricRegistry(StatfulMetricsProperties properties) {\n        return new StatfulMetricRegistry(statfulMetricRegistryConfig, statfulClient, Clock.SYSTEM, properties);\n    }\n}\n``` \n\nAnd enable `@ComponentScan` for the configuration package.\n\nEnable metric collection by setting the following property:\n\n```\nstatful.client.springboot.metrics.enabled=true\n```\n\n## Examples\n\nYou can see the metrics output by running the client in dry-run mode, it will look similar to:\n\n```\n5:33:28.455 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.cache.entry.memory,app=tel,environment=development,cache=rate-limit-account-buckets-state,ownership=owned,name=rate-limit-account-buckets-state,cacheManager=cacheManager 0.0 1563892408 last,10 100\n15:33:28.457 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.memory.max,app=tel,area=heap,environment=development,id=PS\\ Old\\ Gen 2.772434944E9 1563892408 last,10 100\n15:33:28.488 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.timer.jvm.gc.pause,app=tel,action=end\\ of\\ minor\\ GC,cause=Metadata\\ GC\\ Threshold,unit=ms,environment=development 0 1563892408 avg,p90,count,10 100\n15:33:28.488 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.buffer.memory.used,app=tel,environment=development,id=direct 1.0 1563892408 last,10 100\n15:33:28.489 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.memory.max,app=tel,area=nonheap,environment=development,id=Metaspace -1.0 1563892408 last,10 100\n15:33:28.494 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.memory.used,app=tel,area=heap,environment=development,id=PS\\ Eden\\ Space 1.25688704E8 1563892408 last,10 100\n15:33:28.495 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.threads.daemon,app=tel,environment=development 19.0 1563892408 last,10 100\n15:33:28.496 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.system.cpu.usage,app=tel,environment=development 0.851063829787234 1563892408 last,10 100\n15:33:28.501 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.threads.states,app=tel,environment=development,state=blocked 1.0 1563892408 last,10 100\n15:33:28.502 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.threads.states,app=tel,environment=development,state=new 0.0 1563892408 last,10 100\n15:33:28.503 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.counter.jvm.gc.memory.allocated,app=tel,environment=development 0 1563892408 count,sum,10 100\n15:33:28.503 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.hikaricp.connections.idle,app=tel,pool=HikariPool-1,environment=development 2.0 1563892408 last,10 100\n\n```\n\n### Extra Configuration\n\nThere are a few ways that you can customize your metrics by simply setting\nsome application properties.\n\n##### Global metric prefix \nThis will set a prefix for all your metrics \n\n```\nstatful.client.springboot.metrics.prefix=springboot\n```\n\n##### Metric alias\nThis will replace every metric that contains the prefix with the chosen alias:\n\n```\nstatful.metrics.properties.alias.system.cpu=cpu\nstatful.metrics.properties.alias.jvm.memory=memory\n```\n\n##### Metric tags\nA list of tags to be added to the metrics that contain the prefix:\n\n```\nstatful.metrics.properties.tags.system.cpu=environment=prod\nstatful.metrics.properties.tags.jvm.memory=unit=Gb\n```\nTo add multiple tags use ';' as the separator:\n```\nstatful.metrics.properties.tags.jvm.memory=unit=Gb;environment=prod\n```\n\n##### Filter Metrics\n\nUsing Spring Boot's [Per-meter properties](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#_per_meter_properties)  it's possible to filter out certain metrics:\n\n###### application.yml\n```\nmanagement: \n  metrics:\n    enable:\n      cpu: false\n      memory: false\n      jvm: true\n      logback: false\n      http: true\n      process: false\n```\n###### application.properties\n```\nmanagement.metrics.enable.cpu=false\nmanagement.metrics.enable.memory=false\nmanagement.metrics.enable.jvm=true\nmanagement.metrics.enable.logback=false\nmanagement.metrics.enable.http=true\nmanagement.metrics.enable.proccess=false\n```\n\nWith the configuration:\n\n```\nstatful.metrics.properties.alias.jvm.memory=memory\nstatful.metrics.properties.tags.jvm.memory=environment=prod\n```\nAn example of the output this configuration would generate is:\n\n```\n15:06:03.519 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=heap,environment=prod,id=PS\\ Survivor\\ Space 2.883584E7 1563890763 last,10 100\n15:06:03.519 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.timer.jvm.gc.pause,app=tel,action=end\\ of\\ minor\\ GC,cause=Allocation\\ Failure,unit=ms,environment=development 0 1563890763 avg,p90,count,10 100\n15:06:03.519 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.counter.jvm.classes.unloaded,app=tel,environment=development 0 1563890763 count,sum,10 100\n15:06:03.520 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=nonheap,environment=prod,id=Metaspace -1.0 1563890763 last,10 100\n15:06:03.520 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=heap,environment=prod,id=PS\\ Eden\\ Space 2.15711232E8 1563890763 last,10 100\n15:06:03.520 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.gc.live.data.size,app=tel,environment=development 0.0 1563890763 last,10 100\n15:06:03.521 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=nonheap,environment=prod,id=Metaspace 1.02457344E8 1563890763 last,10 100\n15:06:03.522 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.threads.states,app=tel,environment=development,state=timed-waiting 61.0 1563890763 last,10 100\n15:06:03.522 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=heap,environment=prod,id=PS\\ Old\\ Gen 6.3446216E7 1563890763 last,10 100\n15:06:03.523 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=heap,environment=prod,id=PS\\ Survivor\\ Space 2.8820288E7 1563890763 last,10 100\n15:06:03.523 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.buffer.count,app=tel,environment=development,id=direct 2.0 1563890763 last,10 100\n15:06:03.523 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.buffer.total.capacity,app=tel,environment=development,id=direct 8192.0 1563890763 last,10 100\n15:06:03.524 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.buffer.count,app=tel,environment=development,id=mapped 0.0 1563890763 last,10 100\n15:06:03.524 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.jvm.buffer.total.capacity,app=tel,environment=development,id=mapped 0.0 1563890763 last,10 100\n15:06:03.524 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=nonheap,environment=prod,id=Compressed\\ Class\\ Space 1.441792E7 1563890763 last,10 100\n15:06:03.525 [pool-3-thread-1] DEBUG c.s.c.c.sender.BufferedMetricsSender - Dry metric: application.gauge.memory,app=tel,area=nonheap,environment=prod,id=Code\\ Cache 2.1168128E7 1563890763 last,10 100\n\n```\n\n\u003e In order to be able to define metric tags as above the springboot [configuration-metadata-annotation-processor](http://docs.spring.io/spring-boot/docs/1.4.1.RELEASE/reference/html/configuration-metadata.html#configuration-metadata-annotation-processor) is used. If you're using AspectJ in your project please refer to the documentation on the expected annotation processor behaviour.\n\n## Reference\n\n### Collected Metrics\n\nMetrics are collected according to what's described in the [Spring Boot documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html#production-ready-metrics-meter) and modelled into Statful format with the following considerations:\n\n* The type of metric is inferred by the metric's meaning with is decided both from the Spring Boot documentation and the actual code that exports data\n* Timer values are calculated by applying a mean to the values collected in the specified interval\n* Metrics that represent a value aggregated over a period of time are sent to Statful as previously aggregated\n \n## Authors\n\n[Mindera - Software Craft](https://github.com/Mindera)\n\n## License\n\nStatful Spring Boot Client is available under the MIT license. See the [LICENSE](https://raw.githubusercontent.com/statful/statful-micrometer-registry/master/LICENSE) file for more information.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatful%2Fstatful-micrometer-registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatful%2Fstatful-micrometer-registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatful%2Fstatful-micrometer-registry/lists"}