Skip to content

Commit

Permalink
When generating a Service graph don't change the users' settings (#6188)
Browse files Browse the repository at this point in the history
for showServiceNodes and showOperationNodes.  The user shouldn't care that
those being enabled does not make sense for Service graphs, and shouldn't
get surprised by them suddenly getting disabled. Instead, let
the backend ignore those settings as needed.

#6098
  • Loading branch information
jshaughn committed May 25, 2023
1 parent 113679e commit b65d3bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 1 addition & 6 deletions frontend/src/reducers/GraphDataState.ts
Expand Up @@ -99,14 +99,9 @@ const graphDataState = (state: GraphState = INITIAL_GRAPH_STATE, action: KialiAp
})
});
case getType(GraphToolbarActions.setGraphType):
const isServiceGraph = action.payload === GraphType.SERVICE;
const showOperationNodes = isServiceGraph ? false : state.toolbarState.showOperationNodes;
const showServiceNodes = isServiceGraph ? false : state.toolbarState.showServiceNodes;
return updateState(state, {
toolbarState: updateState(state.toolbarState, {
graphType: action.payload,
showOperationNodes: showOperationNodes,
showServiceNodes: showServiceNodes
graphType: action.payload
}),
// TODO: This should be handled in GraphPage.ComponentDidUpdate (Init graph on type change)
summaryData: INITIAL_GRAPH_STATE.summaryData
Expand Down
4 changes: 4 additions & 0 deletions graph/options.go
Expand Up @@ -173,6 +173,10 @@ func NewOptions(r *net_http.Request) Options {
} else if graphType != GraphTypeApp && graphType != GraphTypeService && graphType != GraphTypeVersionedApp && graphType != GraphTypeWorkload {
BadRequest(fmt.Sprintf("Invalid graphType [%s]", graphType))
}
// service graphs do not inject service nodes
if graphType == GraphTypeService {
injectServiceNodesString = "false"
}
// app node graphs require an app graph type
if app != "" && graphType != GraphTypeApp && graphType != GraphTypeVersionedApp {
BadRequest(fmt.Sprintf("Invalid graphType [%s]. This node detail graph supports only graphType app or versionedApp.", graphType))
Expand Down
5 changes: 5 additions & 0 deletions graph/telemetry/istio/appender/aggregate_node.go
Expand Up @@ -46,6 +46,11 @@ func (a AggregateNodeAppender) AppendGraph(trafficMap graph.TrafficMap, globalIn
return
}

// Aggregate Nodes are not applicable to Service Graphs
if a.GraphType == graph.GraphTypeService {
return
}

// Aggregate Nodes are currently supported only on Requests traffic (not TCP or gRPC-message traffic)
if a.Rates.Grpc != graph.RateRequests && a.Rates.Http != graph.RateRequests {
return
Expand Down

0 comments on commit b65d3bb

Please sign in to comment.