@toa.io/definitions 1.0.0-alpha.302 → 1.0.0-alpha.304

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/digest/extensions.cadence.json +1 -1
  2. package/digest/extensions.configuration.json +1 -1
  3. package/digest/extensions.exposition.json +1 -1
  4. package/digest/extensions.introspection.json +1 -1
  5. package/digest/extensions.realtime.json +1 -1
  6. package/package.json +7 -7
  7. package/schemas/extensions.exposition/query.cos.yaml +2 -0
  8. package/schemas/extensions.telemetry/declaration.cos.yaml +42 -0
  9. package/transpiled/extensions.exposition/manifest.js +16 -0
  10. package/transpiled/extensions.exposition/manifest.js.map +1 -1
  11. package/transpiled/extensions.telemetry/const.d.ts +1 -0
  12. package/transpiled/extensions.telemetry/const.js +1 -0
  13. package/transpiled/extensions.telemetry/const.js.map +1 -1
  14. package/transpiled/extensions.telemetry/context.js +3 -2
  15. package/transpiled/extensions.telemetry/context.js.map +1 -1
  16. package/transpiled/extensions.telemetry/deployment.d.ts +6 -1
  17. package/transpiled/extensions.telemetry/deployment.js +16 -1
  18. package/transpiled/extensions.telemetry/deployment.js.map +1 -1
  19. package/transpiled/extensions.telemetry/index.d.ts +3 -1
  20. package/transpiled/extensions.telemetry/index.js +2 -1
  21. package/transpiled/extensions.telemetry/index.js.map +1 -1
  22. package/transpiled/extensions.telemetry/manifest.d.ts +10 -0
  23. package/transpiled/extensions.telemetry/manifest.js +36 -0
  24. package/transpiled/extensions.telemetry/manifest.js.map +1 -0
  25. package/transpiled/extensions.telemetry/schemas.d.ts +3 -0
  26. package/transpiled/extensions.telemetry/schemas.js +6 -0
  27. package/transpiled/extensions.telemetry/schemas.js.map +1 -0
  28. package/transpiled/extensions.telemetry/types.d.ts +13 -0
  29. package/transpiled/extensions.telemetry/types.js +2 -0
  30. package/transpiled/extensions.telemetry/types.js.map +1 -0
@@ -1 +1 @@
1
- [{"label":"introspection-edges","manifest":{"namespace":"introspection","name":"edges","entity":{"associated":true,"properties":{"src":{"description":"What caused the call — another operation, an event, or a service","type":"object","properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"},"event":{"type":"string"},"service":{"type":"string"}}},"dst":{"description":"What was called","type":"object","required":["namespace","component","operation"],"properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"}}},"sample":{"description":"The last call observed on this edge","type":"object","required":["at","outcome"],"properties":{"at":{"type":"integer"},"input":{},"outcome":{"type":"string"}}},"id":{"type":"string","pattern":"^[a-fA-F0-9]{32}$"},"VERSION":{"type":"integer","minimum":0},"CREATED":{"type":"integer","format":"epoch-millis"},"UPDATED":{"type":"integer","format":"epoch-millis"},"DELETED":{"type":"integer","format":"epoch-millis","nullable":true},"REGION":{"type":"integer","minimum":0}},"required":["src","dst","id","VERSION","CREATED","UPDATED","DELETED","REGION"],"storage":"@toa.io/storages.mongodb","migrations":[{"id":"system:0000-property-names","steps":[{"update":{"filter":{"_version":{"$exists":true}},"update":{"$rename":{"_version":"VERSION","_created":"CREATED","_updated":"UPDATED","_deleted":"DELETED"}}}}],"prototype":"system"},{"id":"system:0001-epoch-millis","steps":[{"update":{"filter":{"CREATED":{"$type":"number"}},"update":[{"$set":{"CREATED":{"$toDate":{"$toLong":"$CREATED"}},"UPDATED":{"$toDate":{"$toLong":"$UPDATED"}},"DELETED":{"$toDate":{"$toLong":"$DELETED"}}}}]}}],"prototype":"system"},{"id":"system:0002-region","steps":[{"update":{"filter":{"REGION":{"$exists":false}},"update":{"$set":{"REGION":0}}}}],"prototype":"system"}],"custom":false},"operations":{"merge":{"concurrency":"retry","input":{"type":"object","properties":{"edges":{"description":"What each replica observed since its last flush, by edge id","type":"object","additionalProperties":{"type":"object","properties":{"src":{"description":"What caused the call — another operation, an event, or a service","type":"object","properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"},"event":{"type":"string"},"service":{"type":"string"}}},"dst":{"description":"What was called","type":"object","required":["namespace","component","operation"],"properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"}}},"sample":{"description":"The last call observed on this edge","type":"object","required":["at","outcome"],"properties":{"at":{"type":"integer"},"input":{},"outcome":{"type":"string"}}}},"required":["src","dst"]}}},"required":["edges"]},"type":"transition","scope":"objects","bridge":"@toa.io/bridges.node","output":{},"bindings":["@toa.io/bindings.amqp"]},"assign":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]},"ensure":{"type":"effect","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"enumerate":{"type":"observation","scope":"objects","output":{},"bindings":["@toa.io/bindings.amqp"]},"observe":{"type":"observation","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"stream":{"type":"observation","scope":"stream","output":{},"bindings":["@toa.io/bindings.amqp"]},"terminate":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]}},"path":"@toa.io/extensions.introspection/components/introspection.edges","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","extensions":{"@toa.io/extensions.telemetry":null,"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":false,"@toa.io/extensions.exposition":{"routes":[{"path":"/introspection/edges","node":{"routes":[{"path":"/","node":{"routes":[{"path":"/:id","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"observe","query":{},"paged":false,"namespace":"introspection","component":"edges"},"directives":[]}],"directives":[]}}],"methods":[{"verb":"GET","mapping":{"endpoint":"enumerate","query":{"limit":{"value":10000,"range":[1,10000]}},"paged":true,"namespace":"introspection","component":"edges"},"directives":[]}],"directives":[{"family":"auth","name":"role","value":"system:introspection"},{"family":"io","name":"output","value":true},{"family":"cache","name":"control","value":"max-age=60, public"}]}}],"methods":[],"directives":[],"isolated":true}}],"methods":[],"directives":[]}},"version":"12b1e242","prototype":{"prototype":null,"path":"@toa.io/prototype","operations":{"transit":{"bridge":"@toa.io/bridges.node"},"assign":{"bridge":"@toa.io/bridges.node"},"ensure":{"bridge":"@toa.io/bridges.node"},"enumerate":{"bridge":"@toa.io/bridges.node"},"observe":{"bridge":"@toa.io/bridges.node"},"stream":{"bridge":"@toa.io/bridges.node"},"terminate":{"bridge":"@toa.io/bridges.node"}}},"events":{"created":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"deleted":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"sync":{"conditioned":false,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"updated":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"}}}},{"label":"introspection-nodes","manifest":{"namespace":"introspection","name":"nodes","entity":{"associated":true,"properties":{"version":{"type":"string"},"entity":{},"operations":{},"events":{},"receivers":{},"extensions":{},"namespace":{"type":"string"},"component":{"type":"string"},"id":{"type":"string","pattern":"^[a-fA-F0-9]{32}$"},"VERSION":{"type":"integer","minimum":0},"CREATED":{"type":"integer","format":"epoch-millis"},"UPDATED":{"type":"integer","format":"epoch-millis"},"DELETED":{"type":"integer","format":"epoch-millis","nullable":true},"REGION":{"type":"integer","minimum":0}},"required":["namespace","component","id","VERSION","CREATED","UPDATED","DELETED","REGION"],"storage":"@toa.io/storages.mongodb","migrations":[{"id":"system:0000-property-names","steps":[{"update":{"filter":{"_version":{"$exists":true}},"update":{"$rename":{"_version":"VERSION","_created":"CREATED","_updated":"UPDATED","_deleted":"DELETED"}}}}],"prototype":"system"},{"id":"system:0001-epoch-millis","steps":[{"update":{"filter":{"CREATED":{"$type":"number"}},"update":[{"$set":{"CREATED":{"$toDate":{"$toLong":"$CREATED"}},"UPDATED":{"$toDate":{"$toLong":"$UPDATED"}},"DELETED":{"$toDate":{"$toLong":"$DELETED"}}}}]}}],"prototype":"system"},{"id":"system:0002-region","steps":[{"update":{"filter":{"REGION":{"$exists":false}},"update":{"$set":{"REGION":0}}}}],"prototype":"system"}],"custom":false},"operations":{"merge":{"concurrency":"retry","input":{"type":"object","properties":{"nodes":{"description":"What each announced component describes of itself, by its id","type":"object","additionalProperties":{"type":"object","properties":{"version":{"type":"string"},"entity":{},"operations":{},"events":{},"receivers":{},"extensions":{},"namespace":{"type":"string"},"component":{"type":"string"}},"required":["namespace","component"]}}},"required":["nodes"]},"type":"transition","scope":"objects","bridge":"@toa.io/bridges.node","output":{},"bindings":["@toa.io/bindings.amqp"]},"assign":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]},"ensure":{"type":"effect","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"enumerate":{"type":"observation","scope":"objects","output":{},"bindings":["@toa.io/bindings.amqp"]},"observe":{"type":"observation","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"stream":{"type":"observation","scope":"stream","output":{},"bindings":["@toa.io/bindings.amqp"]},"terminate":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]}},"path":"@toa.io/extensions.introspection/components/introspection.nodes","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","extensions":{"@toa.io/extensions.telemetry":null,"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":false,"@toa.io/extensions.exposition":{"routes":[{"path":"/introspection/nodes","node":{"routes":[{"path":"/","node":{"routes":[{"path":"/:id","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"observe","query":{},"paged":false,"namespace":"introspection","component":"nodes"},"directives":[]}],"directives":[]}}],"methods":[{"verb":"GET","mapping":{"endpoint":"enumerate","query":{"limit":{"value":1000,"range":[1,1000]}},"paged":true,"namespace":"introspection","component":"nodes"},"directives":[]}],"directives":[{"family":"auth","name":"role","value":"system:introspection"},{"family":"io","name":"output","value":true},{"family":"cache","name":"control","value":"max-age=60, public"}]}}],"methods":[],"directives":[],"isolated":true}}],"methods":[],"directives":[]}},"version":"8ef7a79b","prototype":{"prototype":null,"path":"@toa.io/prototype","operations":{"transit":{"bridge":"@toa.io/bridges.node"},"assign":{"bridge":"@toa.io/bridges.node"},"ensure":{"bridge":"@toa.io/bridges.node"},"enumerate":{"bridge":"@toa.io/bridges.node"},"observe":{"bridge":"@toa.io/bridges.node"},"stream":{"bridge":"@toa.io/bridges.node"},"terminate":{"bridge":"@toa.io/bridges.node"}}},"events":{"created":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"deleted":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"sync":{"conditioned":false,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"updated":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"}}}}]
1
+ [{"label":"introspection-edges","manifest":{"namespace":"introspection","name":"edges","entity":{"associated":true,"properties":{"src":{"description":"What caused the call — another operation, an event, or a service","type":"object","properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"},"event":{"type":"string"},"service":{"type":"string"}}},"dst":{"description":"What was called","type":"object","required":["namespace","component","operation"],"properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"}}},"sample":{"description":"The last call observed on this edge","type":"object","required":["at","outcome"],"properties":{"at":{"type":"integer"},"input":{},"outcome":{"type":"string"}}},"id":{"type":"string","pattern":"^[a-fA-F0-9]{32}$"},"VERSION":{"type":"integer","minimum":0},"CREATED":{"type":"integer","format":"epoch-millis"},"UPDATED":{"type":"integer","format":"epoch-millis"},"DELETED":{"type":"integer","format":"epoch-millis","nullable":true},"REGION":{"type":"integer","minimum":0}},"required":["src","dst","id","VERSION","CREATED","UPDATED","DELETED","REGION"],"storage":"@toa.io/storages.mongodb","migrations":[{"id":"system:0000-property-names","steps":[{"update":{"filter":{"_version":{"$exists":true}},"update":{"$rename":{"_version":"VERSION","_created":"CREATED","_updated":"UPDATED","_deleted":"DELETED"}}}}],"prototype":"system"},{"id":"system:0001-epoch-millis","steps":[{"update":{"filter":{"CREATED":{"$type":"number"}},"update":[{"$set":{"CREATED":{"$toDate":{"$toLong":"$CREATED"}},"UPDATED":{"$toDate":{"$toLong":"$UPDATED"}},"DELETED":{"$toDate":{"$toLong":"$DELETED"}}}}]}}],"prototype":"system"},{"id":"system:0002-region","steps":[{"update":{"filter":{"REGION":{"$exists":false}},"update":{"$set":{"REGION":0}}}}],"prototype":"system"}],"custom":false},"operations":{"merge":{"concurrency":"retry","input":{"type":"object","properties":{"edges":{"description":"What each replica observed since its last flush, by edge id","type":"object","additionalProperties":{"type":"object","properties":{"src":{"description":"What caused the call — another operation, an event, or a service","type":"object","properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"},"event":{"type":"string"},"service":{"type":"string"}}},"dst":{"description":"What was called","type":"object","required":["namespace","component","operation"],"properties":{"namespace":{"type":"string"},"component":{"type":"string"},"operation":{"type":"string"}}},"sample":{"description":"The last call observed on this edge","type":"object","required":["at","outcome"],"properties":{"at":{"type":"integer"},"input":{},"outcome":{"type":"string"}}}},"required":["src","dst"]}}},"required":["edges"]},"type":"transition","scope":"objects","bridge":"@toa.io/bridges.node","output":{},"bindings":["@toa.io/bindings.amqp"]},"assign":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]},"ensure":{"type":"effect","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"enumerate":{"type":"observation","scope":"objects","output":{},"bindings":["@toa.io/bindings.amqp"]},"observe":{"type":"observation","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"stream":{"type":"observation","scope":"stream","output":{},"bindings":["@toa.io/bindings.amqp"]},"terminate":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]}},"path":"@toa.io/extensions.introspection/components/introspection.edges","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","extensions":{"@toa.io/extensions.telemetry":{},"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":false,"@toa.io/extensions.exposition":{"routes":[{"path":"/introspection/edges","node":{"routes":[{"path":"/","node":{"routes":[{"path":"/:id","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"observe","query":{},"paged":false,"namespace":"introspection","component":"edges"},"directives":[]}],"directives":[]}}],"methods":[{"verb":"GET","mapping":{"endpoint":"enumerate","query":{"limit":{"value":10000,"range":[1,10000]}},"paged":true,"namespace":"introspection","component":"edges"},"directives":[]}],"directives":[{"family":"auth","name":"role","value":"system:introspection"},{"family":"io","name":"output","value":true},{"family":"cache","name":"control","value":"max-age=60, public"}]}}],"methods":[],"directives":[],"isolated":true}}],"methods":[],"directives":[]}},"version":"9ab23877","prototype":{"prototype":null,"path":"@toa.io/prototype","operations":{"transit":{"bridge":"@toa.io/bridges.node"},"assign":{"bridge":"@toa.io/bridges.node"},"ensure":{"bridge":"@toa.io/bridges.node"},"enumerate":{"bridge":"@toa.io/bridges.node"},"observe":{"bridge":"@toa.io/bridges.node"},"stream":{"bridge":"@toa.io/bridges.node"},"terminate":{"bridge":"@toa.io/bridges.node"}}},"events":{"created":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"deleted":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"sync":{"conditioned":false,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"updated":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"}}}},{"label":"introspection-nodes","manifest":{"namespace":"introspection","name":"nodes","entity":{"associated":true,"properties":{"version":{"type":"string"},"entity":{},"operations":{},"events":{},"receivers":{},"extensions":{},"namespace":{"type":"string"},"component":{"type":"string"},"id":{"type":"string","pattern":"^[a-fA-F0-9]{32}$"},"VERSION":{"type":"integer","minimum":0},"CREATED":{"type":"integer","format":"epoch-millis"},"UPDATED":{"type":"integer","format":"epoch-millis"},"DELETED":{"type":"integer","format":"epoch-millis","nullable":true},"REGION":{"type":"integer","minimum":0}},"required":["namespace","component","id","VERSION","CREATED","UPDATED","DELETED","REGION"],"storage":"@toa.io/storages.mongodb","migrations":[{"id":"system:0000-property-names","steps":[{"update":{"filter":{"_version":{"$exists":true}},"update":{"$rename":{"_version":"VERSION","_created":"CREATED","_updated":"UPDATED","_deleted":"DELETED"}}}}],"prototype":"system"},{"id":"system:0001-epoch-millis","steps":[{"update":{"filter":{"CREATED":{"$type":"number"}},"update":[{"$set":{"CREATED":{"$toDate":{"$toLong":"$CREATED"}},"UPDATED":{"$toDate":{"$toLong":"$UPDATED"}},"DELETED":{"$toDate":{"$toLong":"$DELETED"}}}}]}}],"prototype":"system"},{"id":"system:0002-region","steps":[{"update":{"filter":{"REGION":{"$exists":false}},"update":{"$set":{"REGION":0}}}}],"prototype":"system"}],"custom":false},"operations":{"merge":{"concurrency":"retry","input":{"type":"object","properties":{"nodes":{"description":"What each announced component describes of itself, by its id","type":"object","additionalProperties":{"type":"object","properties":{"version":{"type":"string"},"entity":{},"operations":{},"events":{},"receivers":{},"extensions":{},"namespace":{"type":"string"},"component":{"type":"string"}},"required":["namespace","component"]}}},"required":["nodes"]},"type":"transition","scope":"objects","bridge":"@toa.io/bridges.node","output":{},"bindings":["@toa.io/bindings.amqp"]},"assign":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]},"ensure":{"type":"effect","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"enumerate":{"type":"observation","scope":"objects","output":{},"bindings":["@toa.io/bindings.amqp"]},"observe":{"type":"observation","scope":"object","output":{},"bindings":["@toa.io/bindings.amqp"]},"stream":{"type":"observation","scope":"stream","output":{},"bindings":["@toa.io/bindings.amqp"]},"terminate":{"type":"assignment","scope":"changeset","output":{},"bindings":["@toa.io/bindings.amqp"]}},"path":"@toa.io/extensions.introspection/components/introspection.nodes","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","extensions":{"@toa.io/extensions.telemetry":{},"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":false,"@toa.io/extensions.exposition":{"routes":[{"path":"/introspection/nodes","node":{"routes":[{"path":"/","node":{"routes":[{"path":"/:id","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"observe","query":{},"paged":false,"namespace":"introspection","component":"nodes"},"directives":[]}],"directives":[]}}],"methods":[{"verb":"GET","mapping":{"endpoint":"enumerate","query":{"limit":{"value":1000,"range":[1,1000]}},"paged":true,"namespace":"introspection","component":"nodes"},"directives":[]}],"directives":[{"family":"auth","name":"role","value":"system:introspection"},{"family":"io","name":"output","value":true},{"family":"cache","name":"control","value":"max-age=60, public"}]}}],"methods":[],"directives":[],"isolated":true}}],"methods":[],"directives":[]}},"version":"86a7ecc9","prototype":{"prototype":null,"path":"@toa.io/prototype","operations":{"transit":{"bridge":"@toa.io/bridges.node"},"assign":{"bridge":"@toa.io/bridges.node"},"ensure":{"bridge":"@toa.io/bridges.node"},"enumerate":{"bridge":"@toa.io/bridges.node"},"observe":{"bridge":"@toa.io/bridges.node"},"stream":{"bridge":"@toa.io/bridges.node"},"terminate":{"bridge":"@toa.io/bridges.node"}}},"events":{"created":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"deleted":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"sync":{"conditioned":false,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"},"updated":{"conditioned":true,"subjective":false,"path":"@toa.io/prototype","bridge":"@toa.io/bridges.node","binding":"@toa.io/bindings.amqp"}}}}]
@@ -1 +1 @@
1
- [{"label":"realtime-streams","manifest":{"namespace":"realtime","name":"streams","operations":{"create":{"input":{"properties":{"key":{"type":"string"},"token":{"type":"string"}},"type":"object"},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false,"output":{},"bindings":["@toa.io/bindings.amqp"]},"push":{"output":{"type":"null"},"bindings":[],"input":{"properties":{"data":{},"key":{"type":"string"},"event":{"type":"string"}},"type":"object","required":["key","event"]},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false}},"path":"@toa.io/extensions.realtime/components/realtime.streams","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","prototype":null,"extensions":{"@toa.io/extensions.telemetry":null,"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":{},"@toa.io/extensions.exposition":{"routes":[{"path":"/realtime/streams","node":{"routes":[{"path":"/:key","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"create","query":null,"paged":false,"namespace":"realtime","component":"streams"},"directives":[]}],"directives":[{"family":"auth","name":"id","value":"key"}]}}],"methods":[],"directives":[]}}],"methods":[],"directives":[]},"@toa.io/extensions.configuration":{"schema":{"properties":{"maxlen":{"type":"number"},"expire":{"type":"number"}},"type":"object","required":["maxlen","expire"]},"defaults":{"maxlen":1000,"expire":300}},"@toa.io/extensions.state":null,"@toa.io/extensions.stash":null},"version":"4912626f"}}]
1
+ [{"label":"realtime-streams","manifest":{"namespace":"realtime","name":"streams","operations":{"create":{"input":{"properties":{"key":{"type":"string"},"token":{"type":"string"}},"type":"object"},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false,"output":{},"bindings":["@toa.io/bindings.amqp"]},"push":{"output":{"type":"null"},"bindings":[],"input":{"properties":{"data":{},"key":{"type":"string"},"event":{"type":"string"}},"type":"object","required":["key","event"]},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false}},"path":"@toa.io/extensions.realtime/components/realtime.streams","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","prototype":null,"extensions":{"@toa.io/extensions.telemetry":{},"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":{},"@toa.io/extensions.exposition":{"routes":[{"path":"/realtime/streams","node":{"routes":[{"path":"/:key","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"create","query":null,"paged":false,"namespace":"realtime","component":"streams"},"directives":[]}],"directives":[{"family":"auth","name":"id","value":"key"}]}}],"methods":[],"directives":[]}}],"methods":[],"directives":[]},"@toa.io/extensions.configuration":{"schema":{"properties":{"maxlen":{"type":"number"},"expire":{"type":"number"}},"type":"object","required":["maxlen","expire"]},"defaults":{"maxlen":1000,"expire":300}},"@toa.io/extensions.state":null,"@toa.io/extensions.stash":null},"version":"97acb9e0"}}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/definitions",
3
- "version": "1.0.0-alpha.302",
3
+ "version": "1.0.0-alpha.304",
4
4
  "type": "module",
5
5
  "description": "What Toa packages declare, read without running them",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -30,9 +30,9 @@
30
30
  "!**/.env*"
31
31
  ],
32
32
  "dependencies": {
33
- "@toa.io/generic": "1.0.0-alpha.301",
34
- "@toa.io/pointer": "1.0.0-alpha.301",
35
- "@toa.io/schemas": "1.0.0-alpha.301"
33
+ "@toa.io/generic": "1.0.0-alpha.304",
34
+ "@toa.io/pointer": "1.0.0-alpha.304",
35
+ "@toa.io/schemas": "1.0.0-alpha.304"
36
36
  },
37
37
  "scripts": {
38
38
  "transpile": "tsc",
@@ -44,8 +44,8 @@
44
44
  "./*": "./transpiled/*/index.js"
45
45
  },
46
46
  "devDependencies": {
47
- "@toa.io/core": "1.0.0-alpha.302",
48
- "openspan": "1.0.0-alpha.301",
47
+ "@toa.io/core": "1.0.0-alpha.304",
48
+ "openspan": "1.0.0-alpha.304",
49
49
  "oxc-parser": "0.149.0"
50
50
  },
51
51
  "peerDependencies": {
@@ -56,5 +56,5 @@
56
56
  "optional": true
57
57
  }
58
58
  },
59
- "gitHead": "3cbbca55a61711db78f98b13e50cf4d1afaf5c08"
59
+ "gitHead": "a95a5a5a64922b11b23142d4acbcee1331ed31aa"
60
60
  }
@@ -19,6 +19,8 @@ properties:
19
19
  type: string
20
20
  projection:
21
21
  type: array
22
+ uniqueItems: true
23
+ minItems: 1
22
24
  items:
23
25
  type: string
24
26
  parameters:
@@ -0,0 +1,42 @@
1
+ # manifest.toa.yaml telemetry declaration: the metrics a component records
2
+ type: object
3
+ properties:
4
+ metrics:
5
+ description: The instruments `context.metrics` carries, by the name each is declared under
6
+ type: object
7
+ propertyNames:
8
+ pattern: ^[a-zA-Z]+([_a-zA-Z0-9]*[a-zA-Z0-9]+)?$
9
+ patternProperties:
10
+ ".*":
11
+ type: object
12
+ properties:
13
+ type:
14
+ description: >
15
+ A counter counts what only ever happens, a gauge is a level at a moment, and a
16
+ histogram is a distribution over buckets fixed here.
17
+ enum: [counter, gauge, histogram]
18
+ unit:
19
+ description: What the values are in
20
+ type: string
21
+ buckets:
22
+ description: Histogram bucket upper bounds, ascending
23
+ type: array
24
+ items:
25
+ type: number
26
+ minItems: 1
27
+ labels:
28
+ description: >
29
+ Label keys, each with the values it admits. A key declared `null` admits any
30
+ value, and its cardinality is the component's own to keep bounded.
31
+ type: [object, "null"]
32
+ propertyNames:
33
+ pattern: ^[a-zA-Z]+([_a-zA-Z0-9]*[a-zA-Z0-9]+)?$
34
+ patternProperties:
35
+ ".*":
36
+ type: [array, "null"]
37
+ items:
38
+ type: [string, number, boolean]
39
+ minItems: 1
40
+ required: [type]
41
+ additionalProperties: false
42
+ additionalProperties: false
@@ -34,7 +34,23 @@ function specifyMethod(method, manifest) {
34
34
  // a page is taken of a collection, and of nothing else: an operation that answers one object
35
35
  // takes no `omit` and no `limit`, and refuses a request that carries them
36
36
  method.mapping.paged = operation.type === 'observation' && operation.scope === 'objects';
37
+ projects(method, operation.type);
37
38
  method.mapping.namespace = manifest.namespace;
38
39
  method.mapping.component = manifest.name;
39
40
  }
41
+ /**
42
+ * What a route projects is what its operation's storage reads, and a read that is written back
43
+ * reads the whole record.
44
+ */
45
+ function projects(method, type) {
46
+ const projection = method.mapping?.query?.projection;
47
+ if (projection === undefined)
48
+ return;
49
+ const endpoint = method.mapping?.endpoint;
50
+ if (type !== 'observation')
51
+ throw new Error(`Method of '${endpoint}' declares a projection, which an operation of type ` +
52
+ `'${type}' does not read`);
53
+ if (projection.includes('id'))
54
+ throw new Error(`Projection of '${endpoint}' names 'id', which is always read`);
55
+ }
40
56
  //# sourceMappingURL=manifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../source/extensions.exposition/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAsC,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,MAAM,UAAU,QAAQ,CAAC,WAAmB,EAAE,QAAkB;IAC9D,IAAI,CAAC,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAE7D,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;IAElE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;IAE1C,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACvB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAE3B,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,IAAI,CAAC,WAAmB,EAAE,SAAiB,EAAE,IAAY;IAChE,MAAM,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G,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAA;IAEzC,IAAI,IAAI,KAAK,aAAa;QACxB,MAAM,IAAI,KAAK,CACb,cAAc,QAAQ,sDAAsD;YAC1E,IAAI,IAAI,iBAAiB,CAC5B,CAAA;IAEH,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,oCAAoC,CAAC,CAAA;AACnF,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export declare const ID = "telemetry";
2
2
  export declare const LOGS_PREFIX: string;
3
3
  export declare const TRACES_ENV: string;
4
+ export declare const METRICS_ENV: string;
4
5
  export declare const READY_ENV = "TOA_TELEMETRY_READY";
@@ -2,5 +2,6 @@ export const ID = 'telemetry';
2
2
  const ENV_PREFIX = 'TOA_TELEMETRY';
3
3
  export const LOGS_PREFIX = ENV_PREFIX + '_LOGS';
4
4
  export const TRACES_ENV = ENV_PREFIX + '_TRACES';
5
+ export const METRICS_ENV = ENV_PREFIX + '_METRICS';
5
6
  export const READY_ENV = 'TOA_TELEMETRY_READY';
6
7
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../source/extensions.telemetry/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG,WAAW,CAAA;AAE7B,MAAM,UAAU,GAAG,eAAe,CAAA;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAA;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,CAAA;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAA"}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../source/extensions.telemetry/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG,WAAW,CAAA;AAE7B,MAAM,UAAU,GAAG,eAAe,CAAA;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAA;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,CAAA;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAA"}
@@ -1,9 +1,10 @@
1
1
  /** What this extension puts on the context of every component, being declared for all. */
2
2
  export function context() {
3
- const imports = { '@toa.io/extensions.telemetry': ['Logs', 'Span'] };
3
+ const imports = { '@toa.io/extensions.telemetry': ['Logs', 'Span', 'Metrics'] };
4
4
  return [
5
5
  { name: 'logs', type: 'Logs', imports },
6
- { name: 'span', type: 'Span', imports }
6
+ { name: 'span', type: 'Span', imports },
7
+ { name: 'metrics', type: 'Metrics', imports }
7
8
  ];
8
9
  }
9
10
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../source/extensions.telemetry/context.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,EAAE,8BAA8B,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IAEpE,OAAO;QACL,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QACvC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;KACxC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../source/extensions.telemetry/context.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,EAAE,8BAA8B,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IAE/E,OAAO;QACL,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QACvC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QACvC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE;KAC9C,CAAA;AACH,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { type ReadyAnnotation } from './ready.ts';
2
2
  import type { Dependency } from '@toa.io/operations';
3
- import type { ExportersConfig, LevelName } from 'openspan';
3
+ import type { ExportersConfig, LevelName, MetersConfig } from 'openspan';
4
4
  export declare function deployment(_: unknown, annotation?: Annotation): Dependency;
5
5
  interface Annotation {
6
6
  logs?: LogsAnnotation & Record<string, LogsAnnotation>;
7
7
  traces?: TracesAnnotation;
8
+ metrics?: MetricsAnnotation;
8
9
  ready?: ReadyAnnotation;
9
10
  }
10
11
  interface LogsAnnotation {
@@ -15,4 +16,8 @@ interface TracesAnnotation {
15
16
  rate?: number;
16
17
  exporters?: ExportersConfig;
17
18
  }
19
+ interface MetricsAnnotation {
20
+ interval?: number;
21
+ exporters?: MetersConfig;
22
+ }
18
23
  export {};
@@ -1,4 +1,4 @@
1
- import { LOGS_PREFIX, READY_ENV, TRACES_ENV } from './const.js';
1
+ import { LOGS_PREFIX, METRICS_ENV, READY_ENV, TRACES_ENV } from './const.js';
2
2
  import { DEFAULT_ANNOTATION, normalizeAnnotation } from './ready.js';
3
3
  export function deployment(_, annotation) {
4
4
  const variables = { global: [] };
@@ -6,6 +6,8 @@ export function deployment(_, annotation) {
6
6
  addLogsVariables(annotation.logs, variables);
7
7
  if (annotation?.traces !== undefined)
8
8
  addTracesVariables(annotation.traces, variables);
9
+ if (annotation?.metrics !== undefined)
10
+ addMetricsVariables(annotation.metrics, variables);
9
11
  const ready = normalizeAnnotation(annotation?.ready);
10
12
  if (ready === false) {
11
13
  variables.global.push({ name: READY_ENV, value: JSON.stringify(false) });
@@ -48,4 +50,17 @@ function addTracesVariables(annotation, variables) {
48
50
  value: JSON.stringify({ sample, rate, exporters })
49
51
  });
50
52
  }
53
+ function addMetricsVariables(annotation, variables) {
54
+ const { interval, exporters } = annotation;
55
+ if (interval !== undefined)
56
+ if (!(typeof interval === 'number' && interval > 0))
57
+ throw new Error('telemetry.metrics.interval must be a positive number');
58
+ if (exporters?.otlp !== undefined)
59
+ if (typeof exporters.otlp.endpoint !== 'string')
60
+ throw new Error('telemetry.metrics.exporters.otlp.endpoint is required');
61
+ variables.global.push({
62
+ name: METRICS_ENV,
63
+ value: JSON.stringify({ interval, exporters })
64
+ });
65
+ }
51
66
  //# sourceMappingURL=deployment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../source/extensions.telemetry/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAwB,MAAM,YAAY,CAAA;AAI1F,MAAM,UAAU,UAAU,CAAC,CAAU,EAAE,UAAuB;IAC5D,MAAM,SAAS,GAAc,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;IAE3C,IAAI,UAAU,EAAE,IAAI,KAAK,SAAS;QAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAEhF,IAAI,UAAU,EAAE,MAAM,KAAK,SAAS;QAAE,kBAAkB,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtF,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAEpD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACpB,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAExE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAA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AE,UAAU;QAChB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACnD,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,UAA6B,EAAE,SAAoB;IAC9E,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;IAE1C,IAAI,QAAQ,KAAK,SAAS;QACxB,IAAI,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IAE3E,IAAI,SAAS,EAAE,IAAI,KAAK,SAAS;QAC/B,IAAI,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC7C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAE5E,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;KAC/C,CAAC,CAAA;AACJ,CAAC"}
@@ -1,5 +1,7 @@
1
1
  export { deployment } from './deployment.ts';
2
- export { ID, LOGS_PREFIX, TRACES_ENV, READY_ENV } from './const.ts';
2
+ export { ID, LOGS_PREFIX, TRACES_ENV, METRICS_ENV, READY_ENV } from './const.ts';
3
3
  export { DEFAULT_ANNOTATION, normalizeAnnotation } from './ready.ts';
4
4
  export type { ReadyAnnotation, ReadyConfig } from './ready.ts';
5
5
  export { context } from './context.ts';
6
+ export { manifest } from './manifest.ts';
7
+ export type { Declaration, Instrument } from './types.ts';
@@ -1,5 +1,6 @@
1
1
  export { deployment } from './deployment.js';
2
- export { ID, LOGS_PREFIX, TRACES_ENV, READY_ENV } from './const.js';
2
+ export { ID, LOGS_PREFIX, TRACES_ENV, METRICS_ENV, READY_ENV } from './const.js';
3
3
  export { DEFAULT_ANNOTATION, normalizeAnnotation } from './ready.js';
4
4
  export { context } from './context.js';
5
+ export { manifest } from './manifest.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { Declaration } from './types.ts';
2
+ /**
3
+ * The `telemetry:` block of a component manifest: the metrics `context.metrics` carries. Read
4
+ * here rather than left to fail at boot, so that a declaration a deployment cannot honour is a
5
+ * deployment that does not happen.
6
+ *
7
+ * A component that declares nothing still has a declaration — telemetry is predefined, so every
8
+ * component gets one — and an absent block is an aspect that carries no instruments.
9
+ */
10
+ export declare function manifest(declaration: Declaration | null | undefined): Declaration;
@@ -0,0 +1,36 @@
1
+ import { UNDECLARED } from 'openspan';
2
+ import * as schemas from './schemas.js';
3
+ /**
4
+ * The `telemetry:` block of a component manifest: the metrics `context.metrics` carries. Read
5
+ * here rather than left to fail at boot, so that a declaration a deployment cannot honour is a
6
+ * deployment that does not happen.
7
+ *
8
+ * A component that declares nothing still has a declaration — telemetry is predefined, so every
9
+ * component gets one — and an absent block is an aspect that carries no instruments.
10
+ */
11
+ export function manifest(declaration) {
12
+ const normalized = declaration ?? {};
13
+ schemas.declaration.validate(normalized, 'Invalid telemetry declaration');
14
+ for (const [name, instrument] of Object.entries(normalized.metrics ?? {}))
15
+ validate(name, instrument);
16
+ return normalized;
17
+ }
18
+ function validate(name, instrument) {
19
+ if (instrument.type === 'histogram') {
20
+ if (instrument.buckets === undefined)
21
+ throw new Error(`Histogram '${name}' declares no buckets`);
22
+ ascending(name, instrument.buckets);
23
+ }
24
+ else if (instrument.buckets !== undefined)
25
+ throw new Error(`Buckets are a histogram's, and '${name}' is a ${instrument.type}`);
26
+ for (const [label, values] of Object.entries(instrument.labels ?? {}))
27
+ if (values !== null && values.includes(UNDECLARED))
28
+ throw new Error(`Label '${label}' of '${name}' enumerates '${UNDECLARED}', which is what a value ` +
29
+ 'outside the enumeration is recorded as');
30
+ }
31
+ function ascending(name, buckets) {
32
+ for (let i = 1; i < buckets.length; i++)
33
+ if (buckets[i] <= buckets[i - 1])
34
+ throw new Error(`Buckets of '${name}' must ascend`);
35
+ }
36
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../source/extensions.telemetry/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,WAA2C;IAClE,MAAM,UAAU,GAAgB,WAAW,IAAI,EAAE,CAAA;IAEjD,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAc,UAAU,EAAE,+BAA+B,CAAC,CAAA;IAEtF,KAAK,MAAM,CAAC,IAAI,E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';
3
+ export declare const declaration: Schema<Declaration>;
@@ -0,0 +1,6 @@
1
+ import { resolve } from 'node:path';
2
+ import * as schemas from '@toa.io/schemas';
3
+ const path = resolve(import.meta.dirname, '../../schemas/extensions.telemetry');
4
+ const namespace = schemas.namespace(path);
5
+ export const declaration = namespace.schema('declaration');
6
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../source/extensions.telemetry/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAI1C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,oCAAoC,CAAC,CAAA;AAC/E,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAwB,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ /** What one component declares under `telemetry:`. */
2
+ export interface Declaration {
3
+ metrics?: Record<string, Instrument>;
4
+ }
5
+ export interface Instrument {
6
+ type: 'counter' | 'gauge' | 'histogram';
7
+ /** what the values are in */
8
+ unit?: string;
9
+ /** histogram bucket upper bounds, ascending */
10
+ buckets?: number[];
11
+ /** label keys, each with the values it admits, or `null` where it admits any */
12
+ labels?: Record<string, Array<string | number | boolean> | null> | null;
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../source/extensions.telemetry/types.ts"],"names":[],"mappings":""}