Skip to content

Commit

Permalink
Use concrete telemetry.OtelSink type
Browse files Browse the repository at this point in the history
  • Loading branch information
Achooo committed Apr 26, 2023
1 parent 2ace716 commit 37fe2a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions agent/hcp/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net/url"
"time"

gometrics "github.com/armon/go-metrics"
hcpclient "github.com/hashicorp/consul/agent/hcp/client"
"github.com/hashicorp/consul/agent/hcp/config"
"github.com/hashicorp/consul/agent/hcp/scada"
Expand All @@ -21,7 +20,7 @@ import (
type Deps struct {
Client hcpclient.Client
Provider scada.Provider
Sink gometrics.MetricSink
Sink *telemetry.OTELSink
}

func NewDeps(cfg config.CloudConfig, logger hclog.Logger) (d Deps, err error) {
Expand Down Expand Up @@ -84,7 +83,7 @@ func verifyCCMRegistration(ctx context.Context, client hcpclient.Client) (string
return url.String(), nil
}

func initHCPSink(sinkOpts *telemetry.OTELSinkOpts, clientCfg *hcpclient.TelemetryClientCfg, url string) (gometrics.MetricSink, error) {
func initHCPSink(sinkOpts *telemetry.OTELSinkOpts, clientCfg *hcpclient.TelemetryClientCfg, url string) (*telemetry.OTELSink, error) {
// If the above succeeds, the server is registered with CCM, init metrics sink.
metricsClient, err := hcpclient.NewMetricsClient(clientCfg)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion lib/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hashicorp/go-multierror"
prometheuscore "github.com/prometheus/client_golang/prometheus"

"github.com/hashicorp/consul/agent/hcp/telemetry"
"github.com/hashicorp/consul/lib/retry"
)

Expand Down Expand Up @@ -213,7 +214,7 @@ type TelemetryConfig struct {

// HCPSink provides an intialized OpenTelemetry sink that aggregates Consul metrics.
// The aggregated metrics are periodically exported to HCP.
HCPSink metrics.MetricSink
HCPSink *telemetry.OTELSink
}

// MetricsHandler provides an http.Handler for displaying metrics.
Expand Down

0 comments on commit 37fe2a0

Please sign in to comment.