Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Upgrade to OTEL Collector 0.85 #202

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name: "Basic checks"
name: "Build and test"
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
basic-checks:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.21'

- uses: actions/checkout@v3

- name: "run test in all go modules"
run: make gotest

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ bin/

/config.yaml
cmd/collector/jaeger-opentelemetry-collector

go.work
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# EXPERIMENTAL - DO NOT USE

## Jaeger OpenTelemetry collector

This repository hosts Jaeger specific components for OpenTelemetry collector. The repository is inspired by [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib) in a way that every component is a separate Golang module. The final distribution is assembled in [jaeger-opentelemetry-releases](https://github.com/jaegertracing/jaeger-opentelemetry-releases).
Expand Down
12 changes: 6 additions & 6 deletions cmd/jaegercol/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/service"
"go.opentelemetry.io/collector/otelcol"

"github.com/jaegertracing/jaeger-opentelemetry-collector/internal/components"
)
Expand All @@ -18,17 +18,17 @@ func main() {

info := component.BuildInfo{
Command: "otelcontribcol",
Description: "Jaeger OpenTelemetry Collector",
Version: "0.0.0",
Description: "Jaeger Collector",
Version: "2.0.0",
}

if err = runInteractive(service.CollectorSettings{BuildInfo: info, Factories: factories}); err != nil {
if err = runInteractive(otelcol.CollectorSettings{BuildInfo: info, Factories: factories}); err != nil {
log.Fatal(err)
}
}

func runInteractive(params service.CollectorSettings) error {
cmd := service.NewCommand(params)
func runInteractive(params otelcol.CollectorSettings) error {
cmd := otelcol.NewCommand(params)
if err := cmd.Execute(); err != nil {
return fmt.Errorf("collector server run finished with error: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions exporter/elasticsearch/config.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package elasticsearch

import (
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/component"
)

type Config struct {
config.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
// component.ExporterConfigSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
}

var _ config.Exporter = (*Config)(nil)
var _ component.Config = (*Config)(nil)

// Validate checks if the exporter configuration is valid
func (cfg *Config) Validate() error {
Expand Down
5 changes: 3 additions & 2 deletions exporter/elasticsearch/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"context"

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

// newTracesExporter returns a new Jaeger gRPC exporter.
// The exporter name is the name to be used in the observability of the exporter.
// The collectorEndpoint should be of the form "hostname:14250" (a gRPC target).
func newTracesExporter(cfg *Config, set component.ExporterCreateSettings) (component.TracesExporter, error) {
func newTracesExporter(cfg *Config, set exporter.CreateSettings) (exporter.Traces, error) {
s := newSender(cfg, set.TelemetrySettings)
return exporterhelper.NewTracesExporter(context.TODO(), set, cfg, s.pushTraces)
}
Expand All @@ -23,7 +24,7 @@ type sender struct {

func newSender(cfg *Config, settings component.TelemetrySettings) *sender {
return &sender{
name: cfg.ID().String(),
// name: cfg.ID().String(),
settings: settings,
}
}
Expand Down
24 changes: 12 additions & 12 deletions exporter/elasticsearch/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/exporter"
)

const (
// The value of "type" key in configuration.
typeStr = "elasticsearch"
stability = component.StabilityLevelInDevelopment
stability = component.StabilityLevelAlpha
)

// NewFactory creates a factory for Jaeger exporter
func NewFactory() component.ExporterFactory {
return component.NewExporterFactory(
func NewFactory() exporter.Factory {
return exporter.NewFactory(
typeStr,
createDefaultConfig,
component.WithTracesExporter(createTracesExporter, stability))
exporter.WithTraces(createTracesExporter, stability))
}

func createDefaultConfig() config.Exporter {
func createDefaultConfig() component.Config {
return &Config{
ExporterSettings: config.NewExporterSettings(config.NewComponentID(typeStr)),
// ExporterSettings: component.NewExporterSettings(component.NewID(typeStr)),
}
}

func createTracesExporter(
_ context.Context,
set component.ExporterCreateSettings,
config config.Exporter,
) (component.TracesExporter, error) {
expCfg := config.(*Config)
ctx context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Traces, error) {
expCfg := cfg.(*Config)
return newTracesExporter(expCfg, set)
}
53 changes: 33 additions & 20 deletions exporter/elasticsearch/go.mod
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
module github.com/jaegertracing/jaeger-opentelemetry-collector/exporter/elasticsearch

go 1.17
go 1.21

require (
github.com/stretchr/testify v1.8.0
go.opentelemetry.io/collector v0.59.0
go.opentelemetry.io/collector/pdata v0.59.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.85.0
go.opentelemetry.io/collector/exporter v0.85.0
go.opentelemetry.io/collector/pdata v1.0.0-rcv0014
)

require (
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/knadh/koanf v1.4.3 // indirect
github.com/knadh/koanf/v2 v2.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector v0.85.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.85.0 // indirect
go.opentelemetry.io/collector/confmap v0.85.0 // indirect
go.opentelemetry.io/collector/consumer v0.85.0 // indirect
go.opentelemetry.io/collector/extension v0.85.0 // indirect
go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect
go.opentelemetry.io/collector/processor v0.85.0 // indirect
go.opentelemetry.io/collector/receiver v0.85.0 // indirect
go.opentelemetry.io/otel v1.17.0 // indirect
go.opentelemetry.io/otel/metric v1.17.0 // indirect
go.opentelemetry.io/otel/sdk v1.17.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.40.0 // indirect
go.opentelemetry.io/otel/trace v1.17.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading