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

[syslogexporter] set defaults for sending_queue and retry_on_failure and fix errors reported by golangci-lint #1056

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

kasia-kujawa
Copy link
Contributor

@kasia-kujawa kasia-kujawa commented Mar 10, 2023

Summary of changes:

  • fix(syslogexporter): set default settings for sending_queue and retry_on_failure
    default setting are now set to defaults in exporterhelper,
    one expection - sending queue is enabled by default in syslog exporter

  • chore(syslogexporter): fix errors reported by golangci-lint in opentelemetry-collector-contrib repository

List of reported errors:

/Users/kkujawa/git/opentelemetry-collector-contrib/.tools/golangci-lint run --allow-parallel-runners --build-tags integration
utils.go:38:5: increment-decrement: should replace errorsWithCounts[i].count += 1 with errorsWithCounts[i].count++ (revive)
                                errorsWithCounts[i].count += 1
                                ^
config.go:28:2: error-naming: error var unsupportedPort should have name of the form errFoo (revive)
        unsupportedPort     = errors.New("unsupported port: port is required, must be in the range 1-65535")
        ^
config.go:29:2: error-naming: error var invalidEndpoint should have name of the form errFoo (revive)
        invalidEndpoint     = errors.New("invalid endpoint: endpoint is required, must be a valid FQDN or IP address")
        ^
config.go:30:2: error-naming: error var unsupportedProtocol should have name of the form errFoo (revive)
        unsupportedProtocol = errors.New("unsupported protocol: protocol is required, only tcp/udp supported")
        ^
config.go:31:2: error-naming: error var unsupportedFormat should have name of the form errFoo (revive)
        unsupportedFormat   = errors.New("unsupported format: Only rfc5424 and rfc3164 supported")
        ^
syslog.go:41:7: var-naming: const msgId should be msgID (revive)
const msgId = "msg_id"
      ^
utils_test.go:83:22: unnecessary conversion (unconvert)
                        expected: []string([]string{"failed sending data: 502 Bad Gateway",
                                          ^
exporter.go:127:39: `(*syslogexporter).sendSyslogs` - `ctx` is unused (unparam)
func (se *syslogexporter) sendSyslogs(ctx context.Context, rl plog.ResourceLogs) ([]plog.LogRecord, error) {
                                      ^
utils.go:54:63: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
                        uniqueErrors = append(uniqueErrors, fmt.Errorf("%s (x%d)", errorWithCount.err, errorWithCount.count))
                                                                                   ^
exporter_test.go:177:42: type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
        consumerLogs := consumererror.Logs.Data(consumerErr.(consumererror.Logs))
                                                ^
factory.go:43:5: unusedwrite: unused write to field Enabled (govet)
        qs.Enabled = false
           ^
factory_test.go:35:5: unusedwrite: unused write to field Enabled (govet)
        qs.Enabled = false
           ^
make: *** [lint] Error 1

@github-actions github-actions bot added the go label Mar 10, 2023
@kasia-kujawa kasia-kujawa force-pushed the kk-fix-golang-ci-lint branch 2 times, most recently from 7475ab9 to e1ea7cf Compare March 10, 2023 13:44
@kasia-kujawa kasia-kujawa changed the title chore(syslogexporter): fix errors reported by golangci-lint in opentelemetry-collector-contrib Set defaults for sending_queue and retry_on_failure and fix errors reported by golangci-lint Mar 10, 2023
@kasia-kujawa kasia-kujawa force-pushed the kk-fix-golang-ci-lint branch 5 times, most recently from 01074b4 to afd4426 Compare March 13, 2023 09:07
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 13, 2023
@kasia-kujawa kasia-kujawa force-pushed the kk-fix-golang-ci-lint branch from afd4426 to a259c3d Compare March 13, 2023 09:30
@kasia-kujawa kasia-kujawa marked this pull request as ready for review March 13, 2023 09:30
@kasia-kujawa kasia-kujawa requested a review from a team as a code owner March 13, 2023 09:30
@kasia-kujawa kasia-kujawa changed the title Set defaults for sending_queue and retry_on_failure and fix errors reported by golangci-lint [syslogexporter] set defaults for sending_queue and retry_on_failure and fix errors reported by golangci-lint Mar 13, 2023
@kasia-kujawa kasia-kujawa force-pushed the kk-fix-golang-ci-lint branch from a259c3d to 38e2694 Compare March 13, 2023 13:37
…_on_failure

default setting are now set to defaults in exporterhelper,
one expection - sending queue is enabled by default in syslog exporter

chore(syslogexporter): fix errors reported by golangci-lint in opentelemetry-collector-contrib repository
@kasia-kujawa kasia-kujawa force-pushed the kk-fix-golang-ci-lint branch from 38e2694 to b3ab15a Compare March 13, 2023 13:39
@kasia-kujawa kasia-kujawa merged commit 6acb5f9 into main Mar 13, 2023
@kasia-kujawa kasia-kujawa deleted the kk-fix-golang-ci-lint branch March 13, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants