Page MenuHomePhabricator

[PHP] Metrics Platform client library validation error(s)
Closed, ResolvedPublic

Description

Per @DMartin-WMF on Slack:

Hi again @phuedx - I'm afraid I'm still stuck on the ValidationError for the missing property agent. I added the agent_ properties in the stream definition:

 'provide_values' => [
   'agent_client_platform_family',
   'agent_client_platform',
.  'agent_release_status',
   ....

but it hasn't made a difference.
Then I also explicitly include a hardcoded value for agent in interactionData (as a temporary workaround), but no luck there either. In both cases, I'm still seeing the same ValidationError that I pasted in above.
Is there anything else that I can try?
PS - My PHP code currently looks like this:

$interactionData = [
  'agent' => [ 'client_platform' => 'mediawiki_js', 'client_platform_family' => 'desktop_browser' ],
  'action_source' => 'value_for_action_source',
];
EventLogging::getMetricsPlatformClient()->submitInteraction('submit_interaction_stream',
  '/analytics/product_metrics/web/base/1.0.0', 'init', $interactionData );

(And the ValidationError appears with or without the agent property in $interactionData.)
I see these possibly relevant messages in mw-debug-www.log:

[EventLogging] wgEventLoggingBaseUri has not been configured.
[EventBus] Using event intake service eventgate-analytics-external for stream submit_interaction_stream.
[EventBus] Unable to deliver all events: 400: 1 out of 1 events were invalid and not accepted.

Event Timeline

phuedx triaged this task as Unbreak Now! priority.Apr 10 2024, 7:09 AM
phuedx updated the task description. (Show Details)

Thanks for creating this ticket, @phuedx . Also worth noting - For this little test, in LocalSettings.php, I have a stream declaration for submit_interaction_stream, as shown near the end of How_to/Setup_Mediawiki_for_Metrics_Platform.

And, in order to surface the ValidationError, I've found it necessary to have this in LocalSettings.php:

$wgEventServices = [
	'eventgate-analytics-external' => [ 'url' => 'http://eventlogging:8192/v1/events' ],
];

and not this:

$wgEventServices = [
	'*' => [ 'url' => 'http://eventlogging:8192/v1/events' ],
];

Change #859583 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/EventLogging@master] DNM: Add special page and script to send test events

https://gerrit.wikimedia.org/r/859583

Change #1009480 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/EventLogging@master] Use wikimedia/metrics-platform 4.1.0

https://gerrit.wikimedia.org/r/1009480

Change #1009484 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/vendor@master] Update wikimedia/metrics-platform to 4.1.0

https://gerrit.wikimedia.org/r/1009484

mediawiki/extensions/EventLogging/+/859583: DNM: Add special page and script to send test events is a test script that I've used in the past when I just needed to send an event quickly. It doesn't need to be reviewed.

Change #1009480 merged by jenkins-bot:

[mediawiki/extensions/EventLogging@master] Use wikimedia/metrics-platform 4.1.0

https://gerrit.wikimedia.org/r/1009480

Change #1009484 merged by jenkins-bot:

[mediawiki/vendor@master] Update wikimedia/metrics-platform to 4.1.0

https://gerrit.wikimedia.org/r/1009484

@DMartin-WMF: If you fetch the latest version of the EventLogging extension and run composer update in /path/to/mediawiki, then this should be fixed. It will be fixed in production next Thursday.

@phuedx - Thanks so much! I will check it out today.