Skip to content
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: 10 additions & 2 deletions packages/couchbase/_dev/build/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ For example, you could use the data from this integration to know when there are

The Couchbase integration collects metrics data.

Metrics give you insight into the state of the Couchbase. Metrics data streams collected by the Couchbase integration include [Bucket](https://docs.couchbase.com/server/current/rest-api/rest-buckets-summary.html), [Cluster](https://docs.couchbase.com/server/current/rest-api/rest-cluster-details.html), [Couchbase Lite Replication](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#cbl_replication_pull), [Delta Sync](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#delta_sync), [GSI views](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#gsi_views), [Import](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#shared_bucket_import), and [Security](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#security) metrics from [Couchbase](https://www.couchbase.com/) so that the user could monitor and troubleshoot the performance of the Couchbase instances.
Metrics give you insight into the state of the Couchbase. Metrics data streams collected by the Couchbase integration include [Bucket](https://docs.couchbase.com/server/current/rest-api/rest-buckets-summary.html), [Cluster](https://docs.couchbase.com/server/current/rest-api/rest-cluster-details.html), [Couchbase Lite Replication](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#cbl_replication_pull), [Delta Sync](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#delta_sync), [GSI views](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#gsi_views), [Import](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#shared_bucket_import), [Resource Utilization](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#resource_utilization), and [Security](https://docs.couchbase.com/sync-gateway/current/stats-monitoring.html#security) metrics from [Couchbase](https://www.couchbase.com/) so that the user could monitor and troubleshoot the performance of the Couchbase instances.

This integration uses:
- `http` metricbeat module to collect `bucket` and `cluster` metrics.
- `prometheus` metricbeat module to collect `cbl_replication`, `delta_sync`, `gsi_views`, `import`, and `security` metrics.
- `prometheus` metricbeat module to collect `cbl_replication`, `delta_sync`, `gsi_views`, `import`, `resource`, and `security` metrics.

Note: For Couchbase cluster setup, there is an ideal scenario of a single host with administrator access for the entire cluster to collect metrics. Providing multiple hosts from the same cluster might lead to data duplication. In the case of multiple clusters, adding a new integration to collect data from different cluster hosts is a good option.

Expand Down Expand Up @@ -86,3 +86,11 @@ Global Secondary Indexes (GSI) support queries made by the Query Service.
{{event "miscellaneous"}}

{{fields "miscellaneous"}}

### Resource Utilization

This is the `resource` data stream. The Resource Utilization metrics are related to [MemStats](https://golang.org/pkg/runtime/#MemStats) records statistics about the memory allocator.

{{event "resource"}}

{{fields "resource"}}
5 changes: 5 additions & 0 deletions packages/couchbase/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "0.5.0"
changes:
- description: Couchbase integration package with "resource" data stream.
type: enhancement
link: https://github.com/elastic/integrations/pull/3971
- version: "0.4.0"
changes:
- description: Couchbase integration package with "miscellaneous" data stream.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dynamic_fields:
event.ingested: ".*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"events": [
{
"@timestamp": "2022-07-15T06:38:37.166Z",
"service": {
"address": "http://localhost:9421/metrics",
"type": "prometheus"
},
"prometheus": {
"labels": {
"instance": "localhost:9421",
"job": "prometheus"
},
"metrics": {
"sgw_resource_utilization_goroutines_high_watermark": 297,
"sgw_resource_utilization_warn_count": 9143,
"sgw_resource_utilization_go_memstats_heapinuse": 3.97533184e+08,
"sgw_resource_utilization_process_memory_resident": 5.77753088e+08,
"sgw_resource_utilization_go_memstats_heapreleased": 1.970176e+07,
"sgw_resource_utilization_go_memstats_sys": 5.7015116e+08,
"sgw_resource_utilization_go_memstats_heapalloc": 3.31451256e+08,
"sgw_resource_utilization_system_memory_total": 1.6637505536e+10,
"sgw_resource_utilization_go_memstats_stacksys": 3.76832e+06,
"sgw_resource_utilization_go_memstats_heapidle": 1.35569408e+08,
"sgw_resource_utilization_pub_net_bytes_sent": 1.19484151e+08,
"sgw_resource_utilization_num_goroutines": 240,
"sgw_resource_utilization_process_cpu_percent_utilization": 11.489248142477914,
"sgw_resource_utilization_go_memstats_stackinuse": 3.76832e+06,
"sgw_resource_utilization_pub_net_bytes_recv": 3.72908077e+08,
"sgw_resource_utilization_admin_net_bytes_sent": 1.19484151e+08,
"sgw_resource_utilization_admin_net_bytes_recv": 3.72908077e+08,
"sgw_resource_utilization_go_memstats_pausetotalns": 1.2177207e+08,
"sgw_resource_utilization_error_count": 0,
"go_memstats_last_gc_time_seconds": 1.657867123417899
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"expected": [
{
"@timestamp": "2022-07-15T06:38:37.166Z",
"couchbase": {
"resource": {
"admin_net": {
"bytes": {
"received": 3.72908077E8,
"sent": 1.19484151E8
}
},
"error": {
"count": 0
},
"go_memstats": {
"heap": {
"alloc": 3.31451256E8,
"idle": 1.35569408E8,
"in_use": 3.97533184E8,
"released": 1.970176E7
},
"stack": {
"in_use": 3768320.0
}
},
"last_gc": 1.657867123417899,
"process": {
"cpu": {
"pct": 11.489248142477914
},
"memory": {
"resident": 5.77753088E8
}
},
"warn": {
"count": 9143
}
}
},
"ecs": {
"version": "8.3.0"
},
"event": {
"category": [
"database"
],
"ingested": "2022-08-04T09:09:14.585647824Z",
"kind": "metric",
"module": "couchbase",
"type": [
"info"
]
},
"server": {
"address": "localhost:9421"
},
"service": {
"address": "http://localhost:9421/metrics",
"type": "prometheus"
},
"tags": [
"prometheus"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
service: exporter
input: prometheus/metrics
vars:
hosts:
- http://Administrator:password@{{Hostname}}:{{Ports}}
data_stream:
vars: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
metricsets: ["collector"]
hosts:
{{#each hosts}}
- {{this}}
{{/each}}
period: {{period}}
metrics_path: /metrics
metrics_filters:
include: ["sgw_resource_utilization*","go_memstats_last_gc_time_seconds"]
{{#if ssl}}
{{ssl}}
{{/if}}
tags:
{{#each tags as |tag|}}
- {{tag}}
{{/each}}
{{#contains "forwarded" tags}}
publisher_pipeline.disable_host: true
{{/contains}}
{{#if processors}}
processors:
{{processors}}
{{/if}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
description: Pipeline for parsing Couchbase Sync Gateway Resource Utilization metrics.
processors:
- set:
field: ecs.version
value: 8.3.0
ignore_failure: true
ignore_empty_value: true
- set:
field: event.type
value: [info]
ignore_failure: true
ignore_empty_value: true
- set:
field: event.kind
value: metric
ignore_failure: true
ignore_empty_value: true
- set:
field: event.category
value: [database]
ignore_failure: true
ignore_empty_value: true
- set:
field: event.ingested
value: "{{{_ingest.timestamp}}}"
ignore_failure: true
ignore_empty_value: true
- set:
field: event.module
value: couchbase
override: true
ignore_failure: true
ignore_empty_value: true
- rename:
field: prometheus.labels.instance
target_field: server.address
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_process_cpu_percent_utilization
target_field: couchbase.resource.process.cpu.pct
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_process_memory_resident
target_field: couchbase.resource.process.memory.resident
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_admin_net_bytes_recv
target_field: couchbase.resource.admin_net.bytes.received
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_admin_net_bytes_sent
target_field: couchbase.resource.admin_net.bytes.sent
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_go_memstats_heapalloc
target_field: couchbase.resource.go_memstats.heap.alloc
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_go_memstats_heapinuse
target_field: couchbase.resource.go_memstats.heap.in_use
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_go_memstats_heapidle
target_field: couchbase.resource.go_memstats.heap.idle
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_go_memstats_heapreleased
target_field: couchbase.resource.go_memstats.heap.released
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_go_memstats_stackinuse
target_field: couchbase.resource.go_memstats.stack.in_use
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_error_count
target_field: couchbase.resource.error.count
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.sgw_resource_utilization_warn_count
target_field: couchbase.resource.warn.count
ignore_missing: true
ignore_failure: true
- rename:
field: prometheus.metrics.go_memstats_last_gc_time_seconds
target_field: couchbase.resource.last_gc
ignore_missing: true
ignore_failure: true
- script:
description: Add job to tag list.
lang: painless
ignore_failure: true
source: |
if (ctx.tags == null) {
ctx.tags = new ArrayList();
}
ctx.tags.add(ctx.prometheus.labels.job)
- remove:
field: prometheus
ignore_failure: true
ignore_missing: true
- script:
description: Drops null/empty values recursively.
lang: painless
source: |
boolean drop(Object o) {
if (o == null || o == "") {
return true;
} else if (o instanceof Map) {
((Map) o).values().removeIf(v -> drop(v));
return (((Map) o).size() == 0);
} else if (o instanceof List) {
((List) o).removeIf(v -> drop(v));
return (((List) o).length == 0);
}
return false;
}
drop(ctx);
on_failure:
- set:
field: error.message
value: "{{{_ingest.on_failure_message}}}"
12 changes: 12 additions & 0 deletions packages/couchbase/data_stream/resource/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'
Comment thread
yug-rajani marked this conversation as resolved.
type: date
description: Event timestamp.
26 changes: 26 additions & 0 deletions packages/couchbase/data_stream/resource/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- external: ecs
name: ecs.version
- external: ecs
name: error.message
- external: ecs
name: event.category
- external: ecs
name: event.dataset
- external: ecs
name: event.duration
- external: ecs
name: event.ingested
- external: ecs
name: event.kind
- external: ecs
name: event.module
- external: ecs
name: event.type
- external: ecs
name: server.address
- external: ecs
name: service.address
- external: ecs
name: service.type
- external: ecs
name: tags
Loading