Skip to content

Commit

Permalink
Revert "RHCLOUD-17941: Add RHC implementation observability (RedHatIn…
Browse files Browse the repository at this point in the history
…sights#220)"

This reverts commit 0215f6d.
  • Loading branch information
jharting committed May 26, 2022
1 parent 0215f6d commit 4ef17a1
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 361 deletions.
477 changes: 150 additions & 327 deletions dashboard/grafana-dashboard-insights-playbook-dispatcher.configmap.yaml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.16

require (
github.com/RedHatInsights/tenant-utils v1.0.0
github.com/atombender/go-jsonschema v0.9.1-0.20211117143334-fdc071e07e6c // indirect
github.com/aws/aws-sdk-go v1.36.28
github.com/confluentinc/confluent-kafka-go v1.5.2
github.com/deepmap/oapi-codegen v1.4.2
Expand All @@ -13,7 +12,6 @@ require (
github.com/globocom/echo-prometheus v0.1.2
github.com/golang-migrate/migrate/v4 v4.15.1
github.com/google/uuid v1.3.0
github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b // indirect
github.com/labstack/echo/v4 v4.1.17
github.com/mec07/cloudwatchwriter v0.2.4
github.com/onsi/ginkgo v1.16.4
Expand Down
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/atombender/go-jsonschema v0.9.1-0.20211117143334-fdc071e07e6c h1:NlypVwKwsevo3e4KP6ozYoZFG+Df1Bnk5l9wZwd23NE=
github.com/atombender/go-jsonschema v0.9.1-0.20211117143334-fdc071e07e6c/go.mod h1:ev1S/jfIbe8uIdBSPPVWB0Pj7NuHTe+JkM2Gw+JaaD8=
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.34.2/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
Expand Down Expand Up @@ -709,8 +707,6 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b h1:yhv01T9j1k7K/DsNkukw1CMv+KjdPaMGpkn9AykaGXc=
github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b/go.mod h1:DUEJ+lstFLzs07dkWsLsEZJtWQcTWAs/4BgfepBMkoI=
github.com/labstack/echo/v4 v4.1.10/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
github.com/labstack/echo/v4 v4.1.17 h1:PQIBaRplyRy3OjwILGkPg89JRtH2x5bssi59G2EL3fo=
Expand Down Expand Up @@ -769,8 +765,6 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
Expand Down Expand Up @@ -941,8 +935,6 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/sanity-io/litter v1.1.0 h1:BllcKWa3VbZmOZbDCoszYLk7zCsKHz5Beossi8SUcTc=
github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
Expand Down Expand Up @@ -985,7 +977,6 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
Expand Down
2 changes: 1 addition & 1 deletion internal/api/controllers/private/runsCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (this *controllers) ApiInternalRunsCreate(ctx echo.Context) error {

runInput := RunInputV1GenericMap(runInputV1, &orgIdString, recipient, hosts, this.config)

runID, _, err := this.dispatchManager.ProcessRun(context, string(runInputV1.Account), middleware.GetPSKPrincipal(context), runInput, "v1")
runID, _, err := this.dispatchManager.ProcessRun(context, string(runInputV1.Account), middleware.GetPSKPrincipal(context), runInput)

if err != nil {
return handleRunCreateError(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/controllers/private/runsCreateV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (this *controllers) ApiInternalV2RunsCreate(ctx echo.Context) error {

runInput := RunInputV2GenericMap(runInputV2, *ean, recipient, hosts, parsedSatID, this.config)

runID, _, err := this.dispatchManager.ProcessRun(context, *ean, middleware.GetPSKPrincipal(context), runInput, "v2")
runID, _, err := this.dispatchManager.ProcessRun(context, *ean, middleware.GetPSKPrincipal(context), runInput)

if err != nil {
return handleRunCreateError(err)
Expand Down
8 changes: 4 additions & 4 deletions internal/api/dispatch/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func getProtocol(runInput generic.RunInput) protocols.Protocol {
}
}

func (this *dispatchManager) ProcessRun(ctx context.Context, account string, service string, run generic.RunInput, api_version string) (runID, correlationID uuid.UUID, err error) {
func (this *dispatchManager) ProcessRun(ctx context.Context, account string, service string, run generic.RunInput) (runID, correlationID uuid.UUID, err error) {
correlationID = this.newCorrelationId()
ctx = utils.WithCorrelationId(ctx, correlationID.String())

Expand Down Expand Up @@ -84,15 +84,15 @@ func (this *dispatchManager) ProcessRun(ctx context.Context, account string, ser

err = this.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
if dbResult := tx.Create(&entity); dbResult.Error != nil {
instrumentation.PlaybookRunCreateError(ctx, dbResult.Error, &entity, protocol.GetLabel(), api_version)
instrumentation.PlaybookRunCreateError(ctx, dbResult.Error, &entity, protocol.GetLabel())
return dbResult.Error
}

if len(run.Hosts) > 0 {
newHosts := newHostRun(run.Hosts, entity.ID)

if dbResult := tx.Create(newHosts); dbResult.Error != nil {
instrumentation.PlaybookRunHostCreateError(ctx, dbResult.Error, newHosts, protocol.GetLabel(), api_version)
instrumentation.PlaybookRunHostCreateError(ctx, dbResult.Error, newHosts, protocol.GetLabel())
return dbResult.Error
}
}
Expand All @@ -104,7 +104,7 @@ func (this *dispatchManager) ProcessRun(ctx context.Context, account string, ser
return entity.ID, correlationID, err
}

instrumentation.RunCreated(ctx, run.Recipient, entity.ID, run.Url, entity.Service, protocol.GetLabel(), api_version)
instrumentation.RunCreated(ctx, run.Recipient, entity.ID, run.Url, entity.Service, protocol.GetLabel())
return entity.ID, correlationID, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/api/dispatch/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// orchestrates sending of playbook run signal and storing the database records
type DispatchManager interface {
ProcessRun(ctx context.Context, account string, service string, run generic.RunInput, api_verison string) (runID, correlationID uuid.UUID, err error)
ProcessRun(ctx context.Context, account string, service string, run generic.RunInput) (runID, correlationID uuid.UUID, err error)
ProcessCancel(ctx context.Context, account string, cancel generic.CancelInput) (runID, correlationID uuid.UUID, err error)
}

Expand Down
30 changes: 14 additions & 16 deletions internal/api/instrumentation/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
)

const (
ApiVersion = "v1"

labelDb = "db"
labelPlaybookRunCreate = "playbook_run_create"
labelPlaybookRunHostCreate = "playbook_run_host_create"
Expand All @@ -37,7 +35,7 @@ var (
errorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "api_error_total",
Help: "The total number of errors",
}, []string{"type", "subtype", "request", "api_version"})
}, []string{"type", "subtype", "request"})

connectorErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "api_cloud_connector_error_total",
Expand All @@ -62,7 +60,7 @@ var (
runCreatedTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "api_run_created_total",
Help: "The total number of created playbook runs",
}, []string{"dispatching_service", "request", "api_version"})
}, []string{"dispatching_service", "request"})

runCanceledTotal = promauto.NewCounter(prometheus.CounterOpts{
Name: "api_run_canceled_total",
Expand Down Expand Up @@ -100,14 +98,14 @@ func CloudConnectorOK(ctx context.Context, recipient uuid.UUID, messageId *strin
connectorSentTotal.Inc()
}

func PlaybookRunCreateError(ctx context.Context, err error, run *dbModel.Run, requestType string, api_version string) {
func PlaybookRunCreateError(ctx context.Context, err error, run *dbModel.Run, requestType string) {
utils.GetLogFromContext(ctx).Errorw("Error creating run", "error", err, "run", *run)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, requestType, api_version).Inc()
errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, requestType).Inc()
}

func PlaybookRunHostCreateError(ctx context.Context, err error, data []dbModel.RunHost, requestType string, api_version string) {
func PlaybookRunHostCreateError(ctx context.Context, err error, data []dbModel.RunHost, requestType string) {
utils.GetLogFromContext(ctx).Errorw("Error creating run host", "error", err, "data", data)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, requestType, api_version).Inc()
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, requestType).Inc()
}

func PlaybookRunCancelError(ctx context.Context, err error) {
Expand Down Expand Up @@ -135,9 +133,9 @@ func RbacRejected(ctx echo.Context) {
rbacRejectedTotal.Inc()
}

func RunCreated(ctx context.Context, recipient uuid.UUID, runId uuid.UUID, payload string, service string, requestType string, api_version string) {
func RunCreated(ctx context.Context, recipient uuid.UUID, runId uuid.UUID, payload string, service string, requestType string) {
utils.GetLogFromContext(ctx).Infow("Created new playbook run", "recipient", recipient.String(), "run_id", runId.String(), "payload", string(payload), "service", service)
runCreatedTotal.WithLabelValues(service, requestType, api_version).Inc()
runCreatedTotal.WithLabelValues(service, requestType).Inc()
}

func RunCanceled(ctx context.Context, runId uuid.UUID) {
Expand All @@ -151,13 +149,13 @@ func Start() {
validationFailureTotal.WithLabelValues(labelTenantAnemic)
validationFailureTotal.WithLabelValues(labelSatellite)

errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, LabelAnsibleRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, LabelAnsibleRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunRead, LabelAnsibleRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, LabelAnsibleRequest)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, LabelAnsibleRequest)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunRead, LabelAnsibleRequest)

errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, LabelSatRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, LabelSatRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunRead, LabelSatRequest, ApiVersion)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunCreate, LabelSatRequest)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunHostCreate, LabelSatRequest)
errorTotal.WithLabelValues(labelDb, labelPlaybookRunRead, LabelSatRequest)

connectorErrorTotal.WithLabelValues(labelErrorGeneric, LabelAnsibleRequest)
connectorErrorTotal.WithLabelValues(labelErrorGeneric, LabelSatRequest)
Expand Down

0 comments on commit 4ef17a1

Please sign in to comment.