Skip to content

Commit

Permalink
[v2] rename "metric" entity to "metricset" (elastic#1359)
Browse files Browse the repository at this point in the history
Rename json schemas as well

Closes elastic#1356.
  • Loading branch information
roncohen authored and Ron cohen committed Oct 15, 2018
1 parent 84f3fce commit 0bc7120
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "docs/spec/metrics/metric.json",
"$id": "docs/spec/metrics/metricset.json",
"type": "object",
"description": "Metric data captured by an APM agent",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/metrics/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"metrics": {
"type": "array",
"items": {
"$ref": "metric.json"
"$ref": "metricset.json"
},
"minItems": 1
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package schema

const ModelSchema = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "docs/spec/metrics/metric.json",
"$id": "docs/spec/metrics/metricset.json",
"type": "object",
"description": "Metric data captured by an APM agent",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion model/metric/generated/schema/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PayloadSchema = `{
"type": "array",
"items": {
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "docs/spec/metrics/metric.json",
"$id": "docs/spec/metrics/metricset.json",
"type": "object",
"description": "Metric data captured by an APM agent",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion processor/stream/stream_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var models = []struct {
span.V2DecodeEvent,
},
{
"metric",
"metricset",
metric.ModelSchema(),
metric.DecodeMetric,
},
Expand Down
2 changes: 1 addition & 1 deletion script/inline_schemas/inline_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
{"errors/v2_error.json", "model/error/generated/schema/error.go", "ModelSchema"},
{"transactions/v2_transaction.json", "model/transaction/generated/schema/transaction.go", "ModelSchema"},
{"spans/v2_span.json", "model/span/generated/schema/transaction.go", "ModelSchema"},
{"metrics/metric.json", "model/metric/generated/schema/metric.go", "ModelSchema"},
{"metrics/metricset.json", "model/metric/generated/schema/metricset.go", "ModelSchema"},
}
for _, schemaInfo := range schemaPaths {
file := filepath.Join(filepath.Dir(basePath), schemaInfo.path)
Expand Down
2 changes: 1 addition & 1 deletion testdata/intake-v2/invalid-json-metadata.ndjson
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"metadata": {"invalid-json"}}
{"metric": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{"metricset": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
2 changes: 1 addition & 1 deletion testdata/intake-v2/invalid-metadata-2.ndjson
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"not": "metadata"}
{"metric": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{"metricset": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}

2 changes: 1 addition & 1 deletion testdata/intake-v2/invalid-metadata.ndjson
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"metadata": {"user": null}}
{"metric": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{"metricset": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}

4 changes: 2 additions & 2 deletions testdata/intake-v2/metrics.ndjson
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"metadata": {"user": null, "process": {"ppid": null, "pid": 1234, "argv": null, "title": null}, "system": null, "service": {"name": "1234_service-12a3", "language": {"version": null, "name":"ecmascript"}, "agent": {"version": "3.14.0", "name": "elastic-node"}, "environment": null, "framework": null,"version": null, "runtime": null}}}
{"metric": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{ "metric": { "samples": { "go.memstats.heap.sys.bytes": { "value": 6.520832e+06 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{"metricset": { "samples": { "byte_counter": { "value": 1 }, "short_counter": { "value": 227 }, "integer_gauge": { "value": 42767 }, "long_gauge": { "value": 3147483648 }, "float_gauge": { "value": 9.16 }, "double_gauge": { "value": 3.141592653589793 }, "dotted.float.gauge": { "value": 6.12 }, "negative.d.o.t.t.e.d": { "value": -1022 } }, "tags": { "code": "200", "some.other.code": "abc" }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{ "metricset": { "samples": { "go.memstats.heap.sys.bytes": { "value": 6.520832e+06 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
2 changes: 1 addition & 1 deletion testdata/intake-v2/minimal_process.ndjson
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
{ "error": {"id": "abcdef0123456789", "timestamp": "2018-08-09T15:04:05.999Z","log": {"level": "custom log level","message": "Cannot read property 'baz' of undefined"}}}
{ "span": { "id": "0123456a89012345", "trace_id": "0123456789abcdef0123456789abcdef", "transaction_id": "ab23456a89012345", "parent": 1, "name": "GET /api/types", "type": "request", "start": 1.845, "duration": 3.5642981, "stacktrace": [], "context": {} }}
{ "transaction": { "trace_id": "01234567890123456789abcdefabcdef", "id": "abcdef1478523690", "type": "request", "duration": 32.592981, "timestamp": "2018-08-30T18:53:27.154Z", "result": "200", "context": null, "spans": null, "sampled": null, "span_count": null }}
{ "metric": { "samples": { "go.memstats.heap.sys.bytes": { "value": 61235 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{ "metricset": { "samples": { "go.memstats.heap.sys.bytes": { "value": 61235 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
2 changes: 1 addition & 1 deletion testdata/intake-v2/minimal_service.ndjson
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"metadata": { "service": {"name": "1234_service-12a3", "language": {"name": "ecmascript"}, "agent": {"version": "3.14.0", "name": "elastic-node"}}}}
{ "error": {"id": "abcdef0123456789", "timestamp": "2018-08-09T15:04:05.999Z","log": {"level": "custom log level","message": "Cannot read property 'baz' of undefined"}}}
{ "metric": { "samples": { "go.memstats.heap.sys.bytes": { "value": 61235 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
{ "metricset": { "samples": { "go.memstats.heap.sys.bytes": { "value": 61235 } }, "timestamp": "2017-05-30T18:53:42.281Z" }}
2 changes: 1 addition & 1 deletion testdata/intake-v2/optional-timestamps.ndjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"metadata": {"user": {"id": "123", "email": "[email protected]", "username": "john"}, "process": {"ppid": 6789, "pid": 1234,"argv": ["node", "server.js"], "title": "node"}, "system": {"platform": "darwin", "hostname": "prod1.example.com", "architecture": "x64"}, "service": {"name": "backendspans", "language": {"version": "8", "name": "ecmascript"}, "agent": {"version": "3.14.0", "name": "elastic-node"}, "environment": "staging", "framework": {"version": "1.2.3", "name": "Express"}, "version": "5.1.3", "runtime": {"version": "8.0.0", "name": "node"}}}}
{"transaction": {"name": "tx1", "id": "1111222233334444", "trace_id": "abcdefabcdef01234567890123456789", "duration": 12, "type": "request"}}
{"span": {"name": "sp1","trace_id": "abcdefabcdef01234567890123456789", "duration": 20, "start": 10, "type": "db", "id": "0147258369abcdef", "transaction_id": "fedcba0123456789"}}
{"metric": {"samples": {"my-metric": {"value": 99}}, "timestamp": "2018-01-01T11:00:00Z"}}
{"metricset": {"samples": {"my-metric": {"value": 99}}, "timestamp": "2018-01-01T11:00:00Z"}}

0 comments on commit 0bc7120

Please sign in to comment.