[11:49:40] FIRING: LogstashIndexingFailures: Logstash Elasticsearch indexing errors - https://wikitech.wikimedia.org/wiki/Logstash#Indexing_errors - https://grafana.wikimedia.org/d/000000561/logstash?viewPanel=40&var-datasource=codfw%20prometheus/ops - https://alerts.wikimedia.org/?q=alertname%3DLogstashIndexingFailures [11:54:40] FIRING: [2x] LogstashIndexingFailures: Logstash Elasticsearch indexing errors - https://wikitech.wikimedia.org/wiki/Logstash#Indexing_errors - https://alerts.wikimedia.org/?q=alertname%3DLogstashIndexingFailures [13:24:40] FIRING: [2x] LogstashIndexingFailures: Logstash Elasticsearch indexing errors - https://wikitech.wikimedia.org/wiki/Logstash#Indexing_errors - https://alerts.wikimedia.org/?q=alertname%3DLogstashIndexingFailures [13:44:41] RESOLVED: LogstashIndexingFailures: Logstash Elasticsearch indexing errors - https://wikitech.wikimedia.org/wiki/Logstash#Indexing_errors - https://grafana.wikimedia.org/d/000000561/logstash?viewPanel=40&var-datasource=eqiad%20prometheus/ops - https://alerts.wikimedia.org/?q=alertname%3DLogstashIndexingFailures [14:22:25] FIRING: SystemdUnitFailed: grafana-loki.service on grafana2001:9100 - https://wikitech.wikimedia.org/wiki/Monitoring/check_systemd_state - https://grafana.wikimedia.org/d/g-AaZRFWk/systemd-status - https://alerts.wikimedia.org/?q=alertname%3DSystemdUnitFailed [14:37:25] RESOLVED: SystemdUnitFailed: grafana-loki.service on grafana2001:9100 - https://wikitech.wikimedia.org/wiki/Monitoring/check_systemd_state - https://grafana.wikimedia.org/d/g-AaZRFWk/systemd-status - https://alerts.wikimedia.org/?q=alertname%3DSystemdUnitFailed [14:55:31] hi! I have a question about a statslib / StatsFactory migration (specifically T359248) and hope this is the right place for it (this channel was mentioned in the presentation linked there at least ^^) [14:55:32] T359248: Migrate MediaWiki.wikibase.client.pageupdates.* to statslib - https://phabricator.wikimedia.org/T359248 [14:55:56] are there any existing tests that assert which metrics some piece of code emits, or recommendations for such tests? [14:55:57] i [14:56:20] * i.e., assert that it increments counter X, measures gauge Y, copied to statsd at Z… [14:57:07] the StatsFactory / MetricInterface “builder”-like interface seems nice to use, but somewhat annoying to mock, so I’m not sure writing a bunch of mocks with expects() in the test is the best approach [14:57:51] my suspicion is that it might be best to create a custom StatsFactory (and inject that into the code being tested), with a NullEmitter and a custom StatsCache, and assert the result of $statsCache->getAllMetrics() at the end of the test [14:58:13] but StatsFactory isn’t currently stable to create, so doing that from an extension would technically violate the stable interface policy :S [15:00:43] for reference, the existing test I need to adapt from StatsdDataFactoryInterface to StatsFactory is https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/5763efa994/client/tests/phpunit/integration/includes/Changes/WikiPageUpdaterTest.php#79 [15:01:45] also, I’m probably going afk pretty soon, but I’ll stay in the channel and see if there was a reply on Monday [15:01:54] so hopefully I explained my question well enough that it can be answered asynchronously :) [15:02:17] Perhaps I should put more thought into a "happy path" for testing. :) [15:02:42] For now, we've sorta hacked around it with mocks as you described. c.f. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/993705 [15:02:52] * Lucas_WMDE looks [15:03:13] ooh, even putting an expectation on the emitter [15:03:26] I guess that lets you specify the expected format as a string, which is nice [15:03:38] instead of assertEquals’ing a bunch of metric objects [15:04:58] Yes. :) This test exercises the whole pipe, including the formatter and transport. [15:05:20] that looks pretty nice to me overall [15:05:33] However, given that we continue to experience the need to add tests, maybe the experience can be improved. [15:05:36] so maybe I’ll just close my eyes and pretend I’m allowed to write `new StatsFactory`, and do that [15:05:42] and leave a task for improving the happy path in your backlog? :) [15:05:51] to potentially improve the tests later [15:06:02] SGTM [15:06:19] okay, thanks! [15:06:31] Thanks for reaching out! [15:12:15] created T368740 [15:12:16] T368740: Simplify asserting expected stats in unit / integration tests - https://phabricator.wikimedia.org/T368740 [15:13:51] * Lucas_WMDE afk, thanks again for the quick reply!