Skip to content

Commit

Permalink
Merge branch 'main' into sampling_refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Pushkarm029 committed May 21, 2024
2 parents 2b8c074 + 486f74f commit cf87b44
Show file tree
Hide file tree
Showing 80 changed files with 696 additions and 1,904 deletions.
4 changes: 1 addition & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ coverage:
project:
default:
enabled: yes
# Temporarily lower threshold below 95%
# Tacked in https://github.com/jaegertracing/jaeger/issues/5194
target: 94.4%
target: 95%
patch:
default:
enabled: yes
Expand Down
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ updates:
otel-instrumentation:
patterns:
- "go.opentelemetry.io/contrib/instrumentation/*"
hashicorp:
patterns:
- "github.com/hashicorp/*"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/ci-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ jobs:
strategy:
matrix:
version:
- major: 5.x
image: 5.6.16
distribution: elasticsearch
- major: 6.x
image: 6.8.18
distribution: elasticsearch
- major: 7.x
image: 7.14.0
distribution: elasticsearch
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/ci-lint-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -30,11 +30,14 @@ jobs:
with:
go-version: 1.22.x

- name: Print Jaeger version
run: make echo-version

- name: Install tools
run: make install-test-tools

- name: Lint
run: make lint

- name: Ensure PR is not on main branch
uses: ./.github/actions/block-pr-not-on-main
uses: ./.github/actions/block-pr-not-on-main
4 changes: 4 additions & 0 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
go-version: 1.22.x
cache-dependency-path: ./go.sum

# download dependencies separately to keep unit test step's output cleaner
- name: go mod download
run: go mod download

- name: Install test deps
# even though the same target runs from test-ci, running it separately makes for cleaner log in GH workflow
run: make install-test-tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@5bbc3ba658137598168acb2ab73b21c432dd411b # v4.2.5
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 # v4.3.2
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ cover.html
vendor/
examples/hotrod/hotrod
examples/hotrod/hotrod-*
examples/memstore-plugin/memstore-plugin
cmd/all-in-one/all-in-one-*
cmd/agent/agent
cmd/agent/agent-*
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ IMPORT_LOG=.import.log
COLORIZE ?= | $(SED) 's/PASS/✅ PASS/g' | $(SED) 's/FAIL/❌ FAIL/g' | $(SED) 's/SKIP/🔕 SKIP/g'

GIT_SHA=$(shell git rev-parse HEAD)
GIT_CLOSEST_TAG=$(shell git describe --abbrev=0 --tags)
GIT_SHALLOW_CLONE := $(shell git rev-parse --is-shallow-repository)
# Some of GitHub Actions workflows do a shallow checkout without tags. This avoids logging warnings from git.
GIT_CLOSEST_TAG=$(shell if [ "$(GIT_SHALLOW_CLONE)" = "false" ]; then git describe --abbrev=0 --tags; else echo 0.0.0; fi)
ifneq ($(GIT_CLOSEST_TAG),$(shell echo ${GIT_CLOSEST_TAG} | grep -E "$(semver_regex)"))
$(warning GIT_CLOSEST_TAG=$(GIT_CLOSEST_TAG) is not in the semver format $(semver_regex))
endif
Expand All @@ -91,9 +93,15 @@ include Makefile.Crossdock.mk
.PHONY: test-and-lint
test-and-lint: test fmt lint

.PHONY: echo-version
echo-version:
@echo "GIT_CLOSEST_TAG=$(GIT_CLOSEST_TAG)"

.PHONY: echo-all-pkgs
echo-all-pkgs:
@echo $(ALL_PKGS) | tr ' ' '\n' | sort

.PHONY: echo-all-srcs
echo-all-srcs:
@echo $(ALL_SRC) | tr ' ' '\n' | sort

Expand Down Expand Up @@ -139,7 +147,6 @@ badger-storage-integration-test:

.PHONY: grpc-storage-integration-test
grpc-storage-integration-test:
(cd examples/memstore-plugin/ && go build .)
STORAGE=grpc $(MAKE) storage-integration-test

# this test assumes STORAGE environment variable is set to elasticsearch|opensearch
Expand Down Expand Up @@ -475,10 +482,6 @@ generate-mocks: install-tools
$(MOCKERY) --all --dir ./storage/spanstore/ --output ./storage/spanstore/mocks
$(MOCKERY) --all --dir ./proto-gen/storage_v1/ --output ./proto-gen/storage_v1/mocks

.PHONY: echo-version
echo-version:
@echo $(GIT_CLOSEST_TAG)

.PHONY: certs
certs:
cd pkg/config/tlscfg/testdata && ./gen-certs.sh
Expand Down
14 changes: 10 additions & 4 deletions cmd/agent/app/reporter/grpc/collector_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"io"
"net"
"sync"
"testing"
"time"

Expand All @@ -35,15 +36,13 @@ var _ io.Closer = (*ProxyBuilder)(nil)

func TestMultipleCollectors(t *testing.T) {
spanHandler1 := &mockSpanHandler{}
s1, addr1 := initializeGRPCTestServer(t, func(s *grpc.Server) {
_, addr1 := initializeGRPCTestServer(t, func(s *grpc.Server) {
api_v2.RegisterCollectorServiceServer(s, spanHandler1)
})
defer s1.Stop()
spanHandler2 := &mockSpanHandler{}
s2, addr2 := initializeGRPCTestServer(t, func(s *grpc.Server) {
_, addr2 := initializeGRPCTestServer(t, func(s *grpc.Server) {
api_v2.RegisterCollectorServiceServer(s, spanHandler2)
})
defer s2.Stop()

mFactory := metricstest.NewFactory(time.Microsecond)
defer mFactory.Stop()
Expand Down Expand Up @@ -79,8 +78,15 @@ func initializeGRPCTestServer(t *testing.T, beforeServe func(server *grpc.Server
lis, err := net.Listen("tcp", "localhost:0")
require.NoError(t, err)
beforeServe(server)
var wg sync.WaitGroup
wg.Add(1)
go func() {
require.NoError(t, server.Serve(lis))
wg.Done()
}()
t.Cleanup(func() {
server.Stop()
wg.Wait()
})
return server, lis.Addr()
}
8 changes: 0 additions & 8 deletions cmd/esmapping-generator/app/renderer/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ func Test_getMappingAsString(t *testing.T) {
name: "ES version 7", args: app.Options{Mapping: "jaeger-span", EsVersion: 7, Shards: 5, Replicas: 1, IndexPrefix: "test", UseILM: "true", ILMPolicyName: "jaeger-test-policy"},
want: "ES version 7",
},
{
name: "ES version 6", args: app.Options{Mapping: "jaeger-span", EsVersion: 6, Shards: 5, Replicas: 1, IndexPrefix: "test", UseILM: "false", ILMPolicyName: "jaeger-test-policy"},
want: "ES version 6",
},
{
name: "Parse Error version 6", args: app.Options{Mapping: "jaeger-span", EsVersion: 6, Shards: 5, Replicas: 1, IndexPrefix: "test", UseILM: "false", ILMPolicyName: "jaeger-test-policy"},
wantErr: errors.New("parse error"),
},
{
name: "Parse Error version 7", args: app.Options{Mapping: "jaeger-span", EsVersion: 7, Shards: 5, Replicas: 1, IndexPrefix: "test", UseILM: "true", ILMPolicyName: "jaeger-test-policy"},
wantErr: errors.New("parse error"),
Expand Down
6 changes: 4 additions & 2 deletions cmd/jaeger/config-remote-storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ extensions:
jaeger_storage:
grpc:
external-storage:
server: localhost:17271
connection-timeout: 5s
endpoint: localhost:17271
timeout: 5s
tls:
insecure: true

receivers:
otlp:
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/exporters/storageexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func createTracesExporter(ctx context.Context, set exporter.CreateSettings, conf
exporterhelper.WithCapabilities(consumer.Capabilities{MutatesData: false}),
// Disable Timeout/RetryOnFailure and SendingQueue
exporterhelper.WithTimeout(exporterhelper.TimeoutSettings{Timeout: 0}),
exporterhelper.WithRetry(configretry.NewDefaultBackOffConfig()),
exporterhelper.WithRetry(configretry.BackOffConfig{Enabled: false}),
exporterhelper.WithQueue(exporterhelper.QueueSettings{Enabled: false}),
exporterhelper.WithStart(ex.start),
exporterhelper.WithShutdown(ex.close),
Expand Down
4 changes: 2 additions & 2 deletions cmd/jaeger/internal/extension/jaegerquery/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (storageHost) GetExporters() map[component.DataType]map[component.ID]compon
func TestServerDependencies(t *testing.T) {
expectedDependencies := []component.ID{jaegerstorage.ID}
telemetrySettings := component.TelemetrySettings{
Logger: zaptest.NewLogger(t),
Logger: zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller())),
}

server := newServer(createDefaultConfig().(*Config), telemetrySettings)
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestServerStart(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
telemetrySettings := component.TelemetrySettings{
Logger: zaptest.NewLogger(t),
Logger: zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller())),
}
server := newServer(tt.config, telemetrySettings)
err := server.Start(context.Background(), host)
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerstorage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
type Config struct {
Memory map[string]memoryCfg.Configuration `mapstructure:"memory"`
Badger map[string]badgerCfg.NamespaceConfig `mapstructure:"badger"`
GRPC map[string]grpcCfg.Configuration `mapstructure:"grpc"`
GRPC map[string]grpcCfg.ConfigV2 `mapstructure:"grpc"`
Opensearch map[string]esCfg.Configuration `mapstructure:"opensearch"`
Elasticsearch map[string]esCfg.Configuration `mapstructure:"elasticsearch"`
Cassandra map[string]cassandra.Options `mapstructure:"cassandra"`
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerstorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (s *storageExt) Start(ctx context.Context, host component.Host) error {
cfg: s.config.Badger,
builder: badger.NewFactoryWithConfig,
}
grpcStarter := &starter[grpcCfg.Configuration, *grpc.Factory]{
grpcStarter := &starter[grpcCfg.ConfigV2, *grpc.Factory]{
ext: s,
storageKind: "grpc",
cfg: s.config.GRPC,
Expand Down
1 change: 0 additions & 1 deletion cmd/jaeger/internal/integration/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func TestBadgerStorage(t *testing.T) {
s := &E2EStorageIntegration{
ConfigFile: "../../config-badger.yaml",
StorageIntegration: integration.StorageIntegration{
SkipBinaryAttrs: true,
SkipArchiveTest: true,
CleanUp: purge,

Expand Down
1 change: 0 additions & 1 deletion cmd/jaeger/internal/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func TestCassandraStorage(t *testing.T) {
CleanUp: purge,
GetDependenciesReturnsSource: true,
SkipArchiveTest: true,
SkipBinaryAttrs: true,

SkipList: integration.CassandraSkippedTests,
},
Expand Down
10 changes: 5 additions & 5 deletions cmd/jaeger/internal/integration/e2e_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type E2EStorageIntegration struct {
// it also initialize the SpanWriter and SpanReader below.
// This function should be called before any of the tests start.
func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) {
logger := zaptest.NewLogger(t, zaptest.Level(zap.DebugLevel))
logger := zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller()))
configFile := createStorageCleanerConfig(t, s.ConfigFile, storage)
t.Logf("Starting Jaeger-v2 in the background with config file %s", configFile)

Expand Down Expand Up @@ -98,22 +98,22 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) {
// A Github Actions special annotation to create a foldable section
// in the Github runner output.
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
fmt.Println("::group::Jaeger-v2 binary logs")
fmt.Println("::group::🚧 🚧 🚧 Jaeger-v2 binary logs")
outLogs, err := os.ReadFile(outFile.Name())
require.NoError(t, err)
fmt.Printf("Jaeger-v2 output logs:\n%s", outLogs)
fmt.Printf("🚧 🚧 🚧 Jaeger-v2 output logs:\n%s", outLogs)

errLogs, err := os.ReadFile(errFile.Name())
require.NoError(t, err)
fmt.Printf("Jaeger-v2 error logs:\n%s", errLogs)
fmt.Printf("🚧 🚧 🚧 Jaeger-v2 error logs:\n%s", errLogs)
// End of Github Actions foldable section annotation.
fmt.Println("::endgroup::")
}
})

s.SpanWriter, err = createSpanWriter(logger, otlpPort)
require.NoError(t, err)
s.SpanReader, err = createSpanReader(ports.QueryGRPC)
s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC)
require.NoError(t, err)
}

Expand Down
1 change: 0 additions & 1 deletion cmd/jaeger/internal/integration/es_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func TestESStorage(t *testing.T) {
StorageIntegration: integration.StorageIntegration{
CleanUp: purge,
Fixtures: integration.LoadAndParseQueryTestCases(t, "fixtures/queries_es.json"),
SkipBinaryAttrs: true,
GetOperationsMissingSpanKind: true,
},
}
Expand Down
3 changes: 0 additions & 3 deletions cmd/jaeger/internal/integration/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ func TestGRPCStorage(t *testing.T) {
s := &GRPCStorageIntegration{
E2EStorageIntegration: E2EStorageIntegration{
ConfigFile: "../../config-remote-storage.yaml",
StorageIntegration: integration.StorageIntegration{
SkipBinaryAttrs: true,
},
},
}
s.CleanUp = s.cleanUp
Expand Down
1 change: 0 additions & 1 deletion cmd/jaeger/internal/integration/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func TestOSStorage(t *testing.T) {
StorageIntegration: integration.StorageIntegration{
CleanUp: purge,
Fixtures: integration.LoadAndParseQueryTestCases(t, "fixtures/queries_es.json"),
SkipBinaryAttrs: true,
GetOperationsMissingSpanKind: true,
},
}
Expand Down

0 comments on commit cf87b44

Please sign in to comment.