Skip to content
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
2 changes: 1 addition & 1 deletion pkg/adapter/v2/cloudevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/cloudevents/sdk-go/v2/protocol/http"
"go.opencensus.io/plugin/ochttp"
"knative.dev/eventing/pkg/adapter/v2/util/crstatusevent"
"knative.dev/eventing/pkg/metrics/source"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/source"
"knative.dev/pkg/tracing/propagation/tracecontextb3"
)

Expand Down
5 changes: 2 additions & 3 deletions pkg/adapter/v2/cloudevents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import (

cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/cloudevents/sdk-go/v2/protocol/http"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/source"

"knative.dev/eventing/pkg/adapter/v2/test"
"knative.dev/eventing/pkg/metrics/source"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

type mockReporter struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"go.opencensus.io/stats/view"
"go.uber.org/zap"

"knative.dev/eventing/pkg/metrics/source"
kubeclient "knative.dev/pkg/client/injection/kube/client"
"knative.dev/pkg/controller"
"knative.dev/pkg/injection"
Expand All @@ -40,7 +41,6 @@ import (
"knative.dev/pkg/profiling"
"knative.dev/pkg/reconciler"
"knative.dev/pkg/signals"
"knative.dev/pkg/source"

"knative.dev/eventing/pkg/adapter/v2/util/crstatusevent"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/v2/main_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"github.com/kelseyhightower/envconfig"
"go.opencensus.io/stats/view"
"go.uber.org/zap"
"knative.dev/eventing/pkg/metrics/source"
"knative.dev/pkg/logging"
"knative.dev/pkg/metrics"
"knative.dev/pkg/profiling"
"knative.dev/pkg/signals"
"knative.dev/pkg/source"

"knative.dev/eventing/pkg/kncloudevents"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/adapter/v2/main_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"testing"

"go.opencensus.io/stats/view"
_ "knative.dev/pkg/client/injection/kube/client/fake"
"knative.dev/eventing/pkg/kncloudevents"
"knative.dev/eventing/pkg/metrics/source"
"knative.dev/pkg/leaderelection"
"knative.dev/pkg/metrics"
"knative.dev/pkg/source"

"knative.dev/eventing/pkg/kncloudevents"
_ "knative.dev/pkg/client/injection/kube/client/fake"
)

type myAdapterBindings struct{}
Expand Down
6 changes: 6 additions & 0 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ const (

// ContainerName is the container for which the metric is reported.
LabelContainerName = metricskey.ContainerName

// LabelResponseError is the label for client error. For HTTP, A non-2xx status code doesn't cause an error.
LabelResponseError = metricskey.LabelResponseError

// LabelResponseTimeout is the label timeout.
LabelResponseTimeout = metricskey.LabelResponseTimeout
)
26 changes: 26 additions & 0 deletions pkg/metrics/source/stats_reporter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2021 The Knative Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package source

import "knative.dev/pkg/source"

type StatsReporter = source.StatsReporter
type ReportArgs = source.ReportArgs

func NewStatsReporter() (StatsReporter, error) {
return source.NewStatsReporter()
}