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

Collector logging exporter #373

Merged
merged 10 commits into from
May 2, 2022

Conversation

damemi
Copy link
Member

@damemi damemi commented Apr 29, 2022

This picks the logic commits from https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/tree/collector_logging into a new branch based off main

damemi and others added 2 commits April 29, 2022 19:55
* Start work on logs collector

* New commit to poke Github

* make gotidy

Co-authored-by: Punya Biswal <punya@google.com>
* collector: added log conversion to entries

Added functionality to convert pdata Logs to Cloud Logging entries. Also
added necessary configuration and self observability.

* collector: log mapper, tests, resolving comments

Switched to the logMapper pattern, mimicking what the MetricsExporter
does. This separation allowed for unit testing the pure functions on the
logMapper.

Added the first set of unit tests which cover lines but probably don't
exhaust edge cases. Should be expanded upon.

Removed some fields that we've decided are too nuanced to be part of
this PR.

* integrationtest: ran make gotidy

Some changes were made after running make gotidy.

* collector: added required header, fixed linting

Forgot to add the Google header to logs_test.go

`golint` wants http to be all capitals. `govet` warned about a
shadowed declaration of `err` and even though it wasn't a problem
figured I'd make it go away anyway.

* collector: resetting go.mod

Resetting go.mod to the versions in the target branch since there is
another PR to update dependencies that we'll rebase on.

* collector: parse HTTPRequest from proper place

The HTTPRequest data is actually going to come from an attribute in the
log, which actually enables this code to be far simpler; originally I
wrote it as if the httpRequest was going to be a key in the body that
needed to be extracted. With this not being the case, got to remove a
ton of json marshalling code and even removed the need to configure
parsing HTTP request, since the operation to look it up is constant and
we don't lose anything by just checking every time.

* collector: lint fix HTTP caps

* integrationtest: revert go.mod changes

Going back to the previous version here too to make the feature branch
rebase easier.

* collector: added todo comment

Unmarshalling JSON can be slow when done incessantly, left a TODO to
investigate an alternative for serializing the com.google.httpRequest
data.
…m#355)

* Parse instrumentation scope labels

* Parse timestamp

* Parse sourceLocation

* Parse trace and span ID

* Pass Body() to Payload and add checks for instrumentation labels

* Change tests and log body parsing for different types

* Add tests for trace/span/sourceLocation

* go lint
* Add DefaultLogName config option

* Switch to generated client and parse log name

* Add test cases
…rm#363)

* Add config options and implement request batching

* Refactor to send requests in chunks
* Rename TestCases to MetricsTestCases

* Add logs integration test

* Logs integration test (copying metrics framework)

* Update HTTPRequest parsing for different value types

* Fix up logs.go

* Unify MetricsTestCase and LogsTestCase structs

* Update recordfixtures command for logs

* gofmt

* Set project from ADC

* Use development logger

* Record logs and metrics
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants