jaegertracing/jaeger

Support optional query param "spanKind" when get operations for given service

Open

#1920 opened on Nov 12, 2019

View on GitHub
 (13 comments) (0 reactions) (0 assignees)Go (18,974 stars) (2,326 forks)batch import
help wanted

Description

Requirement - what kind of business use case are you trying to solve?

We want to filter the operations of a service by span kind, those filtered operations can be used for features e.g. get dependencies graph for service:operation pair from server side (spanKind == "server")

Problem - what in Jaeger blocks you from solving the requirement?

Currently we only save operations indexed by service name and we can only query operations by service name. We will need to add extra info: spanKind when saving operations for a service.

Proposal - what do you suggest to solve the problem or improve the existing situation?

API changes: Restful:

  • GET /api/services/{serviceName}/operations : We will keep this endpoint unchanged for backward compatibility, it will still return all operations as a list of string for a given service.

  • GET /api/operations?service={service}&spanKind={spanKind} We will update this endpoint to return list of operation metadata for a given service whose spanKind matched the query parameter. If spanKind is empty, then return all operations of a service. Sample response:

{
  "data": [
    {
      "name": "A",
      "spanKind": "client"
    },
    {
      "name": "B",
      "spanKind": "server"
    }
  ],
  "total": 2,
  "limit": 0,
  "offset": 0,
  "errors": null
}

GRPC: rpc GetOperations(GetOperationsRequest) returns (GetOperationsResponse) Add span_kind to the rpc request and response

message GetOperationsRequest {
  string service = 1;
  string span_kind = 2;
}

message Operation{
    string name = 1;
    string span_kind = 2;
}

message GetOperationsResponse {
  repeated OperationMeta operations = 1;
}

Interfaces: spanstore:

...
// Get operations by service and spanKind, empty spanKind means get operations for all kinds of span
GetOperations(ctx context.Context, query *spanstore.OperationQueryParameters) ([]*storage_v1.OperationMeta, error)
..

Span reader will need to take extra parameter to query operations by service name and span kind. All the storage plugins needs to be updated so that:

  • write operation index with service name and span kind
  • query operation index by service name and span kind, return all kinds of operations when span kind is empty.

Task List

  • #1921 Update query service using the new request & response format (restful & grpc)
  • #1921 Update cassandra & memory storage to support spanKind for read/write operation index
  • #1922 Update badger to support spanKind for read/write operation index
  • #1923 Update elasticsearch to support spanKind for read/write operation index
  • https://github.com/jaegertracing/jaeger-ui/issues/492 Update UI to use new endpoint to get a list of operations

Any open questions to address

Contributor guide