Skip to content

Enhance service graph with more information #94

@chenlujjj

Description

@chenlujjj

Is your feature request related to a problem? Please describe

Now the service graph data includes (parent, child, callCount) for each edge. A few APM products provide more information, such as qps, error rate, latency.

Describe the solution you'd like

When generating service graph data, we can query out more data.

Current logsql is:

(NOT parent_span_id:"") AND (kind:~"2|5")
   | fields parent_span_id, resource_attr:service.name
   | rename parent_span_id as span_id, resource_attr:service.name as child
   | join by (span_id) (
       (NOT span_id:"") AND (kind:~"3|4")
       | fields span_id, resource_attr:service.name
       | rename resource_attr:service.name as parent
     ) inner
   | NOT parent:eq_field(child)
   | stats by (parent, child) count() callCount

Suggested logsql:

(NOT parent_span_id:"") AND (kind:~"2|5")
   | fields parent_span_id, resource_attr:service.name, duration, status_code
   | rename parent_span_id as span_id, resource_attr:service.name as child, duration as child_duration, status_code as child_status_code
   | join by (span_id) (
       (NOT span_id:"") AND (kind:~"3|4")
       | fields span_id, resource_attr:service.name, duration, status_code
       | rename resource_attr:service.name as parent, duration as parent_duration, status_code as parent_status_code
     ) inner
   | NOT parent:eq_field(child)
   | stats by (parent, child) count() callCount, sum(parent_duration) as parentDurationSum, sum(child_duration) as clientDurationSum, count() if (child_status_code:=2) childErrorCount, count() if (parent_status_code:=2) parentErrorCount

Moreover, we can include the value of servicegraph.taskLookbehind in each edge to calculate:

  • rps = callCount / taskLookbehind
  • avg duration = durationSum / taskLookbehind
  • error rate = errorCount / taskLookbehind

Describe alternatives you've considered

No response

Additional information

ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/connector/servicegraphconnector/README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions