Skip to content

Commit

Permalink
report Azure Operation
Browse files Browse the repository at this point in the history
  • Loading branch information
orishavit committed Nov 25, 2024
1 parent 8385cfd commit d3df976
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 4 deletions.
178 changes: 178 additions & 0 deletions src/mapper/pkg/graph/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/mapper/pkg/graph/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/mapper/pkg/graph/model/results_length.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func (c AWSOperationResults) Length() int {
return len(c)
}

type AzureOperationResults []AzureOperation

func (c AzureOperationResults) Length() int {
return len(c)
}

func (c CaptureTCPResults) Length() int {
return len(c.Results)
}
25 changes: 21 additions & 4 deletions src/mapper/pkg/prometheus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ var (
Name: "istio_reported_connections",
Help: "The total number of Istio-sourced connections",
})
awsReports = promauto.NewCounter(prometheus.CounterOpts{
Name: "aws_reports",
Help: "The total number of AWS operations reported",
})

socketScanDrops = promauto.NewCounter(prometheus.CounterOpts{
Name: "socketscan_dropped_connections",
Help: "The total number of socket scan-sourced reported connections that were dropped for performance",
Expand All @@ -51,10 +48,23 @@ var (
Help: "The total number of Istio-sourced reported connections that were dropped for performance",
})

awsReports = promauto.NewCounter(prometheus.CounterOpts{
Name: "aws_reports",
Help: "The total number of AWS operations reported",
})
awsReportsDrops = promauto.NewCounter(prometheus.CounterOpts{
Name: "aws_dropped_reports",
Help: "The total number of AWS operations reported that were dropped for performance",
})

azureReports = promauto.NewCounter(prometheus.CounterOpts{
Name: "azure_reports",
Help: "The total number of Azure operations reported",
})
azureReportsDrops = promauto.NewCounter(prometheus.CounterOpts{
Name: "azure_dropped_reports",
Help: "The total number of Azure operations reported that were dropped for performance",
})
)

func IncrementTCPCaptureReports(count int) {
Expand Down Expand Up @@ -104,3 +114,10 @@ func IncrementIstioDrops(count int) {
func IncrementAWSOperationDrops(count int) {
awsReportsDrops.Add(float64(count))
}

func IncrementAzureOperationReports(count int) {
azureReports.Add(float64(count))
}
func IncrementAzureOperationDrops(count int) {
azureReportsDrops.Add(float64(count))
}
2 changes: 2 additions & 0 deletions src/mapper/pkg/resolvers/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Resolver struct {
kafkaMapperResults chan model.KafkaMapperResults
istioConnectionResults chan model.IstioConnectionResults
awsOperations chan model.AWSOperationResults
azureOperations chan model.AzureOperationResults
gotResultsCtx context.Context
gotResultsSignal context.CancelFunc
isRunningOnAws bool
Expand All @@ -63,6 +64,7 @@ func NewResolver(
kafkaMapperResults: make(chan model.KafkaMapperResults, 200),
istioConnectionResults: make(chan model.IstioConnectionResults, 200),
awsOperations: make(chan model.AWSOperationResults, 200),
azureOperations: make(chan model.AzureOperationResults, 200),
awsIntentsHolder: awsIntentsHolder,
dnsCache: dnsCache,
isRunningOnAws: isrunningonaws.Check(),
Expand Down
14 changes: 14 additions & 0 deletions src/mapper/pkg/resolvers/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/mappergraphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ input ServerFilter {
namespace: String!
}

input AzureOperation {
resource: String!
actions: [String!]!
dataActions: [String!]!
podName: String!
podNamespace: String!
}

type Query {
"""
Kept for backwards compatibility with CLI -
Expand Down Expand Up @@ -186,4 +194,5 @@ type Mutation {
reportKafkaMapperResults(results: KafkaMapperResults!): Boolean!
reportIstioConnectionResults(results: IstioConnectionResults!): Boolean!
reportAWSOperation(operation: [AWSOperation!]!): Boolean!
reportAzureOperation(operation: [AzureOperation!]!): Boolean!
}

0 comments on commit d3df976

Please sign in to comment.