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

Map RUM PerformanceResourceTiming fields #9429

Merged
merged 2 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apmpackage/apm/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- description: Enable synthetic source for metrics data streams
type: enhancement
link: https://github.com/elastic/apm-server/pull/9215
- description: Add mappings for RUM `http.response.*_size` fields
type: enhancement
link: https://github.com/elastic/apm-server/pull/9429
- version: "8.5.0"
changes:
- description: Add package settings to enable the experimental collection of service metrics
Expand Down
20 changes: 20 additions & 0 deletions apmpackage/apm/data_stream/traces/fields/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@
type: object
description: |
The canonical headers of the monitored HTTP response.
- name: http.response.transfer_size
type: long
unit: byte
index: false
description: |
The size (in octets) of the fetched resource.
The size includes the response header fields plus the response payload body (as defined by RFC7230).
- name: http.response.encoded_body_size
type: long
unit: byte
index: false
description: |
The size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.
- name: http.response.decoded_body_size
type: long
index: false
description: |
The size (in octets) received from the fetch (HTTP or cache) of the message body, after removing any applied content-codings.
If the resource is retrieved from an application cache or local resources,
it returns the size of the payload after removing any applied content-codings.
- name: kubernetes.namespace
type: keyword
description: |
Expand Down
2 changes: 2 additions & 0 deletions changelogs/head.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ https://github.com/elastic/apm-server/compare/8.5\...main[View commits]
==== Breaking Changes
- `apm-server.decoder.*` stack monitoring metrics are no longer recorded {pull}9210[9210]
- `ecs.version` is no longer added to document `_source`; it is added as a `constant_keyword` field {pull}9208[9208]
- `context.http.response.*_size` fields now enforce integer values {pull}9429[9429]

[float]
==== Deprecations
Expand All @@ -19,6 +20,7 @@ Set error.id for OpenTelemetry exception span events {pull}9372[9372]
==== Intake API Changes
- experimental:[] Extend logs v2 intake API to support ECS logging fields {pull}9349[9349]
- experimental:[] Add support for string timestamp format(`2006-01-02T15:04:05.999-0700`) {pull}9376[9376]
- `context.http.response.*_size` fields have been changed from floating-point to integer types {pull}9429[9429]

[float]
==== Added
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/rumv3/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ebs": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"he": {
Expand Down Expand Up @@ -159,7 +159,7 @@
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/rumv3/span.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,21 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ebs": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ts": {
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
12 changes: 6 additions & 6 deletions docs/spec/rumv3/transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ebs": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"he": {
Expand Down Expand Up @@ -159,7 +159,7 @@
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down Expand Up @@ -720,21 +720,21 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ebs": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"ts": {
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/v2/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"encoded_body_size": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"finished": {
Expand Down Expand Up @@ -410,7 +410,7 @@
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/v2/span.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"encoded_body_size": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"headers": {
Expand Down Expand Up @@ -233,7 +233,7 @@
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/v2/transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@
"description": "DecodedBodySize holds the size of the decoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"encoded_body_size": {
"description": "EncodedBodySize holds the size of the encoded payload.",
"type": [
"null",
"number"
"integer"
]
},
"finished": {
Expand Down Expand Up @@ -409,7 +409,7 @@
"description": "TransferSize holds the total size of the payload.",
"type": [
"null",
"number"
"integer"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
]
},
"status_code": 302,
"transfer_size": 300.12
"transfer_size": 30012
}
},
"kubernetes": {
Expand Down Expand Up @@ -518,8 +518,8 @@
"method": "POST"
},
"response": {
"decoded_body_size": 401.9,
"encoded_body_size": 356.9,
"decoded_body_size": 40190,
"encoded_body_size": 35690,
"finished": true,
"headers": {
"Content-Type": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
"decoded_body_size": 401,
"encoded_body_size": 356,
"status_code": 200,
"transfer_size": 300.12
"transfer_size": 30012
}
},
"kubernetes": {
Expand Down Expand Up @@ -806,7 +806,7 @@
"decoded_body_size": 401,
"encoded_body_size": 356,
"status_code": 200,
"transfer_size": 300.12
"transfer_size": 30012
}
},
"kubernetes": {
Expand Down Expand Up @@ -1023,7 +1023,7 @@
"decoded_body_size": 401,
"encoded_body_size": 356,
"status_code": 200,
"transfer_size": 300.12
"transfer_size": 30012
}
},
"kubernetes": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@
"referrer": "http://localhost:8000/test/e2e/"
},
"response": {
"decoded_body_size": 29.9,
"encoded_body_size": 26.9,
"decoded_body_size": 2990,
"encoded_body_size": 2690,
"finished": true,
"headers": {
"Content-Type": [
Expand All @@ -236,7 +236,7 @@
},
"headers_sent": true,
"status_code": 200,
"transfer_size": 25.8
"transfer_size": 258
},
"version": "1.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
"referrer": "http://localhost:8000/test/e2e/"
},
"response": {
"decoded_body_size": 29.9,
"encoded_body_size": 26.9,
"decoded_body_size": 2990,
"encoded_body_size": 2690,
"finished": true,
"headers": {
"Content-Type": [
Expand All @@ -106,7 +106,7 @@
},
"headers_sent": true,
"status_code": 200,
"transfer_size": 25.8
"transfer_size": 258
},
"version": "1.1"
},
Expand Down
12 changes: 6 additions & 6 deletions internal/model/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ type HTTPResponse struct {
Headers mapstr.M
Finished *bool
HeadersSent *bool
TransferSize *float64
EncodedBodySize *float64
DecodedBodySize *float64
TransferSize *int
EncodedBodySize *int
DecodedBodySize *int
}

func (h *HTTP) fields() mapstr.M {
Expand Down Expand Up @@ -90,8 +90,8 @@ func (h *HTTPResponse) fields() mapstr.M {
fields.maybeSetMapStr("headers", h.Headers)
fields.maybeSetBool("finished", h.Finished)
fields.maybeSetBool("headers_sent", h.HeadersSent)
fields.maybeSetFloat64ptr("transfer_size", h.TransferSize)
fields.maybeSetFloat64ptr("encoded_body_size", h.EncodedBodySize)
fields.maybeSetFloat64ptr("decoded_body_size", h.DecodedBodySize)
fields.maybeSetIntptr("transfer_size", h.TransferSize)
fields.maybeSetIntptr("encoded_body_size", h.EncodedBodySize)
fields.maybeSetIntptr("decoded_body_size", h.DecodedBodySize)
return mapstr.M(fields)
}
8 changes: 0 additions & 8 deletions internal/model/mapstr.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ func (m *mapStr) maybeSetIntptr(k string, v *int) bool {
return false
}

func (m *mapStr) maybeSetFloat64ptr(k string, v *float64) bool {
if v != nil {
m.set(k, *v)
return true
}
return false
}

func (m *mapStr) maybeSetMapStr(k string, v mapstr.M) bool {
if len(v) > 0 {
m.set(k, v)
Expand Down
12 changes: 6 additions & 6 deletions internal/model/modeldecoder/rumv3/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ type contextRequest struct {

type contextResponse struct {
// DecodedBodySize holds the size of the decoded payload.
DecodedBodySize nullable.Float64 `json:"dbs"`
DecodedBodySize nullable.Int `json:"dbs"`
// EncodedBodySize holds the size of the encoded payload.
EncodedBodySize nullable.Float64 `json:"ebs"`
EncodedBodySize nullable.Int `json:"ebs"`
// Headers holds the http headers sent in the http response.
Headers nullable.HTTPHeader `json:"he"`
// StatusCode sent in the http response.
StatusCode nullable.Int `json:"sc"`
// TransferSize holds the total size of the payload.
TransferSize nullable.Float64 `json:"ts"`
TransferSize nullable.Int `json:"ts"`
}

type contextService struct {
Expand Down Expand Up @@ -432,11 +432,11 @@ type spanContextHTTP struct {

type spanContextHTTPResponse struct {
// DecodedBodySize holds the size of the decoded payload.
DecodedBodySize nullable.Float64 `json:"dbs"`
DecodedBodySize nullable.Int `json:"dbs"`
// EncodedBodySize holds the size of the encoded payload.
EncodedBodySize nullable.Float64 `json:"ebs"`
EncodedBodySize nullable.Int `json:"ebs"`
// TransferSize holds the total size of the payload.
TransferSize nullable.Float64 `json:"ts"`
TransferSize nullable.Int `json:"ts"`
}

type spanContextService struct {
Expand Down
Loading