Skip to content

Commit

Permalink
Drop deprecated span.{start,http} fields (#6602)
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed Nov 15, 2021
1 parent b060ae6 commit fa14836
Show file tree
Hide file tree
Showing 27 changed files with 2 additions and 299 deletions.
7 changes: 0 additions & 7 deletions apmpackage/apm/data_stream/rum_traces/fields/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,6 @@
type: keyword
description: |
Generic designation of a span in the scope of a transaction.
- name: start
type: group
fields:
- name: us
type: long
description: |
Offset relative to the transaction's timestamp identifying the start of the span, in microseconds.
- name: subtype
type: keyword
description: |
Expand Down
7 changes: 0 additions & 7 deletions apmpackage/apm/data_stream/traces/fields/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,6 @@
type: keyword
description: |
Generic designation of a span in the scope of a transaction.
- name: start
type: group
fields:
- name: us
type: long
description: |
Offset relative to the transaction's timestamp identifying the start of the span, in microseconds.
- name: subtype
type: keyword
description: |
Expand Down
1 change: 0 additions & 1 deletion apmpackage/apm/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ Traces are written to `traces-apm-*` data streams, except for RUM traces, which
| span.message.age.ms | Age of a message in milliseconds. | long |
| span.message.queue.name | Name of the message queue or topic where the message is published or received. | keyword |
| span.name | Generic designation of a span in the scope of a transaction. | keyword |
| span.start.us | Offset relative to the transaction's timestamp identifying the start of the span, in microseconds. | long |
| span.subtype | A further sub-division of the type (e.g. postgresql, elasticsearch) | keyword |
| span.sync | Indicates whether the span was executed synchronously or asynchronously. | boolean |
| span.type | Keyword of specific relevance in the service's domain (eg: 'db.postgresql.query', 'template.erb', 'cache', etc). | keyword |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,21 +397,6 @@
"duration": {
"us": 3781
},
"http": {
"method": "GET",
"response": {
"decoded_body_size": 401,
"encoded_body_size": 356,
"headers": {
"Content-Type": [
"application/json"
]
},
"status_code": 302,
"transfer_size": 300.12
}
},
"http.url.original": "http://localhost:8000",
"id": "1234567890aaaade",
"name": "GET users-authenticated",
"stacktrace": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
},
"id": "0123456a89012345",
"name": "GET /api/types",
"start": {
"us": 1845
},
"type": "request"
},
"timestamp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@
},
"id": "1234abcdef567895",
"name": "GET /api/types",
"start": {
"us": 22000
},
"type": "request"
},
"timestamp": {
Expand Down Expand Up @@ -376,9 +373,6 @@
},
"id": "0123456a89012345",
"name": "GET /api/types",
"start": {
"us": 1845
},
"subtype": "http",
"type": "request"
},
Expand Down Expand Up @@ -508,9 +502,6 @@
},
"id": "abcde56a89012345",
"name": "get /api/types",
"start": {
"us": 0
},
"subtype": "http",
"sync": false,
"type": "request"
Expand Down Expand Up @@ -670,16 +661,6 @@
"duration": {
"us": 3781
},
"http": {
"method": "GET",
"response": {
"decoded_body_size": 401,
"encoded_body_size": 356,
"status_code": 200,
"transfer_size": 300.12
}
},
"http.url.original": "http://localhost:8000",
"id": "1234567890aaaade",
"name": "SELECT FROM product_types",
"stacktrace": [
Expand Down Expand Up @@ -731,9 +712,6 @@
}
}
],
"start": {
"us": 2830
},
"subtype": "postgresql",
"sync": true,
"type": "db"
Expand Down Expand Up @@ -1013,9 +991,6 @@
},
"id": "abcdef01234567",
"name": "SELECT FROM p_details",
"start": {
"us": 2830
},
"subtype": "postgresql",
"type": "db"
},
Expand Down
1 change: 1 addition & 0 deletions changelogs/head.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ https://github.com/elastic/apm-server/compare/7.15\...master[View commits]
- Removed `apm-server.rum.{allowed_service,event_rate}` configuration option in favor of `apm-server.auth.anonymous.{allow_service,rate_limit}` {pull}6560[6560]
- Removed `apm-server.{api_key,secret_token}` configuration options in favor of `apm-server.auth.{api_key,secret_token}` {pull}6560[6560]
- Onboarding documents are no longer indexed {pull}6431[6431]
- Removed unused `span.start.us` field, and deprecated `span.http.*` fields {pull}6602[6602]

[float]
==== Bug fixes
Expand Down
23 changes: 0 additions & 23 deletions model/apmevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,28 +146,5 @@ func (e *APMEvent) BeatEvent(ctx context.Context) beat.Event {
fields.maybeSetString("message", e.Message)
fields.maybeSetMapStr("http", e.HTTP.fields())
fields.maybeSetMapStr("faas", e.FAAS.fields())
if e.Processor == SpanProcessor {
// Deprecated: copy url.original and http.* to span.http.* for backwards compatibility.
//
// TODO(axw) remove this in 8.0: https://github.com/elastic/apm-server/issues/5995
var spanHTTPFields mapStr
spanHTTPFields.maybeSetString("version", e.HTTP.Version)
if e.HTTP.Request != nil {
spanHTTPFields.maybeSetString("method", e.HTTP.Request.Method)
}
if e.HTTP.Response != nil {
spanHTTPFields.maybeSetMapStr("response", e.HTTP.Response.fields())
}
if len(spanHTTPFields) != 0 || e.URL.Original != "" {
spanFieldsMap, ok := event.Fields["span"].(common.MapStr)
if !ok {
spanFieldsMap = make(common.MapStr)
event.Fields["span"] = spanFieldsMap
}
spanFields := mapStr(spanFieldsMap)
spanFields.maybeSetMapStr("http", common.MapStr(spanHTTPFields))
spanFields.maybeSetString("http.url.original", e.URL.Original)
}
}
return event
}
4 changes: 0 additions & 4 deletions model/modeldecoder/rumv3/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,6 @@ func mapToSpanModel(from *span, event *model.APMEvent) {
out.Stacktrace = make(model.Stacktrace, len(from.Stacktrace))
mapToStracktraceModel(from.Stacktrace, out.Stacktrace)
}
if from.Start.IsSet() {
val := from.Start.Val
out.Start = &val
}
if from.Sync.IsSet() {
val := from.Sync.Val
out.Sync = &val
Expand Down
4 changes: 0 additions & 4 deletions model/modeldecoder/v2/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,6 @@ func mapToSpanModel(from *span, event *model.APMEvent) {
out.Stacktrace = make(model.Stacktrace, len(from.Stacktrace))
mapToStracktraceModel(from.Stacktrace, out.Stacktrace)
}
if from.Start.IsSet() {
val := from.Start.Val
out.Start = &val
}
if from.Sync.IsSet() {
val := from.Sync.Val
out.Sync = &val
Expand Down
1 change: 0 additions & 1 deletion model/modeldecoder/v2/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ func TestDecodeMapToSpanModel(t *testing.T) {
modeldecodertest.SetStructValues(&input, defaultVal)
input.Start.Reset()
mapToSpanModel(&input, &out)
require.Nil(t, out.Span.Start)
assert.Equal(t, reqTime, out.Timestamp)
})

Expand Down
9 changes: 0 additions & 9 deletions model/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ type Span struct {
// Action holds the span action: "query", "execute", etc.
Action string

// Start holds the span's offset from the transaction timestamp in milliseconds.
//
// TODO(axw) drop in 8.0. See https://github.com/elastic/apm-server/issues/6000)
Start *float64

// SelfTime holds the aggregated span durations, for breakdown metrics.
SelfTime AggregatedDuration

Expand Down Expand Up @@ -147,10 +142,6 @@ func (e *Span) setFields(fields *mapStr, apmEvent *APMEvent) {
span.maybeSetString("subtype", e.Subtype)
span.maybeSetString("action", e.Action)
span.maybeSetBool("sync", e.Sync)
if e.Start != nil {
start := time.Duration(*e.Start * float64(time.Millisecond))
span.set("start", common.MapStr{"us": int(start.Microseconds())})
}
if apmEvent.Processor == SpanProcessor {
// TODO(axw) set `event.duration` in 8.0, and remove this field.
// See https://github.com/elastic/apm-server/issues/5999
Expand Down
13 changes: 1 addition & 12 deletions model/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestSpanTransformEmpty(t *testing.T) {

func TestSpanTransform(t *testing.T) {
path := "test/path"
start := 0.65
hexID := "0147258369012345"
subtype := "amqp"
action := "publish"
Expand All @@ -60,7 +59,6 @@ func TestSpanTransform(t *testing.T) {
Kind: "CLIENT",
Subtype: subtype,
Action: action,
Start: &start,
RepresentativeCount: 5,
Stacktrace: Stacktrace{{AbsPath: path}},
DB: &DB{
Expand All @@ -85,7 +83,6 @@ func TestSpanTransform(t *testing.T) {
"duration": common.MapStr{"us": int(duration.Microseconds())},
"name": "myspan",
"kind": "CLIENT",
"start": common.MapStr{"us": 650},
"type": "myspantype",
"subtype": subtype,
"action": action,
Expand Down Expand Up @@ -166,15 +163,7 @@ func TestSpanHTTPFields(t *testing.T) {
"original": event.URL.Original,
},
"span": common.MapStr{
"duration": common.MapStr{"us": 0},
"http.url.original": event.URL.Original,
"http": common.MapStr{
"version": event.HTTP.Version,
"method": event.HTTP.Request.Method,
"response": common.MapStr{
"status_code": event.HTTP.Response.StatusCode,
},
},
"duration": common.MapStr{"us": 0},
},
}, output.Fields)
}
7 changes: 0 additions & 7 deletions processor/otel/test_approved/span_jaeger_http.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
"duration": {
"us": 79000000
},
"http": {
"method": "get",
"response": {
"status_code": 400
}
},
"http.url.original": "http://foo.bar.com?a=12",
"id": "0000000041414646",
"name": "HTTP GET",
"subtype": "http",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
"duration": {
"us": 79000000
},
"http": {
"method": "get",
"response": {
"status_code": 202
}
},
"http.url.original": "http://foo.bar.com?a=12",
"id": "0000000041414646",
"name": "HTTP GET",
"subtype": "http",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"duration": {
"us": 79000000
},
"http.url.original": "https://foo.bar.com:443?a=12",
"id": "0000000041414646",
"name": "HTTPS GET",
"subtype": "http",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,21 +375,6 @@
"duration": {
"us": 3781
},
"http": {
"method": "GET",
"response": {
"decoded_body_size": 401,
"encoded_body_size": 356,
"headers": {
"Content-Type": [
"application/json"
]
},
"status_code": 302,
"transfer_size": 300.12
}
},
"http.url.original": "http://localhost:8000",
"id": "1234567890aaaade",
"name": "GET users-authenticated",
"stacktrace": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
},
"id": "abcdef01234567",
"name": "GET /api/types",
"start": {
"us": 0
},
"type": "request"
},
"timestamp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
},
"id": "abcdef01234567",
"name": "GET /api/types",
"start": {
"us": 0
},
"type": "request"
},
"timestamp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@
"duration": {
"us": 32592
},
"http": {
"method": "GET",
"response": {
"status_code": 200
}
},
"id": "ddf109a4c4aa5f2b6e984548ca57774d",
"kind": "CLIENT",
"name": "span_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@
},
"id": "0147258369abcdef",
"name": "sp1",
"start": {
"us": 10000
},
"type": "db"
},
"timestamp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"duration": {
"us": 643000
},
"http.url.original": "http://localhost:8000/test/e2e/general-usecase/span",
"id": "aaaaaaaaaaaaaaaa",
"name": "transaction",
"stacktrace": [
Expand All @@ -127,9 +126,6 @@
}
}
],
"start": {
"us": 0
},
"type": "transaction"
},
"timestamp": {
Expand Down
Loading

0 comments on commit fa14836

Please sign in to comment.