1.1.1 • Published 2 years ago

thundra-trace-chart-forked v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Thundra-Trace-Chart

npm package

thundra-trace-chart is a React component to render open-tracing compatible traces and spans in a similar way to popular tools like Jeager and Zipkin. This component is using the project zipkin-lens in its roots.

Alt thundra trace chart

This component is under development and may not be the best solution for a custom use case. So you may want to fork it, or we would be happy to accept your PR's.

For npm audit logs to save use this command; npm audit --no-unicode --no-color > "npm-audit-log-$(date +%s).txt"

tl;dr

  • Install by executing npm install --save thundra-trace-chart or yarn add thundra-trace-chart.
  • Import by adding import ThundraTraceChart from 'thundra-trace-chart'.
  • Use by adding <ThundraTraceChart {...someProps} />.

Demo

Minimal demo page is included in sample directory. You just need to clone the repo and run npm i then finally run npm start to see the demo on your machine.

Online demo will be available soon!

Installation

Add Thundra-Trace-Chart to your project by executing npm install --save thundra-trace-chart or yarn add thundra-trace-chart.

Usage

Here's an example of basic usage:

import React, { Component } from 'react';
import ThundraTraceChart from 'thundra-trace-chart';

class MyApp extends Component {

  sampleTrace = () => {
    let trace = [
      {
        traceId: '4e81414c-2bff-439f-9e5c-9e6699b4e24b',
        parentId: '',
        id: '9400a8a9-9650-4312-9514-d4bbc1114a97',
        name: 'user-get-lambda-java-es',
        timestamp: 1557761782905000,
        duration: 281000,
        serviceName: 'AWS-Lambda',
        tags: {
          error: true
        }
      }
    ]

    return trace;
  }

  render() {
    return (
      <div>
        <ThundraTraceChart
          traceId="4e81414c-2bff-439f-9e5c-9e6699b4e24b"
          traceSummary={this.sampleTrace()}
        />
      </div>
    );
  }
}

User guide

Props

Prop nameProp typeDefaultDescription
traceIdstringrequiredCommon trace id to all spans.
traceSummaryarray of objectsrequiredArray of objects, that each object contains vital information to render a single span.
spanDetailsobject{ }Set of key value pairs. Keys are id values of each object in the traceSummary array. Values are the React elements to render when spans clicked and span details are shown.
spanHighlightsarray of string Array of span ids from trace summary array. When provided, these traces will rendered to be more distinctive than other spans.
activeSpanIdsarray of string Array of span ids from trace summary array. When provided, details of these spans will be rendered as open. You can not use this prop with spanHighlights together.
showHeaderbooleantrueShows a header to top of the chart showing traceId, duration etc.
showMiniTracebooleantrueShows a mini trace chart on top. Useful to see if you have many spans.
showTraceChartHeaderbooleantrueShows a header over the spans. Useful to set width of Service Name or Span Info columns.
showSpanDetailbooleantrueOpens spans towards the below to show more detailed info about that span.
showSpanDetailTitlebooleantrueRender a title when span details is shown.
serviceNameColumnTitlestringService NameSets custom title for Service Name column.
spanInfoColumnTitlestringSpan InfoSets custom title for Span Info column.
onSpanClickedfunction(spanId)( )When implemented, this function is called with the recently clicked span's id.

Trace Object

Each of the trace object provided to traceSummary array has its own special structure.

Key nameTypeDescription
traceIdstringCommon trace id to all spans.
parentIdstringParent span id of the span.
idstringUnique id of the span.
serviceNamestringName to be showed under Service Name column.
namestringInfo to be showed under Span Info column.
timestampnumberTime info in microseconds to show when span is started.
durationnumberDuration of the span.
colorstringColor string as a valid hexcode.
tagsobjectAny extra info to provided to the span, i.e: error

License

ASL 2.0.

1.1.1

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago