Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package adjuster

import (
"go.opentelemetry.io/collector/pdata/ptrace"
)

const (
warningMaxTraceSize = "trace reached the maxium allowed size"
)

// CorrectMaxSize returns an Adjuster that validates if a trace is in the allowed max size
//
// foo
//
// Parameters:
// - maxSize: The maximum allowable trace size.
func CorrectMaxSize(maxTraceSize int) Adjuster {
return Func(func(traces ptrace.Traces) {
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ import (

// StandardAdjusters returns a list of adjusters applied by the query service
// before returning the data to the API clients.
func StandardAdjusters(maxClockSkewAdjust time.Duration) []Adjuster {
func StandardAdjusters(
maxClockSkewAdjust time.Duration,
maxTraceSize int,
) []Adjuster {
return []Adjuster{
DeduplicateClientServerSpanIDs(),
SortCollections(),
// DeduplicateSpans depends on SortCollections running first
DeduplicateSpans(),
CorrectClockSkew(maxClockSkewAdjust),
CorrectMaxSize(maxTraceSize),
NormalizeIPAttributes(),
MoveLibraryAttributes(),
RemoveEmptySpanLinks(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (

func TestStandardAdjusters(t *testing.T) {
maxClockSkewAdjust := 10 * time.Second
adjusters := StandardAdjusters(maxClockSkewAdjust)
maxTraceSize := 10
adjusters := StandardAdjusters(maxClockSkewAdjust, maxTraceSize)

assert.Len(t, adjusters, 7, "Expected 7 adjusters")
assert.IsType(t, DeduplicateClientServerSpanIDs(), adjusters[0])
Expand Down
3 changes: 3 additions & 0 deletions cmd/jaeger/internal/extension/jaegerquery/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type QueryOptions struct {
Tenancy tenancy.Options `mapstructure:"multi_tenancy"`
// MaxClockSkewAdjust is the maximum duration by which jaeger-query will adjust a span.
MaxClockSkewAdjust time.Duration `mapstructure:"max_clock_skew_adjust" valid:"optional"`
// MaxTraceSize is the maximum trace size that jaeger-query could load.
MaxTraceSize int `mapstructure:"max_trace_size" valid:"optional"`
// EnableTracing determines whether traces will be emitted by jaeger-query.
EnableTracing bool `mapstructure:"enable_tracing"`
// HTTP holds the HTTP configuration that the query service uses to serve requests.
Expand All @@ -47,6 +49,7 @@ type QueryOptions struct {
func DefaultQueryOptions() QueryOptions {
return QueryOptions{
MaxClockSkewAdjust: 0, // disabled by default
MaxTraceSize: 0, // disabled by default
HTTP: confighttp.ServerConfig{
Endpoint: ports.PortToHostPort(ports.QueryHTTP),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019,2020 The Jaeger Authors.
// Copyright (cQueryOptions ) 2019,2020 The Jaeger Authors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright notice has been corrupted with (cQueryOptions ) instead of (c). This appears to be an accidental edit.

Should be:

// Copyright (c) 2019,2020 The Jaeger Authors.
Suggested change
// Copyright (cQueryOptions ) 2019,2020 The Jaeger Authors.
// Copyright (c) 2019,2020 The Jaeger Authors.

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

// SPDX-License-Identifier: Apache-2.0

package app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type QueryServiceOptions struct {
ArchiveTraceWriter tracestore.Writer
// MaxClockSkewAdjust is the maximum duration by which to adjust a span.
MaxClockSkewAdjust time.Duration
// MaxTraceSize is the maximum trace size that jaeger-query could load.
MaxTraceSize int
}

// StorageCapabilities is a feature flag for query service
Expand Down Expand Up @@ -74,7 +76,10 @@ func NewQueryService(
traceReader: traceReader,
dependencyReader: dependencyReader,
adjuster: adjuster.Sequence(
adjuster.StandardAdjusters(options.MaxClockSkewAdjust)...,
adjuster.StandardAdjusters(
options.MaxClockSkewAdjust,
options.MaxTraceSize,
)...,
),
options: options,
}
Expand Down
1 change: 1 addition & 0 deletions cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error {

opts := querysvc.QueryServiceOptions{
MaxClockSkewAdjust: s.config.MaxClockSkewAdjust,
MaxTraceSize: s.config.MaxTraceSize,
}
if err := s.addArchiveStorage(&opts, host); err != nil {
return err
Expand Down
Loading