Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protocol to the topology endpoint response #8868

Merged
merged 6 commits into from
Oct 8, 2020
Merged

Conversation

freddygv
Copy link
Contributor

@freddygv freddygv commented Oct 7, 2020

This PR adds the protocol for the queried service, and is resolved from config entries.

@banks does it make sense for an ingress gateway to have a single protocol when it can have listeners for TCP and HTTP?

Need to fix the chained PR dance, only this commit is relevant: d32fda6 (#8868)

@freddygv freddygv changed the base branch from master to topo-viz-ingress October 7, 2020 19:36
@freddygv freddygv requested a review from banks October 7, 2020 19:41
@freddygv freddygv changed the base branch from topo-viz-ingress to master October 8, 2020 00:44
@freddygv freddygv changed the base branch from master to topo-viz-ingress October 8, 2020 02:50
Copy link
Member

@banks banks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@banks does it make sense for an ingress gateway to have a single protocol when it can have listeners for TCP and HTTP?

I think for now I'd suggest:

  • if it has only listeners of a single protocol, use that protocol
  • if it has a mix of tcp and non-tcp use tcp so we are at least showing all the traffic
  • we could as an optimisation allow all non-tcp protocols to be treated as http so if there is a combination of http, http2, grpc we just return 'http' since they will all have "http ish" metrics as far as we are concerned.

That gets it doing the right thing in the common cases of just one listener or multiple of the same type and is OK in other cases too. Later we could make it optional in the UI or in config I guess.

agent/structs/intention.go Outdated Show resolved Hide resolved
agent/structs/structs.go Outdated Show resolved Hide resolved
@freddygv freddygv force-pushed the topo-viz-protocol branch 2 times, most recently from 59ce7ce to ea8e8d0 Compare October 8, 2020 15:41
Base automatically changed from topo-viz-ingress to master October 8, 2020 15:47
@freddygv freddygv marked this pull request as ready for review October 8, 2020 18:02
kind, ok := req.URL.Query()["kind"]
if !ok {
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprint(resp, "Missing service kind")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guarding since we need it for non-typical services

@@ -519,6 +519,7 @@ type ServiceSpecificRequest struct {
Datacenter string
NodeMetaFilters map[string]string
ServiceName string
ServiceKind ServiceKind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does adding this here in this generic struct impact any other users of this struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, callers/APIs that don't need it will just ignore. Like the Connect/Ingress booleans that were added below.

@@ -2907,6 +2907,36 @@ func serviceGatewayNodes(tx *txn, ws memdb.WatchSet, service string, kind struct
return maxIdx, ret, nil
}

// metricsProtocolForIngressGateway determines the protocol that should be used when fetching metrics for an ingress gateway
// Since ingress gateways may have listeners with different protocols, favor capturing all traffic by only returning HTTP
// when all listeners are HTTP-like.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(later) Maybe dual-protocol ingress gateways should be rendered as N nodes in the UI instead of trying to mush them into one apples/oranges node like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's an option, can bring that up to Hannah and Jasmine

Copy link
Member

@rboyer rboyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Comments are non blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants