Skip to content

Commit

Permalink
Merge pull request #6 from logzio/development
Browse files Browse the repository at this point in the history
v0.66.0
  • Loading branch information
yotamloe authored Dec 6, 2022
2 parents ef5a4d8 + 4b6401a commit 5b80d89
Show file tree
Hide file tree
Showing 25 changed files with 470 additions and 307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-push-docker-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: go fmt
run: make format-components

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: lint
run: make lint-components

17 changes: 14 additions & 3 deletions .github/workflows/release-artifacts-windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish artifacts on a new release
name: Publish artifacts on a new release windows
on:
release:
types: [published]
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: Install go tools
run: make install-tools
- name: Install builder
Expand All @@ -24,11 +24,22 @@ jobs:
- name: build artifacts
run: make otelcol-logzio-${{ matrix.os_arch }}
working-directory: ./otelbuilder
- name: compress artifacts
uses: a7ul/[email protected]
id: compress
with:
command: c
cwd: ./otelbuilder/cmd
files: |
./otelcol-logzio-${{ matrix.os_arch }}.exe
outPath: ./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.tar.gz
- name: upload artifacts to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.exe
files: |
./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.exe
./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.tar.gz
23 changes: 13 additions & 10 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: build
name: Publish artifacts on a new release
on:
release:
types: [published]
jobs:
publish_artifacts:
strategy:
matrix:
os_arch: [ darwin_amd64, linux_amd64, linux_arm64, linux_arm ]
os_arch: [ darwin_amd64, darwin_arm64, linux_amd64, linux_arm64, linux_arm ]
name: publish artifacts
runs-on: macos-latest
steps:
Expand All @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: Install go tools
run: make install-tools
- name: Install builder
Expand All @@ -24,16 +24,19 @@ jobs:
- name: build artifacts
run: make otelcol-logzio-${{ matrix.os_arch }}
working-directory: ./otelbuilder
- name: compress
run: tar -czvf otelcol-logzio-${{ matrix.os_arch }}.tar.gz ./otelcol-logzio-${{ matrix.os_arch }}
working-directory: ./otelbuilder/cmd
- name: compress artifacts
uses: a7ul/[email protected]
id: compress
with:
command: c
cwd: ./otelbuilder/cmd
files: |
./otelcol-logzio-${{ matrix.os_arch }}
outPath: ./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.tar.gz
- name: upload artifacts to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}.tar.gz
./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}
./otelbuilder/cmd/otelcol-logzio-${{ matrix.os_arch }}
2 changes: 1 addition & 1 deletion .github/workflows/test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
# Load caches based on OS
- name: Linux Cache Go Modules
if: matrix.os == 'ubuntu-latest'
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17.11-alpine as builder
FROM golang:1.18.6-alpine as builder
ADD . /src
WORKDIR /src/otelbuilder/
ENV CGO_ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17.11-alpine as builder
FROM golang:1.18.6-alpine as builder
ADD . /src
WORKDIR /src/otelbuilder/
ENV CGO_ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17.11-alpine as builder
FROM golang:1.18.6-alpine as builder
ADD . /src
WORKDIR /src/otelbuilder/
ENV CGO_ENABLED=0
Expand Down
81 changes: 42 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The script below will perform the following steps:
- Configure the related environment variables and run the binary

```shell
curl -L https://github.com/logzio/otel-collector-distro/releases/download/v0.54.0/otelcol-logzio-darwin_amd64 > otelcol-logzio-darwin_amd64
curl -L https://github.com/logzio/otel-collector-distro/releases/download/v0.66.0/otelcol-logzio-darwin_amd64 > otelcol-logzio-darwin_amd64
chmod +x otelcol-logzio-darwin_amd64
curl -L https://raw.githubusercontent.com/logzio/otel-collector-distro/master/otel-config/macos.yml > macos.yml
export LOGS_TOKEN=<<logzio_logs_token>>
Expand All @@ -36,7 +36,7 @@ The script below will perform the following steps:
```shell
curl -L https://github.com/logzio/otel-collector-distro/releases/download/v0.54.0/otelcol-logzio-linux_amd64 > otelcol-logzio-linux_amd64
curl -L https://github.com/logzio/otel-collector-distro/releases/download/v0.66.0/otelcol-logzio-linux_amd64 > otelcol-logzio-linux_amd64
chmod +x otelcol-logzio-linux_amd64
curl -L https://raw.githubusercontent.com/logzio/otel-collector-distro/development/otel-config/linux.yml > linux.yml
export LOGS_TOKEN=<<logzio_logs_token>>
Expand Down Expand Up @@ -71,40 +71,43 @@ For the default and some example configs, see the [otel-config](/otel-config/) d
For general configuration help, see the [openTelemetry docs](https://opentelemetry.io/docs/collector/configuration/).
#### Logz.io opentelemetry collector distro components
| Receiver | Processor | Exporter | Extensions |
|---------------------------------|-------------------------------|------------------------------------|------------------------|
| otlpreceiver | attributesprocessor | `logzioexporter` | ballastextension |
| awscontainerinsightreceiver | resourceprocessor | `jsonlogexporter` | zpagesextension |
| awsecscontainermetricsreceiver | batchprocessor | loggingexporter | bearertokenauthextension|
| awsxrayreceiver | memorylimiterprocessor | otlpexporter | healthcheckextension |
| carbonreceiver | probabilisticsamplerprocessor | fileexporter | oidcauthextension |
| collectdreceiver | metricstransformprocessor | otlphttpexporter | pprofextension |
| dockerstatsreceiver | spanprocessor | prometheusexporter | |
| dotnetdiagnosticsreceiver | filterprocessor | prometheusremotewriteexporter | |
| filelogreceiver | resourcedetectionprocessor | | |
| fluentforwardreceiver | groupbyattrsprocessor | | |
| googlecloudspannerreceiver | groupbytraceprocessor | | |
| hostmetricsreceiver | routingprocessor | | |
| jaegerreceiver | spanmetricsprocessor | | |
| jmxreceiver | tailsamplingprocessor | | |
| journaldreceiver | | | |
| k8seventsreceiver | | | |
| kafkametricsreceiver | | | |
| kafkareceiver | | | |
| opencensusreceiver | | | |
| podmanreceiver | | | |
| prometheusreceiver | | | |
| receivercreator | | | |
| redisreceiver | | | |
| sapmreceiver | | | |
| signalfxreceiver | | | |
| simpleprometheusreceiver | | | |
| splunkhecreceiver | | | |
| statsdreceiver | | | |
| syslogreceiver | | | |
| tcplogreceiver | | | |
| udplogreceiver | | | |
| wavefrontreceiver | | | |
| windowsperfcountersreceiver | | | |
| zipkinreceiver | | | |
| zookeeperreceiver | | | |
| Receiver | Processor | Exporter | Extensions |
|--------------------------------|-------------------------------|-------------------------------|--------------------------|
| otlpreceiver | attributesprocessor | `logzioexporter` | ballastextension |
| awscontainerinsightreceiver | resourceprocessor | `jsonlogexporter` | zpagesextension |
| awsecscontainermetricsreceiver | batchprocessor | loggingexporter | bearertokenauthextension |
| awsxrayreceiver | memorylimiterprocessor | otlpexporter | healthcheckextension |
| carbonreceiver | probabilisticsamplerprocessor | fileexporter | oidcauthextension |
| collectdreceiver | metricstransformprocessor | otlphttpexporter | pprofextension |
| dockerstatsreceiver | spanprocessor | prometheusexporter | |
| dotnetdiagnosticsreceiver | filterprocessor | prometheusremotewriteexporter | |
| filelogreceiver | resourcedetectionprocessor | | |
| fluentforwardreceiver | groupbyattrsprocessor | | |
| googlecloudspannerreceiver | groupbytraceprocessor | | |
| hostmetricsreceiver | routingprocessor | | |
| jaegerreceiver | spanmetricsprocessor | | |
| jmxreceiver | tailsamplingprocessor | | |
| journaldreceiver | | | |
| k8seventsreceiver | | | |
| kafkametricsreceiver | | | |
| kafkareceiver | | | |
| opencensusreceiver | | | |
| podmanreceiver | | | |
| prometheusreceiver | | | |
| receivercreator | | | |
| redisreceiver | | | |
| sapmreceiver | | | |
| signalfxreceiver | | | |
| simpleprometheusreceiver | | | |
| splunkhecreceiver | | | |
| statsdreceiver | | | |
| syslogreceiver | | | |
| tcplogreceiver | | | |
| udplogreceiver | | | |
| wavefrontreceiver | | | |
| windowsperfcountersreceiver | | | |
| windowseventlogreceiver | | | |
| zipkinreceiver | | | |
| zookeeperreceiver | | | |
7 changes: 3 additions & 4 deletions logzio/exporter/logzioexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ import (
"testing"
"time"

"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/exporter/exporterhelper"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/service/servicetest"
)

Expand Down
24 changes: 12 additions & 12 deletions logzio/exporter/logzioexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"strconv"
"time"

"github.com/hashicorp/go-hclog"
"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/pkg/cache"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/consumererror"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/ptrace"
"google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/protobuf/proto"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger"
)

Expand Down Expand Up @@ -91,8 +89,9 @@ func newLogzioTracesExporter(config *Config, set component.ExporterCreateSetting
}
config.checkAndWarnDeprecatedOptions(exporter.logger)
return exporterhelper.NewTracesExporter(
config,
context.TODO(),
set,
config,
exporter.pushTraceData,
exporterhelper.WithStart(exporter.start),
// disable since we rely on http.Client timeout logic.
Expand All @@ -115,8 +114,9 @@ func newLogzioLogsExporter(config *Config, set component.ExporterCreateSettings)
}
config.checkAndWarnDeprecatedOptions(exporter.logger)
return exporterhelper.NewLogsExporter(
config,
context.TODO(),
set,
config,
exporter.pushLogData,
exporterhelper.WithStart(exporter.start),
// disable since we rely on http.Client timeout logic.
Expand All @@ -127,7 +127,7 @@ func newLogzioLogsExporter(config *Config, set component.ExporterCreateSettings)
}

func (exporter *logzioExporter) start(_ context.Context, host component.Host) error {
client, err := exporter.config.HTTPClientSettings.ToClient(host.GetExtensions(), exporter.settings)
client, err := exporter.config.HTTPClientSettings.ToClient(host, exporter.settings)
if err != nil {
return err
}
Expand All @@ -145,7 +145,7 @@ func (exporter *logzioExporter) pushLogData(ctx context.Context, ld plog.Logs) e
logRecords := scopeLogs.At(j).LogRecords()
for k := 0; k < logRecords.Len(); k++ {
log := logRecords.At(k)
jsonLog := ConvertLogRecordToJSON(log, resource, exporter.logger)
jsonLog := convertLogRecordToJSON(log, resource, exporter.logger)
logzioLog, err := json.Marshal(jsonLog)
if err != nil {
return err
Expand Down Expand Up @@ -175,7 +175,7 @@ func (exporter *logzioExporter) pushTraceData(ctx context.Context, traces ptrace
span.Process = batch.Process
span.Tags = exporter.dropEmptyTags(span.Tags)
span.Process.Tags = exporter.dropEmptyTags(span.Process.Tags)
logzioSpan, transformErr := TransformToLogzioSpanBytes(span)
logzioSpan, transformErr := transformToLogzioSpanBytes(span)
if transformErr != nil {
return transformErr
}
Expand All @@ -187,7 +187,7 @@ func (exporter *logzioExporter) pushTraceData(ctx context.Context, traces ptrace
// if the service hash already exists in cache: skip
// else: store service in cache and send to logz.io
// this prevents sending duplicate logzio services
service := NewLogzioService(span)
service := newLogzioService(span)
serviceHash, hashErr := service.HashCode()
if exporter.serviceCache.Get(serviceHash) == nil || hashErr != nil {
if hashErr == nil {
Expand Down Expand Up @@ -226,7 +226,7 @@ func (exporter *logzioExporter) export(ctx context.Context, url string, request

defer func() {
// Discard any remaining response body when we are done reading.
io.CopyN(ioutil.Discard, resp.Body, maxHTTPResponseReadBytes) // nolint:errcheck
io.CopyN(io.Discard, resp.Body, maxHTTPResponseReadBytes) // nolint:errcheck
resp.Body.Close()
}()
exporter.logger.Debug(fmt.Sprintf("Response status code: %d", resp.StatusCode))
Expand Down
Loading

0 comments on commit 5b80d89

Please sign in to comment.