Skip to content

Commit

Permalink
chore: add experimental modules (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
kolesnikovae authored Aug 14, 2024
1 parent b16b27a commit 04923f5
Show file tree
Hide file tree
Showing 16 changed files with 468 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2227,6 +2234,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2320,6 +2334,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2413,6 +2434,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2807,6 +2835,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2908,6 +2943,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -3005,6 +3047,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down
63 changes: 63 additions & 0 deletions operations/pyroscope/helm/pyroscope/rendered/micro-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2373,6 +2380,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2467,6 +2481,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2561,6 +2582,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2655,6 +2683,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -2749,6 +2784,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -3028,6 +3070,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -3129,6 +3178,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down Expand Up @@ -3226,6 +3282,13 @@ spec:
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
- "-store-gateway.sharding-ring.replication-factor=3"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,13 @@ spec:
- "-config.file=/etc/pyroscope/config.yaml"
- "-runtime-config.file=/etc/pyroscope/overrides/overrides.yaml"
- "-log.level=debug"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "default.svc.cluster.local."
ports:
- name: http2
containerPort: 4040
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ spec:
{{- range $key, $value := $extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
{{- with $values.extraEnvVars }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE_FQDN
value: "{{ .Release.Namespace }}.svc{{ .Values.pyroscope.cluster_domain }}"
{{- with $values.extraEnvVars }}
{{- range $key, $value := . }}
- name: {{ $key }}
{{- if kindIs "map" $value }}
Expand Down
9 changes: 9 additions & 0 deletions operations/pyroscope/helm/pyroscope/templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
targetPort: {{ $values.service.port_name }}
protocol: TCP
name: {{ $values.service.port_name }}
{{- with $values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{- include "pyroscope.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component | quote }}
Expand All @@ -45,6 +48,12 @@ spec:
targetPort: {{ $values.service.port_name }}
protocol: TCP
name: {{ $values.service.port_name }}
{{- with $values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $values.service.publishNotReadyAddresses }}
publishNotReadyAddresses: true
{{- end }}
selector:
{{- include "pyroscope.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component | quote }}
Expand Down
14 changes: 14 additions & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import (
"github.com/grafana/dskit/server"
grpcgw "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"

compactorv1 "github.com/grafana/pyroscope/api/gen/proto/go/compactor/v1"
metastorev1 "github.com/grafana/pyroscope/api/gen/proto/go/metastore/v1"
querybackendv1 "github.com/grafana/pyroscope/api/gen/proto/go/querybackend/v1"
"github.com/grafana/pyroscope/pkg/experiment/metastore"
"github.com/grafana/pyroscope/pkg/experiment/querybackend"
"github.com/grafana/pyroscope/public"

"github.com/grafana/pyroscope/api/gen/proto/go/adhocprofiles/v1/adhocprofilesv1connect"
Expand Down Expand Up @@ -320,6 +325,15 @@ func (a *API) RegisterAdHocProfiles(ahp *adhocprofiles.AdHocProfiles) {
adhocprofilesv1connect.RegisterAdHocProfileServiceHandler(a.server.HTTP, ahp, a.connectOptionsAuthRecovery()...)
}

func (a *API) RegisterMetastore(svc *metastore.Metastore) {
metastorev1.RegisterMetastoreServiceServer(a.server.GRPC, svc)
compactorv1.RegisterCompactionPlannerServer(a.server.GRPC, svc)
}

func (a *API) RegisterQueryBackend(svc *querybackend.QueryBackend) {
querybackendv1.RegisterQueryBackendServiceServer(a.server.GRPC, svc)
}

func (a *API) connectOptionsRecovery() []connect.HandlerOption {
return append(connectapi.DefaultHandlerOptions(), a.recoveryMiddleware)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/experiment/compactor/compaction_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ type Config struct {
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
const prefix = "compaction-worker."
tempdir := filepath.Join(os.TempDir(), "pyroscope-compactor")
f.IntVar(&cfg.JobCapacity, prefix+"job-capacity", 3, "how many concurrent jobs will a worker run at most")
f.IntVar(&cfg.SmallObjectSize, prefix+"small-object-size-bytes", 8<<20, "size of the object that can be loaded in memory")
f.StringVar(&cfg.TempDir, prefix+"temp-dir", tempdir, "temporary directory for compaction jobs")
f.IntVar(&cfg.JobCapacity, prefix+"job-capacity", 3, "How many concurrent jobs will a worker run at most.")
f.IntVar(&cfg.SmallObjectSize, prefix+"small-object-size-bytes", 8<<20, "Size of the object that can be loaded in memory.")
f.StringVar(&cfg.TempDir, prefix+"temp-dir", tempdir, "Temporary directory for compaction jobs.")
}

func New(config Config, logger log.Logger, metastoreClient *metastoreclient.Client, storage objstore.Bucket, reg prometheus.Registerer) (*Worker, error) {
Expand Down
9 changes: 9 additions & 0 deletions pkg/experiment/ingester/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto/rand"
"encoding/json"
"flag"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -39,6 +40,14 @@ const pathSegments = "segments"
const pathAnon = tenant.DefaultTenantID
const pathBlock = "block.bin"

type Config struct{}

func (cfg *Config) RegisterFlags(f *flag.FlagSet) {}

type SegmentWriter struct {
// TODO: Implement
}

type shardKey uint32

type segmentsWriter struct {
Expand Down
Loading

0 comments on commit 04923f5

Please sign in to comment.