Skip to content
Draft
28 changes: 25 additions & 3 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ core,dario.cat/mergo,BSD-3-Clause
core,github.com/Azure/go-ansiterm,MIT
core,github.com/BurntSushi/toml,MIT
core,github.com/DataDog/appsec-internal-go,Apache-2.0
core,github.com/DataDog/datadog-agent/comp/core/tagger/origindetection,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/config/model,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/config/remote,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/obfuscate,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/attributes,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/proto,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/remoteconfig/state,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/trace,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/util/backoff,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/util/cache,Apache-2.0
core,github.com/DataDog/datadog-agent/pkg/util/grpc,Apache-2.0
Expand All @@ -24,8 +27,11 @@ core,github.com/DataDog/datadog-operator/api/datadoghq/common,Unknown
core,github.com/DataDog/datadog-operator/api/datadoghq/v1alpha1,Unknown
core,github.com/DataDog/datadog-operator/api/datadoghq/v2alpha1,Unknown
core,github.com/DataDog/datadog-operator/api/utils,Unknown
core,github.com/DataDog/dd-trace-go/v2,Apache-2.0
core,github.com/DataDog/extendeddaemonset/api/v1alpha1,Apache-2.0
core,github.com/DataDog/go-libddwaf/v3,Apache-2.0
core,github.com/DataDog/go-libddwaf/v4,Apache-2.0
core,github.com/DataDog/go-runtime-metrics-internal/pkg/runtimemetrics,Apache-2.0
core,github.com/DataDog/go-sqllexer,MIT
core,github.com/DataDog/go-tuf,BSD-3-Clause
core,github.com/DataDog/gostackparse,Apache-2.0
Expand Down Expand Up @@ -68,6 +74,7 @@ core,github.com/beorn7/perks/quantile,MIT
core,github.com/blang/semver/v4,MIT
core,github.com/cenkalti/backoff,MIT
core,github.com/cenkalti/backoff/v4,MIT
core,github.com/cenkalti/backoff/v5,MIT
core,github.com/cespare/xxhash/v2,MIT
core,github.com/chai2010/gettext-go,BSD-3-Clause
core,github.com/cihub/seelog,BSD-3-Clause
Expand All @@ -79,6 +86,7 @@ core,github.com/cyphar/filepath-securejoin,BSD-3-Clause
core,github.com/davecgh/go-spew/spew,ISC
core,github.com/dsnet/compress,BSD-3-Clause
core,github.com/dustin/go-humanize,MIT
core,github.com/ebitengine/purego,Apache-2.0
core,github.com/emicklei/go-restful/v3,MIT
core,github.com/evanphx/json-patch,BSD-3-Clause
core,github.com/evanphx/json-patch/v5,BSD-3-Clause
Expand Down Expand Up @@ -122,20 +130,21 @@ core,github.com/gosuri/uitable,MIT
core,github.com/gosuri/uitable/util/wordwrap,MIT
core,github.com/gregjones/httpcache,MIT
core,github.com/grpc-ecosystem/go-grpc-middleware,Apache-2.0
core,github.com/grpc-ecosystem/grpc-gateway,BSD-3-Clause
core,github.com/grpc-ecosystem/grpc-gateway/v2,BSD-3-Clause
core,github.com/hako/durafmt,MIT
core,github.com/hashicorp/errwrap,MPL-2.0
core,github.com/hashicorp/go-cleanhttp,MPL-2.0
core,github.com/hashicorp/go-multierror,MPL-2.0
core,github.com/hashicorp/go-retryablehttp,MPL-2.0
core,github.com/hashicorp/go-version,MPL-2.0
core,github.com/hashicorp/hcl,MPL-2.0
core,github.com/huandu/xstrings,MIT
core,github.com/inconshreveable/mousetrap,Apache-2.0
core,github.com/jmoiron/sqlx,MIT
core,github.com/json-iterator/go,MIT
core,github.com/klauspost/compress,Apache-2.0
core,github.com/klauspost/compress/internal/snapref,BSD-3-Clause
core,github.com/klauspost/compress/s2,BSD-3-Clause
core,github.com/klauspost/compress/zstd/internal/xxhash,MIT
core,github.com/klauspost/pgzip,MIT
core,github.com/lann/builder,MIT
Expand All @@ -147,6 +156,7 @@ core,github.com/mattn/go-colorable,MIT
core,github.com/mattn/go-isatty,MIT
core,github.com/mattn/go-runewidth,MIT
core,github.com/mholt/archiver/v3,MIT
core,github.com/minio/simdjson-go,Apache-2.0
core,github.com/mitchellh/copystructure,MIT
core,github.com/mitchellh/go-wordwrap,MIT
core,github.com/mitchellh/hashstructure/v2,MIT
Expand All @@ -173,12 +183,14 @@ core,github.com/philhofer/fwd,MIT
core,github.com/pierrec/lz4/v4,BSD-3-Clause
core,github.com/pkg/browser,BSD-2-Clause
core,github.com/pkg/errors,BSD-2-Clause
core,github.com/planetscale/vtprotobuf/protohelpers,BSD-3-Clause
core,github.com/pmezard/go-difflib/difflib,BSD-3-Clause
core,github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil,BSD-3-Clause
core,github.com/prometheus/client_golang/prometheus,Apache-2.0
core,github.com/prometheus/client_model/go,Apache-2.0
core,github.com/prometheus/common,Apache-2.0
core,github.com/prometheus/procfs,Apache-2.0
core,github.com/puzpuzpuz/xsync/v3,Apache-2.0
core,github.com/richardartoul/molecule,MIT
core,github.com/richardartoul/molecule/src/codec,Apache-2.0
core,github.com/richardartoul/molecule/src/protowire,BSD-3-Clause
Expand All @@ -191,6 +203,7 @@ core,github.com/samber/lo,MIT
core,github.com/santhosh-tekuri/jsonschema/v6,Apache-2.0
core,github.com/secure-systems-lab/go-securesystemslib/cjson,MIT
core,github.com/shirou/gopsutil/v3,BSD-3-Clause
core,github.com/shirou/gopsutil/v4,BSD-3-Clause
core,github.com/shoenig/go-m1cpu,MPL-2.0
core,github.com/shopspring/decimal,MIT
core,github.com/sirupsen/logrus,MIT
Expand All @@ -205,16 +218,25 @@ core,github.com/stretchr/objx,MIT
core,github.com/stretchr/testify,MIT
core,github.com/tinylib/msgp/msgp,MIT
core,github.com/tklauser/go-sysconf,BSD-3-Clause
core,github.com/tklauser/numcpus,Apache-2.0
core,github.com/trailofbits/go-mutexasserts,MIT
core,github.com/ulikunitz/xz,BSD-3-Clause
core,github.com/x448/float16,MIT
core,github.com/xi2/xz,Unknown
core,github.com/xlab/treeprint,MIT
core,go.etcd.io/bbolt,MIT
core,go.opentelemetry.io/auto/sdk,Apache-2.0
core,go.opentelemetry.io/collector/component,Apache-2.0
core,go.opentelemetry.io/collector/featuregate,Apache-2.0
core,go.opentelemetry.io/collector/internal/telemetry,Apache-2.0
core,go.opentelemetry.io/collector/pdata,Apache-2.0
core,go.opentelemetry.io/collector/pdata/pprofile,Apache-2.0
core,go.opentelemetry.io/contrib/bridges/otelzap,Apache-2.0
core,go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp,Apache-2.0
core,go.opentelemetry.io/otel,Apache-2.0
core,go.opentelemetry.io/otel/exporters/otlp/otlptrace,Apache-2.0
core,go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc,Apache-2.0
core,go.opentelemetry.io/otel/log,Apache-2.0
core,go.opentelemetry.io/otel/metric,Apache-2.0
core,go.opentelemetry.io/otel/sdk,Apache-2.0
core,go.opentelemetry.io/otel/trace,Apache-2.0
Expand All @@ -225,7 +247,7 @@ core,go.uber.org/zap,MIT
core,go.yaml.in/yaml/v2,Apache-2.0
core,go.yaml.in/yaml/v3,MIT
core,golang.org/x/crypto,BSD-3-Clause
core,golang.org/x/exp/slices,BSD-3-Clause
core,golang.org/x/exp,BSD-3-Clause
core,golang.org/x/mod/semver,BSD-3-Clause
core,golang.org/x/net,BSD-3-Clause
core,golang.org/x/oauth2,BSD-3-Clause
Expand All @@ -239,12 +261,12 @@ core,golang.org/x/xerrors,BSD-3-Clause
core,gomodules.xyz/jsonpatch/v2,Apache-2.0
core,google.golang.org/genproto/googleapis/api,Apache-2.0
core,google.golang.org/genproto/googleapis/rpc,Apache-2.0
core,google.golang.org/genproto/protobuf/field_mask,Apache-2.0
core,google.golang.org/grpc,Apache-2.0
core,google.golang.org/protobuf,BSD-3-Clause
core,gopkg.in/DataDog/dd-trace-go.v1,Apache-2.0
core,gopkg.in/evanphx/json-patch.v4,BSD-3-Clause
core,gopkg.in/inf.v0,BSD-3-Clause
core,gopkg.in/ini.v1,Apache-2.0
core,gopkg.in/yaml.v2,Apache-2.0
core,gopkg.in/yaml.v3,MIT
core,helm.sh/helm/v3,Apache-2.0
Expand Down
19 changes: 12 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
"sync/atomic"
"time"

"github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
"github.com/DataDog/dd-trace-go/v2/profiler"
edsdatadoghqv1alpha1 "github.com/DataDog/extendeddaemonset/api/v1alpha1"
"github.com/go-logr/logr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/DataDog/dd-trace-go/v2/ddtrace/tracer"
"gopkg.in/DataDog/dd-trace-go.v1/profiler"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -154,8 +154,8 @@ func (opts *options) Parse() {
// Observability flags
flag.StringVar(&opts.metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.BoolVar(&opts.secureMetrics, "metrics-secure", false, "If true, the metrics endpoint is served securely via HTTPS. Use false to use HTTP instead.")
flag.BoolVar(&opts.profilingEnabled, "profiling-enabled", false, "Enable Datadog profile in the Datadog Operator process.")
flag.BoolVar(&opts.tracingEnabled, "tracing-enabled", false, "Enable Datadog APM tracing in the Datadog Operator process.")
flag.BoolVar(&opts.profilingEnabled, "profiling-enabled", os.Getenv("DD_OPERATOR_PROFILING_ENABLED") == "true", "Enable Datadog profiling in the Datadog Operator process.")
flag.BoolVar(&opts.tracingEnabled, "tracing-enabled", os.Getenv("DD_OPERATOR_TRACING_ENABLED") == "true", "Enable Datadog APM tracing in the Datadog Operator process.")
opts.logLevel = zap.LevelFlag("loglevel", zapcore.InfoLevel, "Set log level")
flag.StringVar(&opts.logEncoder, "logEncoder", "json", "log encoding ('json' or 'console')")
flag.BoolVar(&opts.printVersion, "version", false, "Print version and exit")
Expand Down Expand Up @@ -256,11 +256,16 @@ func run(opts *options) error {

if opts.tracingEnabled {
setupLog.Info("Starting datadog APM tracer")
tracer.Start(
if err := tracer.Start(
tracer.WithService("datadog-operator"),
tracer.WithServiceVersion(version.Version),
)
defer tracer.Stop()
tracer.WithGlobalTag("git.repository_url", "https://github.com/DataDog/datadog-operator"),
); err != nil {
setupLog.Error(err, "Failed to start datadog APM tracer, continuing without tracing")
opts.tracingEnabled = false
} else {
defer tracer.Stop()
}
}

// Dispatch CLI flags to each package
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.1
gopkg.in/DataDog/dd-trace-go.v1 v1.68.0
gopkg.in/DataDog/dd-trace-go.v1 v1.68.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.35.1
Expand Down
Loading
Loading