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

[receiver/kafka] Add JSON-encoded log support #22982

Conversation

Caleb-Hurshman
Copy link
Contributor

@Caleb-Hurshman Caleb-Hurshman commented May 31, 2023

Description:
Added support for json encoded logs to the kafkareceiver

Link to tracking Issue: #20734

Testing: Added limited tests for json_unmarshaler.go, similar to existing 'unmarshaler' files.

Documentation: Updated README.md of the kafkareceiver to include the JSON encoding option.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 31, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@Caleb-Hurshman Caleb-Hurshman changed the title JSON encoded log support Add JSON-encoded log support Jun 1, 2023
@djaglowski djaglowski changed the title Add JSON-encoded log support [receiver/kafka] Add JSON-encoded log support Jun 5, 2023
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me but codeowners @pavolloffay and @MovieStoreGuy may have more context.

receiver/kafkareceiver/README.md Outdated Show resolved Hide resolved
@Caleb-Hurshman
Copy link
Contributor Author

@MovieStoreGuy @pavolloffay Re-pinging for review, need feedback on this kafakreceiver enhancement

Co-authored-by: Daniel Jaglowski <[email protected]>
@Caleb-Hurshman
Copy link
Contributor Author

@MovieStoreGuy @pavolloffay Re-pinging for review, need feedback on this kafakreceiver enhancement

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

LGTM.

@Caleb-Hurshman, the lint failure appears unrelated but I can't get the job to cancel. I think rebasing may help.

I would appreciate a review from @MovieStoreGuy or @pavolloffay but I think this is straightforward enough to merge if they do not have an opinion.

@djaglowski djaglowski force-pushed the feat/kafka-support-json-log-encoding branch from f9b2523 to df6a460 Compare June 21, 2023 00:39
Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

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

Sorry for missing pings, I have a couple comments that just to address.

The only thing blocking on my behalf is adding tests just validate marshalling.

Are you also able to add this to the kafka exporters.

t.Parallel()
um := newJSONLogsUnmarshaler()
assert.Equal(t, "json", um.Encoding())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind adding some tests to validate that a given json blob of {blah ...} is encoding as a plog value?


// get json logs from the buffer
jsonVal := map[string]interface{}{}
if err := json.Unmarshal(buf, &jsonVal); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could I ask you to use jsoniter instead?

It has improved performance over the standard lib json encoding.

Alex Boten and others added 22 commits July 6, 2023 15:25
ADDLICENCESE -> ADDLICENSE

Signed-off-by: Alex Boten <[email protected]>
found a bunch of double commented out statements

Signed-off-by: Alex Boten <[email protected]>
The previous target still exists, but a more intuitive target is added
and used by CI. Also switches integration targets to the same iteration
pattern used for other groups of modules.
…pen-telemetry#23632)

Utilize mdatagen to modify
certain metrics from gauge to non-monotonic sum, employing delta
aggregation. Adjust the test files to align with the sum test type and
update the expected.yaml file for integration testing purposes.

Co-authored-by: zeno-splunk <[email protected]>
Add JMX metrics gatherer version `1.27.0-alpha`.

cc @open-telemetry/java-contrib-approvers
…nt (open-telemetry#23640)

**Description:** updated dataset-go library, send more details in
user-agent
For more details see
https://github.com/scalyr/dataset-go/releases/tag/v0.0.9

**Link to tracking Issue:**
open-telemetry#20660
/ DSET-3468

**Testing:** verified via unit tests and also e2e with DataSet
environment

**Documentation:** see
https://github.com/scalyr/dataset-go/blob/fbaead7856a9c5669262564dfa4a13aa14a0775d/examples/readme/main.go#L81
…3564)

Following the same approach of
open-telemetry#20903

I am adding the scope whenever the metric is copied. We could also add
the _scope_ at creation time, however, it would change the signature of
several functions having already too many parameters.

**Link to tracking Issue:** <Issue number if applicable>
Fix open-telemetry#23563

**Testing:** 
Added a test to cover the new use case
…de-references (open-telemetry#23644)

Fixes possible panics from unchecked de-references in
metrics helper in `awsecscontainermetrics` receiver.

**Link to tracking Issue:**
aws-observability/aws-otel-collector#2110

**Testing:** Added unit tests for these de-references

**Documentation:** n//a
)

**Description:** 
Fixed a bug in which the Vcenter receiver was incorrectly emmiting the
disk_state: used datapoint twice under the vcenter.datastore.disk.usage
metric instead of a
disk_state: used
disk_state: available

**Documentation:** <Describe the documentation added.>
**Description:** <Describe what has changed.>
fixed an issue where postgresql receiver was emitting the same attribute
value "toast_hit" twice under postgresql.blocks_read metric.

**Link to tracking Issue:** <Issue number if applicable>

**Testing:** <Describe what testing was performed and which tests were
added.>

**Documentation:** <Describe the documentation added.>
… hosts that use cgroups v2 (open-telemetry#22706)

**Description:**
This PR updates the documentation of all the metrics that are available
only on cgroups v1 or cgroups v2.

It PR also adds two metrics that are only available when the host is
using cgroups v2:
 * `container.memory.anon`
 * `container.memory.file`

Both are documented here:
https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files

I enabled the metric `container.memory.file` by default (causing a
breaking change) because it is a metric that was already scraped for
cgroups v1, contained in the metric `container.memory.total_cache`.

```yaml
  container.memory.total_cache:
    enabled: true
    description: "Total amount of memory used by the processes of this cgroup (and descendants) that can be associated with a block on a block device. Also accounts for memory used by tmpfs (Only available with cgroups v1)."

  container.memory.file:
    enabled: true
    description: "Amount of memory used to cache filesystem data, including tmpfs and shared memory (Only available with cgroups v2)."
```

Let me know your thoughts about this breaking change.

**Link to tracking Issue:** open-telemetry#21097

**Testing:**
The refactor done during PR open-telemetry#21110 had mocks ready to test these new
metrics. There is no need to add more tests.

**Documentation:**
To see which metrics are available in Docker:
* v1:
https://github.com/moby/moby/blob/7103efac9d737e8b202126e8c8e2227805e70771/daemon/stats_unix.go#L86
* v2:
https://github.com/moby/moby/blob/7103efac9d737e8b202126e8c8e2227805e70771/daemon/stats_unix.go#L195

Kernel cgroup documentation:
 * v1: https://docs.kernel.org/admin-guide/cgroup-v1/memory.html
* v2:
https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files
…or in resource processor (open-telemetry#23253)

**Description:** Adding resource_attributes option to every detector in
resource detection processor
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->

**Link to tracking Issue:**
[21482](open-telemetry#21482)

**Testing:** Unit test for `resource_attribute` config, adjusting
current unit tests to the new implementation

**Documentation:** Updated README.md

---------

Co-authored-by: Dmitrii Anoshin <[email protected]>
…orrect fingerprint update (open-telemetry#23183)

The logic for determining when to update a fingerprint previously failed
to account for the case where the buffer size is smaller than the
fingerprint. This allows the fingerprint to be truncated in some cases.

This PR rewrites the logic to explicitly handle each expected case, with
optimization for handling the most common cases first.
**Description:** Updates GCP libraries to v0.39.2 and 1.15.2

**Documentation:** updated readmes for new experimental WAL fields
…y#23571)

Metric unit is required, see:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/cmd/mdatagen/metadata-schema.yaml#L72-L73.

This PR adds the unit to metrics where this is missing:
- postgresql.bgwriter.maxwritten
- postgresql.table.count
…ts (open-telemetry#23636)

This PR adds a `parent` field to the `metadata.yaml`. This is used in
subcomponents, and the field contains the type of their parent
component.

---------

Co-authored-by: Dmitrii Anoshin <[email protected]>
…ry#21185)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Add `container.image.id` and `container.command_line` as optional
resource attributes, disabled by default.



**Link to tracking Issue:** <Issue number if applicable>

Tracking issue
open-telemetry#21092

**Testing:** <Describe what testing was performed and which tests were
added.>

Until this point, all resource attributes have been enabled by default,
resulting in the coupling of the
[test](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7bf5d66fae6c1c5360ec2875948f2c2adab6c44f/receiver/dockerstatsreceiver/receiver_test.go#L191)
to the default configuration. In order to test the current
implementation with the new resource attributes enabled & disabled, a
minor refactoring was required in the `TestScrapeV2` test, allowing to
pass different configurations for each test.

Refer to the following commit 508dbee9aa9a22c1ca79f16bba5abeecceeb9c48
to check the refactor in the test.

**Documentation:** <Describe the documentation added.>

New resource attributes documentation was generated by `mdatagen`.
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

something looks like it's gone wonky w/ the rebase, it's showing 242 commits

@Caleb-Hurshman Caleb-Hurshman changed the base branch from main to benchmarks July 6, 2023 19:49
@Caleb-Hurshman Caleb-Hurshman changed the base branch from benchmarks to main July 6, 2023 19:50
@Caleb-Hurshman Caleb-Hurshman deleted the feat/kafka-support-json-log-encoding branch July 7, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.