Skip to content

Conversation

@findingrish
Copy link

@findingrish findingrish commented Apr 26, 2021

hypertrace/hypertrace#224

In this change, following is done:

  • Parse the log event request attributes from the span request
  • Make the span query as usual, subsequently build the log query using requested log attributes and returned spanIds as filter (ex: select attr1, attr2 from logEventView where spanId in [id1, id2, ....]), use the timefilter from the spanQuery as well
  • maintain a mapping from spanId(referred as id) -> list of logEvents

Major changes in SpanLogEventFetcher, LogEventAttributeRequestBuilder

Test

{
  spans(
    limit: 100
    between: {startTime: "2021-04-26T17:45:31.849Z", endTime: "2021-04-26T18:45:31.849Z"}
    offset: 0
    orderBy: [{key: "startTime", direction: DESC}]
  ) {
    results {
      id
      logEvents {
        results {
        spanId: attribute(key: "spanId")
        attribute: attribute(key: "attributes")
        }
      }
      protocolName: attribute(key: "protocolName")
      serviceName: attribute(key: "serviceName")
      displaySpanName: attribute(key: "displaySpanName")
      statusCode: attribute(key: "statusCode")
      duration: attribute(key: "duration")
      startTime: attribute(key: "startTime")
      traceId: attribute(key: "traceId")
      __typename
    }
    total
    __typename
  }
}
{
  "data": {
    "spans": {
      "results": [
        {
          "id": "2b1b03a627d8315b",
          "logEvents": [],
          "protocolName": "HTTP",
          "serviceName": "route",
          "displaySpanName": "HTTP GET /route",
          "statusCode": "200",
          "duration": 63,
          "startTime": 1619462676157,
          "traceId": "00000000000000006485904421d38a40",
          "__typename": "Span"
        },
        {
          "id": "4b374aba5a81f266",
          "logEvents": [
             "results":[
            {
              "spanId": "4b374aba5a81f266",
              "attribute": {
                "event": "GetConn"
              }
            },
            {
              "spanId": "4b374aba5a81f266",
              "attribute": {
                "event": "ConnectStart",
                "addr": "0.0.0.0:8081",
                "network": "tcp"
              }
            },
            {
              "spanId": "4b374aba5a81f266",
              "attribute": {
                "event": "ConnectDone",
                "addr": "0.0.0.0:8081",
                "network": "tcp"
              }
            },
            {
              "spanId": "4b374aba5a81f266",
              "attribute": {
                "event": "GotConn"
              }
            }
            ]
          ],
          "protocolName": "HTTP",
          "serviceName": "frontend",
          "displaySpanName": "HTTP GET /customer",
          "statusCode": "200",
          "duration": 292,
          "startTime": 1619462675412,
          "traceId": "00000000000000006485904421d38a40",
          "__typename": "Span"
        }
       .....
      ],
      "total": 54,
      "__typename": "SpanResultSet"
    }
  }
}

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Apr 26, 2021

Codecov Report

Merging #59 (5ebe773) into main (1e1c09e) will decrease coverage by 0.62%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #59      +/-   ##
============================================
- Coverage     61.48%   60.86%   -0.63%     
  Complexity      233      233              
============================================
  Files            77       78       +1     
  Lines          1171     1183      +12     
  Branches         33       33              
============================================
  Hits            720      720              
- Misses          423      435      +12     
  Partials         28       28              
Flag Coverage Δ Complexity Δ
unit 60.86% <0.00%> (-0.63%) 233.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...tils/gateway/GatewayServiceFutureStubProvider.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...core/graphql/utils/gateway/GatewayUtilsModule.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e1c09e...5ebe773. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@findingrish findingrish marked this pull request as ready for review April 26, 2021 19:57
@findingrish findingrish requested a review from a team as a code owner April 26, 2021 19:57
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@findingrish
Copy link
Author

@aaron-steinfeld for the log and span join to work, the span query must request id attribute and log query must request for spanId, in case when either is missing should it be handled by internally requesting the id/spanId attribute, or can we consider it sort of an informal contract with the consumer of the api?

@aaron-steinfeld
Copy link
Contributor

aaron-steinfeld commented Apr 28, 2021

@aaron-steinfeld for the log and span join to work, the span query must request id attribute and log query must request for spanId, in case when either is missing should it be handled by internally requesting the id/spanId attribute, or can we consider it sort of an informal contract with the consumer of the api?

Thanks for bringing that up! I meant to comment on that and it completely slipped my mind. IMO it should be handled internally, but I'm OK deferring that into a separate PR if you want since it strictly relaxes the API contract. The span id side of it should already be there though - that's already internal.

@findingrish findingrish merged commit 287f57e into main Apr 28, 2021
@findingrish findingrish deleted the span-log-api branch April 28, 2021 15:01
@github-actions
Copy link

Unit Test Results

29 files  ±0  29 suites  ±0   26s ⏱️ -1s
99 tests ±0  99 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 287f57e. ± Comparison against base commit 1e1c09e.

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