Skip to content

Commit

Permalink
Merge pull request #119 from intergral/dskit
Browse files Browse the repository at this point in the history
chore(dskit): update grafana/dskit
  • Loading branch information
Umaaz authored Jan 13, 2025
2 parents 39c03fc + af352a0 commit 2e42471
Show file tree
Hide file tree
Showing 73 changed files with 538 additions and 618 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.20
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.23.x

- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -50,10 +49,9 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.23.x

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -72,10 +70,9 @@ jobs:
name: Vendor check
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.23.x

- name: Check out code
uses: actions/checkout@v4
Expand All @@ -87,10 +84,9 @@ jobs:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.23.x

- name: Check out code
uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<!-- 1.0.9 START -->
# 1.0.9 (18/04/2024)
- **[FEATURE]**: add support for ipv6 [#119](https://github.com/intergral/deep/pull/119) [@Umaaz](https://github.com/Umaaz)
<!-- 1.0.9 END -->

<!-- 1.0.8 START -->
# 1.0.8 (23/04/2024)
- **[BUGFIX]**: fix deepql running in distributed mode [#95](https://github.com/intergral/deep/pull/95) [@Umaaz](https://github.com/Umaaz)
<!-- 1.0.8 START -->
<!-- 1.0.8 END -->

<!-- 1.0.7 START -->
# 1.0.7 (18/04/2024)
Expand Down
9 changes: 5 additions & 4 deletions cmd/deep-cli/cmd-list-column.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

"github.com/intergral/deep/pkg/deepdb/encoding/vparquet"
pq "github.com/intergral/deep/pkg/parquetquery"
"github.com/segmentio/parquet-go"
"github.com/parquet-go/parquet-go"
)

type listColumnCmd struct {
Expand Down Expand Up @@ -64,9 +64,10 @@ func (cmd *listColumnCmd) Run(ctx *globalOptions) error {
fmt.Printf("\n*************** rowgroup %d ********************\n\n\n", i)

pages := cc.Pages()
numPages := cc.ColumnIndex().NumPages()
fmt.Println("Min Value of rowgroup", cc.ColumnIndex().MinValue(0).Bytes())
fmt.Println("Max Value of rowgroup", cc.ColumnIndex().MaxValue(numPages-1).Bytes())
ci, _ := cc.ColumnIndex()
numPages := ci.NumPages()
fmt.Println("Min Value of rowgroup", ci.MinValue(0).Bytes())
fmt.Println("Max Value of rowgroup", ci.MaxValue(numPages-1).Bytes())

buffer := make([]parquet.Value, 10000)
for {
Expand Down
2 changes: 1 addition & 1 deletion cmd/deep-cli/cmdListObjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/google/uuid"
"github.com/intergral/deep/pkg/deepdb/encoding/vparquet"
"github.com/olekukonko/tablewriter"
"github.com/segmentio/parquet-go"
"github.com/parquet-go/parquet-go"
)

type listObjectsCmd struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/deep/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ import (
"github.com/gorilla/mux"
"github.com/grafana/dskit/grpcutil"
"github.com/grafana/dskit/kv/memberlist"
"github.com/grafana/dskit/middleware"
"github.com/grafana/dskit/modules"
"github.com/grafana/dskit/ring"
"github.com/grafana/dskit/server"
"github.com/grafana/dskit/services"
"github.com/grafana/dskit/signals"
frontend_v1 "github.com/intergral/deep/modules/frontend/v1"
"github.com/intergral/deep/modules/generator"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/version"
"github.com/weaveworks/common/middleware"
"github.com/weaveworks/common/server"
"github.com/weaveworks/common/signals"
"google.golang.org/grpc"
"google.golang.org/grpc/health/grpc_health_v1"
"gopkg.in/yaml.v3"
Expand Down
4 changes: 2 additions & 2 deletions cmd/deep/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/kv/memberlist"

"github.com/grafana/dskit/server"
generator_client "github.com/intergral/deep/modules/generator/client"
ingester_client "github.com/intergral/deep/modules/ingester/client"
"github.com/intergral/deep/modules/storage"
internalserver "github.com/intergral/deep/pkg/server"
"github.com/prometheus/client_golang/prometheus"
"github.com/weaveworks/common/server"
)

// Config is the root config for App.
Expand Down Expand Up @@ -97,7 +97,7 @@ func (c *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) {
flagext.DefaultValues(&c.InternalServer)

// Increase max message size to 16MB
c.Server.GPRCServerMaxRecvMsgSize = 16 * 1024 * 1024
c.Server.GRPCServerMaxRecvMsgSize = 16 * 1024 * 1024
c.Server.GRPCServerMaxSendMsgSize = 16 * 1024 * 1024

// The following GRPC server settings are added to address this issue - https://github.com/intergral/deep/issues/493
Expand Down
2 changes: 1 addition & 1 deletion cmd/deep/app/fake_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"context"
"net/http"

"github.com/grafana/dskit/middleware"
"github.com/intergral/deep/pkg/util"
"github.com/weaveworks/common/middleware"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/deep/app/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package app
import (
"net/http"

"github.com/grafana/dskit/middleware"
"github.com/klauspost/compress/gzhttp"
"github.com/weaveworks/common/middleware"
)

func httpGzipMiddleware() middleware.Interface {
Expand Down
5 changes: 2 additions & 3 deletions cmd/deep/app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import (
"github.com/grafana/dskit/dns"
"github.com/grafana/dskit/kv/codec"
"github.com/grafana/dskit/kv/memberlist"
"github.com/grafana/dskit/middleware"
"github.com/grafana/dskit/modules"
"github.com/grafana/dskit/ring"
"github.com/grafana/dskit/server"
"github.com/grafana/dskit/services"
"github.com/intergral/deep/modules/compactor"
"github.com/intergral/deep/modules/distributor"
Expand Down Expand Up @@ -56,8 +58,6 @@ import (
jsoniter "github.com/json-iterator/go"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/weaveworks/common/middleware"
"github.com/weaveworks/common/server"
)

// The various modules that make up deep.
Expand Down Expand Up @@ -450,7 +450,6 @@ func (t *App) initStore() (services.Service, error) {

func (t *App) initMemberListKV() (services.Service, error) {
reg := prometheus.DefaultRegisterer
t.cfg.MemberlistKV.MetricsRegisterer = reg
t.cfg.MemberlistKV.MetricsNamespace = metricsNamespace
t.cfg.MemberlistKV.Codecs = []codec.Codec{
ring.GetCodec(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/deep/app/server_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"fmt"

"github.com/go-kit/log/level"
"github.com/grafana/dskit/server"
"github.com/grafana/dskit/services"
"github.com/weaveworks/common/server"

util_log "github.com/intergral/deep/pkg/util/log"
)
Expand Down
55 changes: 14 additions & 41 deletions cmd/deep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,25 @@ import (
"runtime"
"time"

"github.com/grafana/dskit/tracing"
"github.com/prometheus/common/version"

"github.com/drone/envsubst"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/flagext"
dslog "github.com/grafana/dskit/log"
"github.com/grafana/dskit/spanprofiler"
"github.com/intergral/deep/cmd/deep/app"
"github.com/intergral/deep/cmd/deep/build"
"github.com/intergral/deep/pkg/util/log"
ot "github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/version"
"github.com/weaveworks/common/logging"
"github.com/weaveworks/common/tracing"
oc "go.opencensus.io/trace"
ver "github.com/prometheus/client_golang/prometheus/collectors/version"
"go.opentelemetry.io/contrib/exporters/autoexport"
"go.opentelemetry.io/otel"
oc_bridge "go.opentelemetry.io/otel/bridge/opencensus"
ot_bridge "go.opentelemetry.io/otel/bridge/opentracing"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
Expand All @@ -65,7 +67,7 @@ func init() {
version.Version = Version
version.Branch = Branch
version.Revision = Revision
prometheus.MustRegister(version.NewCollector(appName))
prometheus.MustRegister(ver.NewCollector(appName))
}

// main entry to DEEP
Expand All @@ -85,7 +87,7 @@ func main() {
}

// Init the logger which will honor the log level set in config.Server
if reflect.DeepEqual(&config.Server.LogLevel, &logging.Level{}) {
if reflect.DeepEqual(&config.Server.LogLevel, &dslog.Level{}) {
level.Error(log.Logger).Log("msg", "invalid log level")
os.Exit(1)
}
Expand Down Expand Up @@ -253,12 +255,9 @@ func installOpenTracingTracer(config *app.Config) (func(), error) {
func installOpenTelemetryTracer(config *app.Config) (func(), error) {
level.Info(log.Logger).Log("msg", "initialising OpenTelemetry tracer")

// for now, migrate OpenTracing Jaeger environment variables
migrateJaegerEnvironmentVariables()

exp, err := jaeger.New(jaeger.WithCollectorEndpoint())
exp, err := autoexport.NewSpanExporter(context.Background())
if err != nil {
return nil, errors.Wrap(err, "failed to create Jaeger exporter")
return nil, fmt.Errorf("failed to create OTEL exporter: %w", err)
}

resources, err := resource.New(context.Background(),
Expand All @@ -269,7 +268,7 @@ func installOpenTelemetryTracer(config *app.Config) (func(), error) {
resource.WithHost(),
)
if err != nil {
return nil, errors.Wrap(err, "failed to initialise trace resources")
return nil, fmt.Errorf("failed to initialise trace resources: %w", err)
}

tp := tracesdk.NewTracerProvider(
Expand Down Expand Up @@ -300,40 +299,14 @@ func installOpenTelemetryTracer(config *app.Config) (func(), error) {
bridgeTracer.SetWarningHandler(func(msg string) {
level.Warn(log.Logger).Log("msg", msg, "source", "BridgeTracer.OnWarningHandler")
})
ot.SetGlobalTracer(bridgeTracer)
ot.SetGlobalTracer(spanprofiler.NewTracer(bridgeTracer))

// Install the OpenCensus bridge
oc.DefaultTracer = oc_bridge.NewTracer(tp.Tracer("OpenCensus"))
oc_bridge.InstallTraceBridge(oc_bridge.WithTracerProvider(tp))

return shutdown, nil
}

func migrateJaegerEnvironmentVariables() {
// jaeger-tracing-go: https://github.com/jaegertracing/jaeger-client-go#environment-variables
// opentelemetry-go: https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger#environment-variables
jaegerToOtel := map[string]string{
"JAEGER_AGENT_HOST": "OTEL_EXPORTER_JAEGER_AGENT_HOST",
"JAEGER_AGENT_PORT": "OTEL_EXPORTER_JAEGER_AGENT_PORT",
"JAEGER_ENDPOINT": "OTEL_EXPORTER_JAEGER_ENDPOINT",
"JAEGER_USER": "OTEL_EXPORTER_JAEGER_USER",
"JAEGER_PASSWORD": "OTEL_EXPORTER_JAEGER_PASSWORD",
"JAEGER_TAGS": "OTEL_RESOURCE_ATTRIBUTES",
}
for jaegerKey, otelKey := range jaegerToOtel {
value, jaegerOk := os.LookupEnv(jaegerKey)
_, otelOk := os.LookupEnv(otelKey)

if jaegerOk && !otelOk {
level.Warn(log.Logger).Log("msg", "migrating Jaeger environment variable, consider using native OpenTelemetry variables", "jaeger", jaegerKey, "otel", otelKey)
_ = os.Setenv(otelKey, value)
}
}

if _, ok := os.LookupEnv("JAEGER_SAMPLER_TYPE"); ok {
level.Warn(log.Logger).Log("msg", "JAEGER_SAMPLER_TYPE is not supported with the OpenTelemetry tracer, no sampling will be performed")
}
}

type otelErrorHandlerFunc func(error)

// Handle implements otel.ErrorHandler
Expand Down
Loading

0 comments on commit 2e42471

Please sign in to comment.