Skip to content

Commit

Permalink
fix: bring back content-type header (#4123)
Browse files Browse the repository at this point in the history
* fix: bring back content-type header

* init combiner in the proper place

(cherry picked from commit 6afedd9)
  • Loading branch information
javiermolinar authored and joe-elliott committed Oct 15, 2024
1 parent ee47a3f commit 47c35ed
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## main / unreleased

* [ENHANCEMENT] Speedup collection of results from ingesters in the querier [#4100](https://github.com/grafana/tempo/pull/4100) (@electron0zero)
* [ENHANCEMENT] Speedup DistinctValue collector and exit early for ingesters [#4104](https://github.com/grafana/tempo/pull/4104) (@electron0zero)
* [ENHANCEMENT] Add disk caching in ingester SearchTagValuesV2 for completed blocks [#4069](https://github.com/grafana/tempo/pull/4069) (@electron0zero)
* [BUGFIX] Replace hedged requests roundtrips total with a counter. [#4063](https://github.com/grafana/tempo/pull/4063) [#4078](https://github.com/grafana/tempo/pull/4078) (@galalen)
* [BUGFIX] Metrics generators: Correctly drop from the ring before stopping ingestion to reduce drops during a rollout. [#4101](https://github.com/grafana/tempo/pull/4101) (@joe-elliott)
* [BUGFIX] Bring back application-json content-type header. [#4121](https://github.com/grafana/tempo/pull/4121) (@javiermolinar)
* [CHANGE] TraceByID: don't allow concurrent_shards greater than query_shards. [#4074](https://github.com/grafana/tempo/pull/4074) (@electron0zero)
* **BREAKING CHANGE** tempo-query is no longer a jaeger instance with grpcPlugin. Its now a standalone server. Serving a grpc api for jaeger on `0.0.0.0:7777` by default. [#3840](https://github.com/grafana/tempo/issues/3840) (@frzifus)
* [CHANGE] **BREAKING CHANGE** The dynamic injection of X-Scope-OrgID header for metrics generator remote-writes is changed. If the header is aleady set in per-tenant overrides or global tempo configuration, then it is honored and not overwritten. [#4021](https://github.com/grafana/tempo/pull/4021) (@mdisibio)
* [CHANGE] **BREAKING CHANGE** Migrate from OpenTracing to OpenTelemetry instrumentation. Removed the `use_otel_tracer` configuration option. Use the OpenTelemetry environment variables to configure the span exporter [#3646](https://github.com/grafana/tempo/pull/3646) (@andreasgerstmayr)
To continue using the Jaeger exporter, use the following environment variable: `OTEL_TRACES_EXPORTER=jaeger`.
* [CHANGE] No longer send the final diff in GRPC streaming. Instead we rely on the streamed intermediate results. [#4062](https://github.com/grafana/tempo/pull/4062) (@joe-elliott)
* [FEATURE] Discarded span logging `log_discarded_spans` [#3957](https://github.com/grafana/tempo/issues/3957) (@dastrobu)
* [FEATURE] TraceQL support for instrumentation scope [#3967](https://github.com/grafana/tempo/pull/3967) (@ie-pham)
* [ENHANCEMENT] Add bytes and spans received to usage stats [#3983](https://github.com/grafana/tempo/pull/3983) (@joe-elliott)

Expand Down
12 changes: 8 additions & 4 deletions modules/frontend/combiner/metrics_query_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"
"strings"

"github.com/grafana/tempo/pkg/api"
"github.com/grafana/tempo/pkg/tempopb"
"github.com/grafana/tempo/pkg/traceql"
)
Expand All @@ -17,11 +18,11 @@ func NewQueryRange(req *tempopb.QueryRangeRequest, trackDiffs bool) (Combiner, e
return nil, err
}

return &genericCombiner[*tempopb.QueryRangeResponse]{
c := &genericCombiner[*tempopb.QueryRangeResponse]{
httpStatusCode: 200,
new: func() *tempopb.QueryRangeResponse { return &tempopb.QueryRangeResponse{} },
current: &tempopb.QueryRangeResponse{Metrics: &tempopb.SearchMetrics{}},
combine: func(partial *tempopb.QueryRangeResponse, _ *tempopb.QueryRangeResponse, resp PipelineResponse) error {
combine: func(partial *tempopb.QueryRangeResponse, _ *tempopb.QueryRangeResponse, _ PipelineResponse) error {
if partial.Metrics != nil {
// this is a coordination between the sharder and combiner. the sharder returns one response with summary metrics
// only. the combiner correctly takes and accumulates that job. however, if the response has no jobs this is
Expand Down Expand Up @@ -51,15 +52,18 @@ func NewQueryRange(req *tempopb.QueryRangeRequest, trackDiffs bool) (Combiner, e
sortResponse(resp)
return resp, nil
},
}, nil
}

initHTTPCombiner(c, api.HeaderAcceptJSON)

return c, nil
}

func NewTypedQueryRange(req *tempopb.QueryRangeRequest, trackDiffs bool) (GRPCCombiner[*tempopb.QueryRangeResponse], error) {
c, err := NewQueryRange(req, trackDiffs)
if err != nil {
return nil, err
}

return c.(GRPCCombiner[*tempopb.QueryRangeResponse]), nil
}

Expand Down
5 changes: 4 additions & 1 deletion modules/frontend/combiner/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package combiner
import (
"sort"

"github.com/grafana/tempo/pkg/api"
"github.com/grafana/tempo/pkg/search"
"github.com/grafana/tempo/pkg/tempopb"
"github.com/grafana/tempo/pkg/traceql"
Expand All @@ -15,7 +16,7 @@ func NewSearch(limit int) Combiner {
metadataCombiner := traceql.NewMetadataCombiner()
diffTraces := map[string]struct{}{}

return &genericCombiner[*tempopb.SearchResponse]{
c := &genericCombiner[*tempopb.SearchResponse]{
httpStatusCode: 200,
new: func() *tempopb.SearchResponse { return &tempopb.SearchResponse{} },
current: &tempopb.SearchResponse{Metrics: &tempopb.SearchMetrics{}},
Expand Down Expand Up @@ -96,6 +97,8 @@ func NewSearch(limit int) Combiner {
return metadataCombiner.Count() >= limit
},
}
initHTTPCombiner(c, api.HeaderAcceptJSON)
return c
}

func addRootSpanNotReceivedText(results []*tempopb.TraceSearchMetadata) {
Expand Down
9 changes: 7 additions & 2 deletions modules/frontend/combiner/search_tag_values.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package combiner

import (
"github.com/grafana/tempo/pkg/api"
"github.com/grafana/tempo/pkg/collector"
"github.com/grafana/tempo/pkg/tempopb"
)
Expand All @@ -14,7 +15,7 @@ func NewSearchTagValues(limitBytes int) Combiner {
// Distinct collector with no limit
d := collector.NewDistinctString(limitBytes)

return &genericCombiner[*tempopb.SearchTagValuesResponse]{
c := &genericCombiner[*tempopb.SearchTagValuesResponse]{
httpStatusCode: 200,
new: func() *tempopb.SearchTagValuesResponse { return &tempopb.SearchTagValuesResponse{} },
current: &tempopb.SearchTagValuesResponse{TagValues: make([]string, 0)},
Expand All @@ -36,6 +37,8 @@ func NewSearchTagValues(limitBytes int) Combiner {
return response, nil
},
}
initHTTPCombiner(c, api.HeaderAcceptJSON)
return c
}

func NewTypedSearchTagValues(limitBytes int) GRPCCombiner[*tempopb.SearchTagValuesResponse] {
Expand All @@ -46,7 +49,7 @@ func NewSearchTagValuesV2(limitBytes int) Combiner {
// Distinct collector with no limit
d := collector.NewDistinctValue(limitBytes, func(tv tempopb.TagValue) int { return len(tv.Type) + len(tv.Value) })

return &genericCombiner[*tempopb.SearchTagValuesV2Response]{
c := &genericCombiner[*tempopb.SearchTagValuesV2Response]{
httpStatusCode: 200,
current: &tempopb.SearchTagValuesV2Response{TagValues: []*tempopb.TagValue{}},
new: func() *tempopb.SearchTagValuesV2Response { return &tempopb.SearchTagValuesV2Response{} },
Expand Down Expand Up @@ -78,6 +81,8 @@ func NewSearchTagValuesV2(limitBytes int) Combiner {
return response, nil
},
}
initHTTPCombiner(c, api.HeaderAcceptJSON)
return c
}

func NewTypedSearchTagValuesV2(limitBytes int) GRPCCombiner[*tempopb.SearchTagValuesV2Response] {
Expand Down
9 changes: 7 additions & 2 deletions modules/frontend/combiner/search_tags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package combiner

import (
"github.com/grafana/tempo/pkg/api"
"github.com/grafana/tempo/pkg/collector"
"github.com/grafana/tempo/pkg/tempopb"
)
Expand All @@ -13,7 +14,7 @@ var (
func NewSearchTags(limitBytes int) Combiner {
d := collector.NewDistinctString(limitBytes)

return &genericCombiner[*tempopb.SearchTagsResponse]{
c := &genericCombiner[*tempopb.SearchTagsResponse]{
httpStatusCode: 200,
new: func() *tempopb.SearchTagsResponse { return &tempopb.SearchTagsResponse{} },
current: &tempopb.SearchTagsResponse{TagNames: make([]string, 0)},
Expand All @@ -35,6 +36,8 @@ func NewSearchTags(limitBytes int) Combiner {
return response, nil
},
}
initHTTPCombiner(c, api.HeaderAcceptJSON)
return c
}

func NewTypedSearchTags(limitBytes int) GRPCCombiner[*tempopb.SearchTagsResponse] {
Expand All @@ -45,7 +48,7 @@ func NewSearchTagsV2(limitBytes int) Combiner {
// Distinct collector map to collect scopes and scope values
distinctValues := collector.NewScopedDistinctString(limitBytes)

return &genericCombiner[*tempopb.SearchTagsV2Response]{
c := &genericCombiner[*tempopb.SearchTagsV2Response]{
httpStatusCode: 200,
new: func() *tempopb.SearchTagsV2Response { return &tempopb.SearchTagsV2Response{} },
current: &tempopb.SearchTagsV2Response{Scopes: make([]*tempopb.SearchTagsV2Scope, 0)},
Expand Down Expand Up @@ -86,6 +89,8 @@ func NewSearchTagsV2(limitBytes int) Combiner {
return response, nil
},
}
initHTTPCombiner(c, api.HeaderAcceptJSON)
return c
}

func NewTypedSearchTagsV2(limitBytes int) GRPCCombiner[*tempopb.SearchTagsV2Response] {
Expand Down

0 comments on commit 47c35ed

Please sign in to comment.