Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: add span.sync and index field #1548

Merged
merged 3 commits into from Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/head.asciidoc
Expand Up @@ -7,3 +7,4 @@ https://github.com/elastic/apm-server/compare/6.5\...master[View commits]
=== Added

- Set some configuration defaults (setup.template.settings.index.*, logging.metrics.enabled) in code {pull}1494[1494].
- Add `span.sync` property to intake json spec and index field in ES. {pull}1548[1548].
2 changes: 2 additions & 0 deletions docs/data/elasticsearch/generated/spans.json
Expand Up @@ -152,6 +152,7 @@
"start": {
"us": 0
},
"sync": false,
"type": "request"
},
"timestamp": {
Expand Down Expand Up @@ -252,6 +253,7 @@
"start": {
"us": 2830
},
"sync": true,
"type": "db.postgresql.query"
},
"timestamp": {
Expand Down
1 change: 1 addition & 0 deletions docs/data/elasticsearch/span.json
Expand Up @@ -71,6 +71,7 @@
"start": {
"us": 2830
},
"sync": false,
"type": "db.postgresql.query"
},
"transaction": {
Expand Down
10 changes: 10 additions & 0 deletions docs/fields.asciidoc
Expand Up @@ -811,6 +811,16 @@ format: duration
Duration of the span, in microseconds.


--

*`span.sync`*::
+
--
type: boolean

Indicates whether the span was executed synchronously or asynchronously.


--

*`span.parent`*::
Expand Down
4 changes: 4 additions & 0 deletions docs/spec/spans/common_span.json
Expand Up @@ -73,6 +73,10 @@
"type": "string",
"description": "Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', etc)",
"maxLength": 1024
},
"sync": {
"type": ["boolean", "null"],
"description": "Indicates whether the span was executed synchronously or asynchronously."
}
},
"required": ["duration", "name", "type"]
Expand Down
2 changes: 1 addition & 1 deletion include/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions model/span/_meta/fields.yml
Expand Up @@ -58,6 +58,12 @@
output_format: asMilliseconds
output_precision: 0

- name: sync
type: boolean
description: >
Indicates whether the span was executed synchronously or asynchronously.


- name: parent
type: long
description: >
Expand Down
3 changes: 3 additions & 0 deletions model/span/event.go
Expand Up @@ -63,6 +63,7 @@ type Event struct {

Timestamp time.Time
TransactionId string
Sync *bool

// new in v2
HexId string
Expand Down Expand Up @@ -155,6 +156,7 @@ func decodeEvent(input interface{}, err error) (*Event, map[string]interface{},
Start: decoder.Float64Ptr(raw, "start"),
Duration: decoder.Float64(raw, "duration"),
Context: decoder.MapStr(raw, "context"),
Sync: decoder.BoolPtr(raw, "sync"),
}
var stacktr *m.Stacktrace
stacktr, err = m.DecodeStacktrace(raw["stacktrace"], decoder.Err)
Expand Down Expand Up @@ -217,6 +219,7 @@ func (s *Event) fields(tctx *transform.Context) common.MapStr {

utility.Add(tr, "name", s.Name)
utility.Add(tr, "type", s.Type)
utility.Add(tr, "sync", s.Sync)

if s.Start != nil {
utility.Add(tr, "start", utility.MillisAsMicros(*s.Start))
Expand Down
4 changes: 4 additions & 0 deletions model/span/generated/schema/span.go
Expand Up @@ -165,6 +165,10 @@ const ModelSchema = `{
"type": "string",
"description": "Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', etc)",
"maxLength": 1024
},
"sync": {
"type": ["boolean", "null"],
"description": "Indicates whether the span was executed synchronously or asynchronously."
}
},
"required": ["duration", "name", "type"] },
Expand Down
4 changes: 4 additions & 0 deletions model/transaction/generated/schema/payload.go
Expand Up @@ -565,6 +565,10 @@ const PayloadSchema = `{
"type": "string",
"description": "Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', etc)",
"maxLength": 1024
},
"sync": {
"type": ["boolean", "null"],
"description": "Indicates whether the span was executed synchronously or asynchronously."
}
},
"required": ["duration", "name", "type"] },
Expand Down
Expand Up @@ -152,6 +152,7 @@
"start": {
"us": 0
},
"sync": false,
"type": "request"
},
"timestamp": {
Expand Down Expand Up @@ -252,6 +253,7 @@
"start": {
"us": 2830
},
"sync": true,
"type": "db.postgresql.query"
},
"timestamp": {
Expand Down
Expand Up @@ -214,6 +214,7 @@
"start": {
"us": 2830
},
"sync": false,
"type": "db.postgresql.query"
},
"transaction": {
Expand Down