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

Spring boot package [Memory - data stream] #2979

Merged
merged 18 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/spring_boot/_dev/build/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ This is the `http_trace` data stream.
{{event "http_trace"}}

{{fields "http_trace"}}

## Metrics

### Memory Metrics

This is the `memory` data stream.

- This data stream gives metrics related to heap and non-heap memory, buffer pool and manager.

{{event "memory"}}

{{fields "memory"}}
5 changes: 5 additions & 0 deletions packages/spring_boot/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.3.0"
changes:
- description: memory data stream of the package
type: enhancement
link: https://github.com/elastic/integrations/pull/2979
- version: "0.2.0"
changes:
- description: http_trace data stream of the package
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vars:
hosts: http://springboot:8090/actuator/jolokia
path: /jolokia/?ignoreErrors=true&canonicalNaming=false
input: jolokia/metrics
data_stream:
vars: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
metricsets: ["jmx"]
namespace: "metrics"
hosts: {{hosts}}
http_method: "GET"
path: {{path}}
username: {{username}}
password: {{password}}
period: {{period}}
{{#if ssl}}
ssl: {{ssl}}
{{/if}}
jmx.mappings:
- mbean: 'java.lang:type=Memory'
attributes:
- attr: HeapMemoryUsage
field: heap
- attr: NonHeapMemoryUsage
field: non_heap
- mbean: 'java.nio:name=direct,type=BufferPool'
attributes:
- attr: TotalCapacity
field: buffer_pool.direct.total_capacity
- attr: MemoryUsed
field: buffer_pool.direct.used
- attr: Count
field: buffer_pool.direct.count
- mbean: 'java.nio:name=mapped,type=BufferPool'
attributes:
- attr: TotalCapacity
field: buffer_pool.mapped.total_capacity
- attr: MemoryUsed
field: buffer_pool.mapped.used
- attr: Count
field: buffer_pool.mapped.count
- mbean: 'java.lang:name=CodeCacheManager,type=MemoryManager'
attributes:
- attr: Valid
field: manager.code_cache.valid
- attr: Name
field: manager.code_cache.name
- mbean: 'java.lang:name=Metaspace Manager,type=MemoryManager'
attributes:
- attr: Valid
field: manager.metaspace.valid
- attr: Name
field: manager.metaspace.name

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
description: Pipeline for parsing Spring Boot Memory metrics.
processors:
- set:
field: ecs.version
value: "8.1.0"
- rename:
field: message
target_field: event.original
ignore_missing: true
- rename:
field: jolokia.metrics
target_field: spring_boot.memory
ignore_missing: true
ignore_failure: true
- set:
field: event.type
value: info
- set:
field: event.kind
value: metric
- set:
field: event.category
value: database
- set:
field: event.module
value: spring_boot
- set:
field: event.dataset
value: spring_boot.memory
- remove:
field: jolokia
ignore_missing: true
ignore_failure: true
on_failure:
- set:
field: error.message
value: "{{ _ingest.on_failure_message }}"
12 changes: 12 additions & 0 deletions packages/spring_boot/data_stream/memory/fields/base-fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: data_stream.type
type: constant_keyword
description: Data stream type.
- name: data_stream.dataset
type: constant_keyword
description: Data stream dataset.
- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
- name: '@timestamp'
type: date
description: Event timestamp.
16 changes: 16 additions & 0 deletions packages/spring_boot/data_stream/memory/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- external: ecs
name: ecs.version
- external: ecs
name: error.message
- external: ecs
name: event.category
- external: ecs
name: event.dataset
- external: ecs
name: event.kind
- external: ecs
name: event.module
- external: ecs
name: service.address
- external: ecs
name: service.type
84 changes: 84 additions & 0 deletions packages/spring_boot/data_stream/memory/fields/fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
- name: spring_boot
type: group
fields:
- name: memory
type: group
fields:
- name: buffer_pool
type: group
fields:
- name: direct
type: group
fields:
- name: count
type: long
description: Count of direct buffer pool memory
- name: used
type: long
description: Used memory of direct buffer pool
- name: total_capacity
type: long
description: Total capacity of direct buffer pool memory
- name: mapped
type: group
fields:
- name: count
type: long
description: Count of mapped buffer pool memory
- name: used
type: long
description: Used memory of mapped buffer pool
- name: total_capacity
type: long
description: Total capacity of mapped buffer pool memory
- name: heap
type: group
fields:
- name: committed
type: long
description: Committed heap memory usage of JVM
- name: init
type: long
description: Init heap memory usage of JVM
- name: max
type: long
description: Max heap memory usage of JVM
- name: used
type: long
description: Used heap memory usage of JVM
- name: non_heap
type: group
fields:
- name: committed
type: long
description: Committed non-heap memory usage of JVM
- name: init
type: long
description: Init non-heap memory usage of JVM
- name: max
type: long
description: Max non-heap memory usage of JVM
- name: used
type: long
description: Used non-heap memory usage of JVM
- name: manager
type: group
fields:
- name: code_cache
type: group
fields:
- name: name
type: keyword
description: Name of the cacheManager to qualify the cache
- name: valid
type: boolean
description: Validation of code cache
- name: metaspace
type: group
fields:
- name: name
type: keyword
description: Name of the Metaspace Manager to qualify the cache
- name: valid
type: boolean
description: Validation of metaspace manager
21 changes: 21 additions & 0 deletions packages/spring_boot/data_stream/memory/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title: Memory Metrics
type: metrics
streams:
- input: jolokia/metrics
template_path: stream.yml.hbs
title: Memory metrics
description: Collect Spring Boot Memory metrics.
vars:
- name: period
type: text
title: Period
default: 60s
- name: processors
type: yaml
title: Processors
multi: false
required: false
show_user: false
description: >
Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the logs are parsed. See [Processors](https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html) for details.

78 changes: 78 additions & 0 deletions packages/spring_boot/data_stream/memory/sample_event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you dump an event that collects most of defined metrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

"@timestamp": "2022-04-20T13:03:45.533Z",
"agent": {
"ephemeral_id": "c9cba3ad-ab82-4f17-95b1-a92257a086b0",
"id": "f7cd0ea7-4d35-4573-956a-021aa2718bbe",
"name": "docker-fleet-agent",
"type": "metricbeat",
"version": "8.1.0"
},
"data_stream": {
"dataset": "spring_boot.memory",
"namespace": "ep",
"type": "metrics"
},
"ecs": {
"version": "8.1.0"
},
"elastic_agent": {
"id": "f7cd0ea7-4d35-4573-956a-021aa2718bbe",
"snapshot": false,
"version": "8.1.0"
},
"event": {
"agent_id_status": "verified",
"category": "database",
"dataset": "spring_boot.memory",
"duration": 498219023,
"ingested": "2022-04-20T13:03:48Z",
"kind": "metric",
"module": "spring_boot",
"type": "info"
},
"host": {
"architecture": "x86_64",
"containerized": true,
"hostname": "docker-fleet-agent",
"ip": [
"192.168.144.4"
],
"mac": [
"02:42:c0:a8:90:04"
],
"name": "docker-fleet-agent",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "3.10.0-1160.59.1.el7.x86_64",
"name": "Ubuntu",
"platform": "ubuntu",
"type": "linux",
"version": "20.04.3 LTS (Focal Fossa)"
}
},
"metricset": {
"name": "jmx",
"period": 60000
},
"service": {
"address": "http://springboot:8090/actuator/jolokia",
"type": "jolokia"
},
"spring_boot": {
"memory": {
"heap": {
"committed": 303038464,
"init": 96468992,
"max": 1350041600,
"used": 135078232
},
"non_heap": {
"committed": 60882944,
"init": 2555904,
"max": -1,
"used": 55917256
}
}
}
}
Loading