Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: first metric (verb call counter) (#2130)
Instrument our first metric. Next: check if this metric pipes through to DD correctly. Locally, the output via `just otel-stream` looks like: ``` ScopeMetrics #1 ScopeMetrics SchemaURL: InstrumentationScope ftl.call Metric #0 Descriptor: -> Name: requests -> Description: Count of FTL verb calls via the controller -> Unit: -> DataType: Sum -> IsMonotonic: true -> AggregationTemporality: Cumulative NumberDataPoints #0 Data point attributes: -> ftl.module.name: Str(time) -> ftl.verb.name: Str(time) StartTimestamp: 2024-07-23 00:25:50.782759 +0000 UTC Timestamp: 2024-07-23 00:25:59.069408 +0000 UTC Value: 1 NumberDataPoints #1 Data point attributes: -> ftl.module.name: Str(echo) -> ftl.verb.name: Str(echo) StartTimestamp: 2024-07-23 00:25:50.782759 +0000 UTC Timestamp: 2024-07-23 00:25:59.069408 +0000 UTC Value: 1 {"kind": "exporter", "data_type": "metrics", "name": "debug"} 2024-07-23T00:26:00.745Z info MetricsExporter {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 10, "data points": 15} 2024-07-23 T00:26:00.745Z info ResourceMetrics #0 Resource SchemaURL: https://opentelemetry.io/schemas/1.25.0 Resource attributes: -> service.name: Str(echo) -> service.version: Str(HEAD) -> telemetry.sdk.language: Str(go) -> telemetry.sdk.name: Str(opentelemetry) -> telemetry.sdk.version: Str(1.27.0) ``` Interestingly, it looks like the metric logging races in a slightly inconsistent way. If you call a verb that calls another verb, you would expect just one verb to get bumped to 1 first, and then the other verb. Sometimes, it does behave that way. However, other times, the first time it appears in `otel-stream` _will already_ be with both verbs. So essentially, there is no guarantee that transient values actually show up in the stream, but the ultimate value will be correct. This does appear the report the correct count in even error cases. e.g. I tried calling `echo` before the deploy was done, so that the verb call would fail without calling out to `time`. It would correctly log a single call in that case. And if you made another successful call afterwards, the metric would correctly increment to include both successful calls.
- Loading branch information