Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'features' command to beautify and print feature gates #6542

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ generate-mocks: $(MOCKERY)
certs:
cd pkg/config/tlscfg/testdata && ./gen-certs.sh

.PHONY: features
Copy link
Member

Choose a reason for hiding this comment

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

Don't need this

features:
go run ./cmd/jaeger/features

.PHONY: certs-dryrun
certs-dryrun:
cd pkg/config/tlscfg/testdata && ./gen-certs.sh -d
Expand Down
48 changes: 48 additions & 0 deletions cmd/jaeger/features/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2023 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

package main
Copy link
Member

Choose a reason for hiding this comment

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

The requirement is to make it a sub command of jaeger binary, not a standalone binary.


import (
"fmt"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/provider/envprovider"
"go.opentelemetry.io/collector/confmap/provider/fileprovider"
"go.opentelemetry.io/collector/confmap/provider/httpprovider"
"go.opentelemetry.io/collector/confmap/provider/httpsprovider"
"go.opentelemetry.io/collector/confmap/provider/yamlprovider"
"go.opentelemetry.io/collector/otelcol"

"github.com/jaegertracing/jaeger/cmd/jaeger/internal"
"github.com/jaegertracing/jaeger/pkg/version"
)

func main() {
info := component.BuildInfo{
Command: "jaeger",
Description: internal.GetDescription(),
Version: version.Get().GitVersion,
}

settings := otelcol.CollectorSettings{
BuildInfo: info,
Factories: internal.Components,
ConfigProviderSettings: otelcol.ConfigProviderSettings{
ResolverSettings: confmap.ResolverSettings{
ProviderFactories: []confmap.ProviderFactory{
envprovider.NewFactory(),
fileprovider.NewFactory(),
httpprovider.NewFactory(),
httpsprovider.NewFactory(),
yamlprovider.NewFactory(),
},
},
},
}

fmt.Println("\n" + internal.GetDescription())
fmt.Println("List of feature gate identifiers. Prefix with '-' to disable the feature. '+' or no prefix will enable the feature.\n ")
otelcol.FeatureCommand(settings)

Check failure on line 47 in cmd/jaeger/features/main.go

View workflow job for this annotation

GitHub Actions / lint

undefined: otelcol.FeatureCommand (typecheck)

Check failure on line 47 in cmd/jaeger/features/main.go

View workflow job for this annotation

GitHub Actions / unit-tests

undefined: otelcol.FeatureCommand
}
4 changes: 4 additions & 0 deletions cmd/jaeger/internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ var yamlAllInOne embed.FS

const description = "Jaeger backend v2"

func GetDescription() string {
return description
}

func Command() *cobra.Command {
info := component.BuildInfo{
Command: "jaeger",
Expand Down
Loading