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

drop stackdriver exporter support #11659

Merged
merged 2 commits into from
Jul 13, 2021
Merged
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
18 changes: 8 additions & 10 deletions cmd/queue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ type config struct {
MetricsCollectorAddress string `split_words:"true"` // optional

// Tracing configuration
TracingConfigDebug bool `split_words:"true"` // optional
TracingConfigBackend tracingconfig.BackendType `split_words:"true"` // optional
TracingConfigSampleRate float64 `split_words:"true"` // optional
TracingConfigZipkinEndpoint string `split_words:"true"` // optional
TracingConfigStackdriverProjectID string `split_words:"true"` // optional
TracingConfigDebug bool `split_words:"true"` // optional
TracingConfigBackend tracingconfig.BackendType `split_words:"true"` // optional
TracingConfigSampleRate float64 `split_words:"true"` // optional
TracingConfigZipkinEndpoint string `split_words:"true"` // optional
}

func init() {
Expand Down Expand Up @@ -328,11 +327,10 @@ func buildTransport(env config, logger *zap.SugaredLogger, maxConns int) http.Ro

oct := tracing.NewOpenCensusTracer(tracing.WithExporterFull(env.ServingPod, env.ServingPodIP, logger))
oct.ApplyConfig(&tracingconfig.Config{
Backend: env.TracingConfigBackend,
Debug: env.TracingConfigDebug,
ZipkinEndpoint: env.TracingConfigZipkinEndpoint,
StackdriverProjectID: env.TracingConfigStackdriverProjectID,
SampleRate: env.TracingConfigSampleRate,
Backend: env.TracingConfigBackend,
Debug: env.TracingConfigDebug,
ZipkinEndpoint: env.TracingConfigZipkinEndpoint,
SampleRate: env.TracingConfigSampleRate,
})

return &ochttp.Transport{
Expand Down
19 changes: 3 additions & 16 deletions config/core/configmaps/observability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metadata:
labels:
serving.knative.dev/release: devel
annotations:
knative.dev/example-checksum: "97c1d10b"
knative.dev/example-checksum: "fed4756e"
data:
_example: |
################################
Expand Down Expand Up @@ -90,27 +90,14 @@ data:
logging.enable-probe-request-log: "false"

# metrics.backend-destination field specifies the system metrics destination.
# It supports either prometheus (the default) or stackdriver.
# Note: Using stackdriver will incur additional charges
# It supports either prometheus (the default) or opencensus.
metrics.backend-destination: prometheus

# metrics.request-metrics-backend-destination specifies the request metrics
# destination. It enables queue proxy to send request metrics.
# Currently supported values: prometheus (the default), stackdriver.
# Currently supported values: prometheus (the default), opencensus.
metrics.request-metrics-backend-destination: prometheus

# metrics.stackdriver-project-id field specifies the stackdriver project ID. This
# field is optional. When running on GCE, application default credentials will be
# used if this field is not provided.
metrics.stackdriver-project-id: "<your stackdriver project id>"

# metrics.allow-stackdriver-custom-metrics indicates whether it is allowed to send metrics to
# Stackdriver using "global" resource type and custom metric type if the
# metrics are not supported by "knative_revision" resource type. Setting this
# flag to "true" could cause extra Stackdriver charge.
# If metrics.backend-destination is not Stackdriver, this is ignored.
metrics.allow-stackdriver-custom-metrics: "false"

# profiling.enable indicates whether it is allowed to retrieve runtime profiling data from
# the pods via an HTTP server in the format expected by the pprof visualization tool. When
# enabled, the Knative Serving pods expose the profiling data on an alternate HTTP port 8008.
Expand Down
9 changes: 2 additions & 7 deletions config/core/configmaps/tracing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metadata:
labels:
serving.knative.dev/release: devel
annotations:
knative.dev/example-checksum: "4002b4c2"
knative.dev/example-checksum: "26614636"
data:
_example: |
################################
Expand All @@ -38,18 +38,13 @@ data:
# this example block and unindented to be in the data block
# to actually change the configuration.
#
# This may be "zipkin" or "stackdriver", the default is "none"
# This may be "zipkin" or "none" (default)
backend: "none"

# URL to zipkin collector where traces are sent.
# This must be specified when backend is "zipkin"
zipkin-endpoint: "http://zipkin.istio-system.svc.cluster.local:9411/api/v2/spans"

# The GCP project into which stackdriver metrics will be written
# when backend is "stackdriver". If unspecified, the project-id
# is read from GCP metadata when running on GCP.
stackdriver-project-id: "my-project"

# Enable zipkin debug mode. This allows all spans to be sent to the server
# bypassing sampling.
debug: "false"
Expand Down
8 changes: 4 additions & 4 deletions pkg/metrics/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestObservabilityConfiguration(t *testing.T) {
EnableVarLogCollection: true,
LoggingURLTemplate: "https://logging.io",
RequestLogTemplate: `{"requestMethod": "{{.Request.Method}}"}`,
RequestMetricsBackend: "stackdriver",
RequestMetricsBackend: "opencensus",
},
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -84,7 +84,7 @@ func TestObservabilityConfiguration(t *testing.T) {
metrics.ReqLogTemplateKey: `{"requestMethod": "{{.Request.Method}}"}`,
"logging.revision-url-template": "https://logging.io",
"logging.write-request-logs": "true",
"metrics.request-metrics-backend-destination": "stackdriver",
"metrics.request-metrics-backend-destination": "opencensus",
},
},
}, {
Expand All @@ -94,7 +94,7 @@ func TestObservabilityConfiguration(t *testing.T) {
EnableVarLogCollection: true,
LoggingURLTemplate: "https://logging.io",
RequestLogTemplate: metrics.DefaultRequestLogTemplate,
RequestMetricsBackend: "stackdriver",
RequestMetricsBackend: "opencensus",
},
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -107,7 +107,7 @@ func TestObservabilityConfiguration(t *testing.T) {
"logging.enable-var-log-collection": "true",
"logging.revision-url-template": "https://logging.io",
"logging.write-request-logs": "true",
"metrics.request-metrics-backend-destination": "stackdriver",
"metrics.request-metrics-backend-destination": "opencensus",
},
},
}, {
Expand Down
3 changes: 0 additions & 3 deletions pkg/reconciler/revision/resources/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ var (
}, {
Name: "TRACING_CONFIG_ZIPKIN_ENDPOINT",
Value: "",
}, {
Name: "TRACING_CONFIG_STACKDRIVER_PROJECT_ID",
Value: "",
}, {
Name: "TRACING_CONFIG_DEBUG",
Value: "false",
Expand Down
3 changes: 0 additions & 3 deletions pkg/reconciler/revision/resources/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,6 @@ func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container
}, {
Name: "TRACING_CONFIG_ZIPKIN_ENDPOINT",
Value: cfg.Tracing.ZipkinEndpoint,
}, {
Name: "TRACING_CONFIG_STACKDRIVER_PROJECT_ID",
Value: cfg.Tracing.StackdriverProjectID,
}, {
Name: "TRACING_CONFIG_DEBUG",
Value: strconv.FormatBool(cfg.Tracing.Debug),
Expand Down
45 changes: 22 additions & 23 deletions pkg/reconciler/revision/resources/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,29 +879,28 @@ func TestTCPProbeGeneration(t *testing.T) {
}

var defaultEnv = map[string]string{
"CONTAINER_CONCURRENCY": "0",
"ENABLE_PROFILING": "false",
"METRICS_DOMAIN": metrics.Domain(),
"METRICS_COLLECTOR_ADDRESS": "",
"QUEUE_SERVING_PORT": "8012",
"REVISION_TIMEOUT_SECONDS": "45",
"SERVING_CONFIGURATION": "",
"SERVING_ENABLE_PROBE_REQUEST_LOG": "false",
"SERVING_ENABLE_REQUEST_LOG": "false",
"SERVING_LOGGING_CONFIG": "",
"SERVING_LOGGING_LEVEL": "",
"SERVING_NAMESPACE": "foo",
"SERVING_REQUEST_LOG_TEMPLATE": "",
"SERVING_REQUEST_METRICS_BACKEND": "",
"SERVING_REVISION": "bar",
"SERVING_SERVICE": "",
"SYSTEM_NAMESPACE": system.Namespace(),
"TRACING_CONFIG_BACKEND": "",
"TRACING_CONFIG_DEBUG": "false",
"TRACING_CONFIG_SAMPLE_RATE": "0",
"TRACING_CONFIG_STACKDRIVER_PROJECT_ID": "",
"TRACING_CONFIG_ZIPKIN_ENDPOINT": "",
"USER_PORT": strconv.Itoa(v1.DefaultUserPort),
"CONTAINER_CONCURRENCY": "0",
"ENABLE_PROFILING": "false",
"METRICS_DOMAIN": metrics.Domain(),
"METRICS_COLLECTOR_ADDRESS": "",
"QUEUE_SERVING_PORT": "8012",
"REVISION_TIMEOUT_SECONDS": "45",
"SERVING_CONFIGURATION": "",
"SERVING_ENABLE_PROBE_REQUEST_LOG": "false",
"SERVING_ENABLE_REQUEST_LOG": "false",
"SERVING_LOGGING_CONFIG": "",
"SERVING_LOGGING_LEVEL": "",
"SERVING_NAMESPACE": "foo",
"SERVING_REQUEST_LOG_TEMPLATE": "",
"SERVING_REQUEST_METRICS_BACKEND": "",
"SERVING_REVISION": "bar",
"SERVING_SERVICE": "",
"SYSTEM_NAMESPACE": system.Namespace(),
"TRACING_CONFIG_BACKEND": "",
"TRACING_CONFIG_DEBUG": "false",
"TRACING_CONFIG_SAMPLE_RATE": "0",
"TRACING_CONFIG_ZIPKIN_ENDPOINT": "",
"USER_PORT": strconv.Itoa(v1.DefaultUserPort),
}

func probeJSON(container *corev1.Container) string {
Expand Down