-
Notifications
You must be signed in to change notification settings - Fork 137
Conversation
86d724d
to
71fae14
Compare
I haven't had a chance to review the entire update yet -- but this is extremely awesome progress! :) Keep up the great work! Just responding to a few key points, and I'll have more feedback tomorrow.
Looking that the doc you linked to, it appears to go with Would it be easy for users to configure this to something else if they do want to change it?
We should not have |
Thanks taking the time to review this one @slimsag! 👍
Good call, I agree we should let func NewInfluxDBStore(c *influxDBServer.Config, bi *influxDBServer.BuildInfo, p PointConfig) (*InfluxDBStore, error) {
// ...
}
type PointPrecision string
type PointConfig struct {
Precision PointPrecision
} Perhaps we should wrap func NewInfluxDBStore(config InfluxDBStoreConfig) (*InfluxDBStore, error) {
// ...
}
type InfluxDBStoreConfig struct {
ServerConfig *influxDBServer.Config
ServerBuildInfo *influxDBServer.BuildInfo
PointConfig PointConfig
}
Yes, we can only keep Span.ID.Trace as In regards removing |
9bcc52c
to
ed9de95
Compare
tags := make(map[string]string, 3) | ||
tags["trace_id"] = id.Trace.String() | ||
tags["span_id"] = id.Span.String() | ||
tags["parent_id"] = id.Parent.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be written more clearly as just:
tags := map[string]string{
"trace_id": id.Trace.String(),
"span_id": id.Span.String(),
"parent_id": id.Parent.String(),
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Def agree, we should use map literals here - fixed on: 815bd39
I like this idea a lot! |
Thanks for the hard work on this @chris-ramon ! I left some comments inline, and everything else you have said I agree with. Once you're satisfied with the state of this PR for having MemoryStore-like functionality, we should:
Happy to chat with you more on the details about these, just wanted to provide an overview of where to go from here. I've tried out your PR locally and it's great! You've made some awesome progress here! |
var isRootSpan bool | ||
// Iterate over series(spans) to create trace children's & set trace fields. | ||
for _, s := range result.Series { | ||
span, err := newSpanFromRow(&s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, could you adjust the style a bit here (and in other places too)? Prefer a blank newline after comments, like this:
trace := &Trace{}
// GROUP BY * -> meaning group by all tags(trace_id, span_id & parent_id)
// grouping by all tags includes those and it's values on the query response.
q := fmt.Sprintf("SELECT * FROM spans WHERE trace_id='%s' GROUP BY *", id)
result, err := in.executeOneQuery(q)
if err != nil {
return nil, err
}
// result.Series -> A slice containing all the spans.
if len(result.Series) == 0 {
return nil, errors.New("trace not found")
}
var isRootSpan bool
// Iterate over series(spans) to create trace children's & set trace fields.
for _, s := range result.Series {
span, err := newSpanFromRow(&s)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, def improves readability - fixed on: 11e791d
|
||
// trace_id, span_id & parent_id are set as tags | ||
// because InfluxDB tags are indexed & those values | ||
// are uselater on queries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo here. s/are uselater/are used later/g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! - fixed on 5fc2a65
also frontend won't crash due trying to use empty time values
also adds an influxdb webapp example
rename pkg to webapp so we can import it
renames influxdb pk name - see: github.com/influxdata/influxdb/issues/5388
BTW, I don't think 80 char width should be considered a mandatory strict limit. Rob Pike said it himself. https://twitter.com/rob_pike/status/563798709868056576 Most of my code falls within 40-140 characters wide. Sometimes longer when the stuff on the right side is not important. |
This reverts commit d589fcb.
Looks great, thanks! @chris-ramon & @shurcooL :) |
test mode for running tests & release mode as default.
tests for Collect & Trace methods
115eabf
to
74b6775
Compare
74b6775
to
f056451
Compare
which is used to tell appdash database how long time preserve data before deleting it
ee35fd8
to
62b5c69
Compare
a3b873f
to
d4354ee
Compare
0a0dedd
to
ef7a19a
Compare
updates to reuse code from examples/cmd/webapp rename pkg to webapp so we can import it manuall install deps renames influxdb pk name - see: github.com/influxdata/influxdb/issues/5388 updates to correct paths adds Collect & Trace implementation cleans up influxdb example adds Traces implementation & cleanups InfluxDBStore fixes naming clash updates to more consistent func names improvements on Traces implementation now two queries are executed, one for root spans and other for children spans use map literals instead for readability use default point precision 'ms' & set utc time typo updates NewInfluxDBStore param signature, using struct instead for consistency. improves code style improves strategy for replace existing spans on DB adds InfluxDBStore.findSpanPoint and removes InfluxDBStore.removeSpanIfExists since not needed anymore improves root span checking fields might contain empty values so better to start annotations slice from zero size temp fix for frontend hanging when seeing trace detail page typo Revert "temp fix for frontend hanging" - Lasting fix on 7a77805 This reverts commit 38edc7b. updates to preserve existing span fields do not replace existing annotations saved on db, just append new ones use ID's method instead of its implementation we might want to move zeroID to `id.go` set all other fields diff than Name too updates to correct error text improvements on span annotations updating handles potential closing errors if so we should return it captures potential closing error and logs it adds trace pagination related todo updates to handle multiple row values & update docs due to we already improved the strategy to remove existing span then save new one, now we just append new annotations to the existing span docs improvements on InfluxDBStore.Collect method adds missing whitespace adds support to save `schemas` field to spans measurement to keep track which schemas were saved by `Collect(...)` Revert "adds empty time value validation" This reverts commit 7a77805. Reverting since not required anymore to prevent ui breaking, There's a workaround introduced with: 6d10ff7. adds sorting related improvements improves comments for `InfluxDBStore` updates influxdb related paths; fixes introduced on v0.10 therefore not changes on travis related to influxdb import path issues is required - see: influxdata/influxdb#5617 adds support for auth to `InfluxDBStore.server` typo and fit comments into 80-char-width updates to keep 80-chars code width limit Revert "updates to keep 80-chars code width limit" This reverts commit d589fcb. adds mode(test, release) support for InfluxDBStore test mode for running tests & release mode as default. adds InfluxDBStore tests tests for Collect & Trace methods removes httptrace dependency to avoid cyclic dependencies adds test for InfluxDBStore.Traces() improvements on comments, unnecessary code & codestyle adds default retention policy support which is used to tell appdash database how long time preserve data before deleting it improves comments readability & adds a low priority TODO support to add sub-traces to it's trace parent clean-up TestInfluxDBStore & adds TestFindTraceParent code readability improvements
LGTM |
Add InfluxDB storage backend.
Details
Issue: #98
InfluxDBStore
, which implementsStore
&Queryer
interfaces as:Collect(...)
implementation:spans
in a measurement namedspans
in the InfluxDB database namedappdash
.Span.ID.Trace
,Span.ID.Span
&Span.ID.Parent
are saved astags
- [InfluxDB indexes tags]Span.Annotations
are save asfields
- [InfluxDB does not index fields]Point.Precision
.Trace(...)
implementation:Traces(...)
implementation.InfluxDBStore
.NewInfluxDBStore
:InfluxDBStore
- such as: run anInfluxDBServer
, creates anInfluxDBClient
, creates an admin user &appdash
database with a retention policy if those do not already exist.InfluxDBServer
.InfluxDBStore
webapp example:examples/cmd/webapp/main.go
- run it with:go run examples/cmd/webapp-influxdb/main.go
Notes to consider:
InfluxDB
sends anonymous data tom.influxdb.com
, see:InfluxDB
version being use is v0.10:Key Concepts
Measurement
Tags
Fields
Retention Policy
Continuous Queries