Skip to content

Commit

Permalink
Merge branch 'main' into dd-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 authored Dec 13, 2024
2 parents ed64c35 + d22a903 commit d64902f
Show file tree
Hide file tree
Showing 20 changed files with 1,432 additions and 69 deletions.
27 changes: 27 additions & 0 deletions .chloggen/get-xml-nonelements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'enhancement'

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: pkg/ottl

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: GetXML Converter now supports selecting text, CDATA, and attribute (value) content.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36821]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
31 changes: 31 additions & 0 deletions .chloggen/mongodbatlasreceiver-metric-adds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mongodbatlasreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Adds additional metrics to the MongoDB Atlas receiver"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36525]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Adds a number of new default disabled metrics to the MongoDB Atlas receiver. These metrics are:
- mongodbatlas.disk.partition.queue.depth
- mongodbatlas.disk.partition.throughput
- mongodbatlas.process.cache.ratio
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
27 changes: 27 additions & 0 deletions .chloggen/postgresql-17-bgwriter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: postgresqlreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Update the postgresqlreceiver to handle new table schema for the bgwriter metrics in pg17+"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36784]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
12 changes: 12 additions & 0 deletions pkg/ottl/ottlfuncs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,18 @@ Get all elements in the document with tag "a" that have an attribute "b" with va

- `GetXML(body, "//a[@b='c']")`

Get `foo` from `<a>foo</a>`

- `GetXML(body, "/a/text()")`

Get `hello` from `<a><![CDATA[hello]]></a>`

- `GetXML(body, "/a/text()")`

Get `bar` from `<a foo="bar"/>`

- `GetXML(body, "/a/@foo")`

### Hex

`Hex(value)`
Expand Down
12 changes: 10 additions & 2 deletions pkg/ottl/ottlfuncs/func_get_xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ func getXML[K any](target ottl.StringGetter[K], xPath string) ottl.ExprFunc[K] {

result := &xmlquery.Node{Type: xmlquery.DocumentNode}
for _, n := range nodes {
if n.Type != xmlquery.ElementNode {
switch n.Type {
case xmlquery.ElementNode, xmlquery.TextNode:
xmlquery.AddChild(result, n)
case xmlquery.AttributeNode, xmlquery.CharDataNode:
// get the value
xmlquery.AddChild(result, &xmlquery.Node{
Type: xmlquery.TextNode,
Data: n.InnerText(),
})
default:
continue
}
xmlquery.AddChild(result, n)
}
return result.OutputXML(false), nil
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/ottl/ottlfuncs/func_get_xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ func Test_GetXML(t *testing.T) {
want: `<a></a>`,
},
{
name: "ignore attribute selection",
name: "get attribute selection",
document: `<a foo="bar"></a>`,
xPath: "/@foo",
want: ``,
xPath: "/a/@foo",
want: `bar`,
},
{
name: "ignore text selection",
name: "get text selection",
document: `<a>hello</a>`,
xPath: "/a/text()",
want: ``,
want: `hello`,
},
{
name: "ignore chardata selection",
name: "get chardata selection",
document: `<a><![CDATA[hello]]></a>`,
xPath: "/a/text()",
want: ``,
want: `hello`,
},
}
for _, tt := range tests {
Expand Down
56 changes: 54 additions & 2 deletions receiver/mongodbatlasreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Aggregate of MongoDB Metrics DOCUMENT_METRICS_UPDATED, DOCUMENT_METRICS_DELETED,
DB Operation Rates
Aggregate of MongoDB Metrics OPCOUNTER_GETMORE, OPERATIONS_SCAN_AND_ORDER, OPCOUNTER_UPDATE, OPCOUNTER_REPL_UPDATE, OPCOUNTER_CMD, OPCOUNTER_DELETE, OPCOUNTER_REPL_DELETE, OPCOUNTER_REPL_CMD, OPCOUNTER_QUERY, OPCOUNTER_REPL_INSERT, OPCOUNTER_INSERT
Aggregate of MongoDB Metrics OPCOUNTER_GETMORE, OPERATIONS_SCAN_AND_ORDER, OPCOUNTER_UPDATE, OPCOUNTER_REPL_UPDATE, OPCOUNTER_CMD, OPCOUNTER_DELETE, OPCOUNTER_REPL_DELETE, OPCOUNTER_REPL_CMD, OPCOUNTER_QUERY, OPCOUNTER_REPL_INSERT, OPCOUNTER_INSERT, OPCOUNTER_TTL_DELETED
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
Expand All @@ -434,7 +434,7 @@ Aggregate of MongoDB Metrics OPCOUNTER_GETMORE, OPERATIONS_SCAN_AND_ORDER, OPCOU
| Name | Description | Values |
| ---- | ----------- | ------ |
| operation | Type of database operation | Str: ``cmd``, ``query``, ``update``, ``delete``, ``getmore``, ``insert``, ``scan_and_order`` |
| operation | Type of database operation | Str: ``cmd``, ``query``, ``update``, ``delete``, ``getmore``, ``insert``, ``scan_and_order``, ``ttl_deleted`` |
| cluster_role | Whether process is acting as replica or primary | Str: ``primary``, ``replica`` |
### mongodbatlas.process.db.operations.time
Expand Down Expand Up @@ -933,6 +933,58 @@ Aggregate of MongoDB Metrics MAX_SWAP_USAGE_FREE, MAX_SWAP_USAGE_USED
| ---- | ----------- | ------ |
| memory_state | Memory usage type | Str: ``resident``, ``virtual``, ``mapped``, ``computed``, ``shared``, ``free``, ``used`` |
## Optional Metrics
The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:
```yaml
metrics:
<metric_name>:
enabled: true
```
### mongodbatlas.disk.partition.queue.depth
Disk queue depth
Aggregate of MongoDB Metrics DISK_QUEUE_DEPTH
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |
### mongodbatlas.disk.partition.throughput
Disk throughput
Aggregate of MongoDB Metrics DISK_PARTITION_THROUGHPUT_READ, DISK_PARTITION_THROUGHPUT_WRITE
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By/s | Gauge | Double |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| disk_direction | Measurement type for disk operation | Str: ``read``, ``write``, ``total`` |
### mongodbatlas.process.cache.ratio
Cache ratios represented as (%)
Aggregate of MongoDB Metrics CACHE_FILL_RATIO, DIRTY_FILL_RATIO
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| % | Gauge | Double |
#### Attributes
| Name | Description | Values |
| ---- | ----------- | ------ |
| cache_ratio_type | Cache ratio type | Str: ``cache_fill``, ``dirty_fill`` |
## Resource Attributes
| Name | Description | Values | Enabled |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d64902f

Please sign in to comment.