Page MenuHomePhabricator

Enable Event Platform streams to opt out of collecting User-Agent data
Closed, ResolvedPublic

Description

User story

As a product manager of contributor-facing features, I want to learn and iterate on ideas/interventions quickly. I need to test hypotheses with experiments (A/B tests) where username and/or user ID must be collected with interaction data so that the analysis results can include insights about the impact of the tested idea/intervention on editors' experience and their productivity.

Background

Under the data collection guidelines, each experiment we do that involves usernames and/or user IDs is classified as a Medium Risk data collection activity and requires Legal & Security review and approval, which can take 1-2 weeks. This is because as an ongoing data collection activity, Low Risk classification requires that all low risk criteria are met.

The one low risk criteria we fail is "personal information + username/user ID" because the system automatically collects User-Agent data with every event and it gets stored in http.request_headers['user-agent']. There is no UA-specific field/fragment that we can keep out of schemas like we can with IP addresses (which are only collected when http.client_ip exists in the schema).

If we made UA data optional, it would make it possible for us to run editor-focused A/B tests that record usernames/user IDs for analysis, without elevating the data collection activity to Medium Risk.

Chosen implementation

  • Ownership of configuration to enrich event stream data with stream headers has moved to EventStreamConfig. The new producers.eventgate.enrich_fields_with_http_headers config setting is a map of field name to header name. It has a default value that is applied to all streams, and can be overridden per stream.
  • More work will be needed for T385180: Implement agent.ua_string as contextual attribute
    • EventLogging PHP submitted events. These manually set the http.request_headers['user-agent'] field, and eventgate will not override what the client sets.
    • Experiment Platform 'mono streams'. These are streams that have the same schema, that are shared by many instruments. If it is needed to vary collection of user-agent per instrument, then the client will have to handle conditionally setting this in the event.

Implementation context

eventgate-wikimedia has a http_request_headers_to_fields option, which defaults to

http_request_headers_to_fields: {
    'x-request-id': 'meta.request_id',
    'user-agent': 'http.request_headers.user-agent',
},

This option is used to automatically set event fields with http request headers. E.g. if a user-agent header is set in the http request to EventGate, and if the event's schema has a http.request_headers map field, http.request_headers['user-agent'] will be set with the value of the User-Agent header.

We need a way for this code to explicitly enable or disable collection of this (and possible any?) request header like this. In this case, doing this based on the presence of a field name in a schema won't work, because this field is a map field, and the keys of the map (e.g. 'user-agent') are not pre-defined in the schema.

Implementation options

Option 1a: Use an EventStreamConfig setting to configure http_request_headers_to_fields per stream.

A StreamConfigs is initialized for each eventgate instance. This instance is currently only used in a couple of places when receiving an event to produce.

We should be able to use it (via options.streamConfigs) in the makeSetWikimediaDefaults function to get the http_request_headers_to_fields setting from EventStreamConfig for a stream.

The eventgate-wikimedia code default will be used for any streams that don't specifically override this setting.

In wgEventStreams (EventStreamConfig), this probably belongs in a producers.eventgate specific setting. Something like

		'mediawiki.web_ui_actions' => [
// ...
			'producers' => [
				'metrics_platform_client' => [
					'provide_values' => [
// ...
					],
				],
				'eventgate' => [
					'http_request_headers_to_fields' => [
        					'x-request-id' => 'meta.request_id'
					]

				],
			],
// ...

Here, because 'http_request_headers_to_fields' is overridden, 'user-agent' will not be collected.

Pros:

  • http_request_headers_to_fields makes things more configurable, and allows us to explicitly configure the setting of request_headers.

Cons:

  • verbose configuration just to disable user-agent collection.
Option 1b: Variation: disable user-agent collection by default, and explicitly enable it

This would be the same implementation of Option 1a, except that we disable user-agent collection or perhaps even all http_request_headers_to_fields collection, by default in eventgate.

We then use EventStreamConfig to opt-in to collection of any of these things.

In EventStreamConfig defaults, we could set the headers we want to collect by default, and add any overrides in specific per-stream config in the same producers.eventgate.http_request_headers_to_fields setting.

Pros:

  • http_request_headers_to_fields makes things more configurable, and allows us to explicitly configure the setting of request_headers.
  • header collection setting defaults handing is in one place, instead of in both EventGate service config and EventStreamConfig.
  • Assuming most streams don't need user-agent, per stream configuration is less verbose.
  • Using config to configure data collection is better than using schemas.

Cons:

  • If most streams do need user-agent, then per stream configuration is more verbose.

A slight tweak would be to manage defaults fully in EventStreamConfig settings (removing them from EventGate service configs), but still enable user-agent collection by default. This has the pro of managing the default for this in one place, and possibly less verbose per-stream configuration.

Option 2: Make user_agent its own fragment schema field

This is how http.client_ip is collected. If http.user_agent is a concrete field (not in a map), we can vary its collection just like we do for client_ip: only collect it if the field is present in the schema.

Pros:

  • less producer code to change
  • more(?) explicit collection
  • http.user_agent will show up in datahub and SQL UIs.

Cons:

  • Not backwards compatible. Existent consumers of http.request_headers['user-agent'] will have to change the way they access this information.
    • More code to change in e.g. Refine in order to parse user agent.
Option 3. Declare user-agent property field in http.request_headers map

Event Platform has a convention for declaring map type fields, and specific fields in a map can be pre-declared.

We could remove support from eventgate-wikimedia for setting undeclared fields in a JSON object, and always rely on presence of declared field in schema to decide if a header value should be set in the event.

Pros:

  • Less stream config to deal with
  • Setting of value is explicitly managed by schema

Cons:

  • Less specific configuration support
  • Requires schema changes to enable/disable collection, and only backwards compatible changes are allowed. I.e. it would not be allowed to disable collection after it is enabled (since technically removing fields is backwards incompatible). Or, we could add compatibility exception for removing fields from a map type, since this is practically fine.
  • Using schemas for 'configuration' is weird.

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Ottomata updated the task description. (Show Details)

I opted for Option 1b with the slight tweak: manage defaults fully in EventStreamConfig settings (removing them from EventGate service configs), but still enable user-agent collection by default. This has the pro of managing the default for this in one place, and possibly less verbose per-stream configuration.

I also renamed the setting to make it hopefully more clear, and also reversed the key/value semantics (mapping from field name to header name was more clear to me)

Before deploying, we'd have to set this in EventStreamConfig wgEventStreamDefaults to keep existent semantics.

I'll update task description before we resolve.

@phuedx to review! :)

Merged and triggered a release. Version 1.8.0 should have this feature. Will test in beta first.

Change #1114149 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/mediawiki-config@master] beta EventStreamConfig - set eventgate hoist_fields_from_http_headers

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

@Ottomata: Will existing streams be affected? Or will UA info collection be "on" by default and streams will have to be configured to opt out of it?

If UA info is being made opt-in ("off" by default), then existing streams should be opted in on day 1. Then this can be announced and stream owners can go ahead and opt their streams out if they decide they're okay not collecting this info going forward.

Or will UA info collection be "on" by default and streams will have to be configured to opt out of it?

This will be the initial behavior. We'll enable user-agent collection in wgEventStreamsDefaultSettings. This will make all header collection work exactly as it does now.

Then this can be announced and stream owners can go ahead and opt their streams out if they decide they're okay not collecting this info going forward.

Ya exactly. If we can make the default be to not collect this, we can help owners enable this per stream as needed.

The main pro of the chosen implementation is that it explicitly configures which headers are hoisted into which event fields, per stream. (We'll have more headers we'll want to collect soon).

The con is that configuration is more verbose and explicit when a stream wants to override the default. There is no merging of settings at this level, so the full producers.eventgate.hoist_fields_from_http_headers setting in wgEventStreams must be set on a stream. The setting must specify all field -> header mappings, e.g. meta.request_id -> x-request-id. If the default is to collect user-agent and a stream wants to opt out but keep the default collection settings for other headers, the stream must copy the default producers.eventgate.hoist_fields_from_http_headers setting, remove the 'user-agent' collection setting, but leave all the others.

Change #1114149 merged by jenkins-bot:

[operations/mediawiki-config@master] beta EventStreamConfig - set eventgate hoist_fields_from_http_headers

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

Change #1114409 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/mediawiki-config@master] beta wgEventStreams - set hoist_fields_from_http_headers on metawiki

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

Change #1114409 merged by jenkins-bot:

[operations/mediawiki-config@master] beta wgEventStreams - set hoist_fields_from_http_headers on metawiki

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

There is no merging of settings at this level

Wait! I am wrong about this. This is true for mediawiki-config's built in defaults -> wiki override merging, but it is not true for EventStreamConfig's wgEventStreamDefaults + wgEventStream stream setting merging!

So, the wgEventStreamDefaults will always be merged in. This makes it difficult to opt out of user-agent collection by removing the setting. But! This is actually better, because now the configuration is not more verbose.

the stream must copy the default producers.eventgate.hoist_fields_from_http_headers setting, remove the 'user-agent' collection setting, but leave all the others.

Is not true. Instead, they'd have to just set e.g. producers.eventgate.hoist_fields_from_http_headers['http.request_headers']['user-agent']: false, and the false value will override the default. They don't have to worry about copying over the other header hoisting settings too! They will be merged in.

Looking at the code we just merged, this will just work, because e.g. context.req.headers[false] should be falsey(? will this fail?) and , but I'd like to add in some explicit checks (defensive code). Doing that now...

Change #1114449 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/mediawiki-config@master] beta wgEventStreams - test Opt out of collecting user-agent

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

Change #1114449 merged by jenkins-bot:

[operations/mediawiki-config@master] beta wgEventStreams - test Opt out of collecting user-agent

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

I deployed the latest eventgate-wikimedia version v1.8.0 following https://wikitech.wikimedia.org/wiki/Event_Platform/EventGate/Administration#Beta_/_deployment-prep

This stream config patch is deployed in beta. It works!

Here's how I tested it.

Stream config for eventlogging_NavigationTiming stream has the opt-out for user agent override.

$ curl -s 'https://meta.wikimedia.beta.wmflabs.org/w/api.php?action=streamconfigs&format=json&streams=eventlogging_NavigationTiming' | jq .streams.eventlogging_NavigationTiming.producers.eventgate
{
  "hoist_fields_from_http_headers": {
    "meta.request_id": "x-request-id",
    "http.request_headers.user-agent": false
  }
}

Go to https://stream-beta.wmflabs.org/v2/ui/#/?streams=eventlogging_NavigationTiming and start Streaming events.

Go to https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page, open the developer console in your browser, and enter

mw.eventLog.logEvent('NavigationTiming', {isAnon: true} );

Back at stream-beta.wmflabs.org, I get

{
  "event": {
    "isAnon": true
  },
  "schema": "NavigationTiming",
  "webHost": "en.wikipedia.beta.wmflabs.org",
  "wiki": "enwiki",
  "$schema": "/analytics/legacy/navigationtiming/1.6.0",
  "client_dt": "2025-01-27T20:22:30.369Z",
  "meta": {
    "stream": "eventlogging_NavigationTiming",
    "domain": "en.wikipedia.beta.wmflabs.org",
    "id": "495f81a6-d13a-4eab-b146-a9f8135d3896",
    "dt": "2025-01-27T20:22:30.907Z",
    "request_id": "6f465e90-dcec-11ef-b2be-dfe0d89b20ff",
    "topic": "eventlogging_NavigationTiming",
    "partition": 0,
    "offset": 244810
  },
  "dt": "2025-01-27T20:22:30.907Z",
  "http": {
    "client_ip": "X.X.X.X"
  }
}

You can see that meta.request_id is set from the x-request-id header, but http.request_headers['user-agent'] is not set.

To verify that they are still set for another stream, I streamed eventlogging_EditAttemptStep stream at https://stream-beta.wmflabs.org/v2/ui/#/?streams=eventlogging_EditAttemptStep, and then opened an editor on metawiki, I got:

{
  "event": {
    ...
  },
  ...
  "meta": {
    "stream": "eventlogging_EditAttemptStep",
    "domain": "meta.wikimedia.beta.wmflabs.org",
    ....
    "request_id": "3acbc7f0-dcf0-11ef-b2be-dfe0d89b20ff",
    ...
  },
  "dt": "2025-01-27T20:49:40.849Z",
  "http": {
    "request_headers": {
      "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
    },
    "client_ip": "X.X.X.X"
  }
}

http.request_headers.user-agent is set, and so is meta.request_id.

Had a discussion with @mpopov, @KSarabia-WMF and @Sgs about the naming of this config, and we agreed that 'hoist' is not a great term.

Other options:

  • extract
  • populate
  • pluck
  • enrich

I like enrich. We use it in other places and 'event enrichment' means this in the event driven arch world.

Change #1114767 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/mediawiki-config@master] beta - EventStreamConfig - Rename hoist_http_headers_to_fields setting

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

Change #1114767 merged by jenkins-bot:

[operations/mediawiki-config@master] beta - EventStreamConfig - Rename hoist_http_headers_to_fields setting

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

In the interest of time I went ahead with enrich_fields_from_http_headers as the name for this setting.

bikeshed still welcome if others have strong opinions.

Change #1114779 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[operations/mediawiki-config@master] beta wgEventStreams: set enrich_fields_from_http_headers on metawiki

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

Change #1114779 merged by jenkins-bot:

[operations/mediawiki-config@master] beta wgEventStreams: opt out collecting user agent for HompageVisit

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

FYI, I'm going to try to get done T383814: Upgrade eventgate-wikimedia to node20 at the same time as this.

I will do a separate eventgate-wikimedia release for both, so that it is easy to roll back to this if node20 causes big problems.

I just tested Growth's HomepageVisit stream in beta:

mw.eventLog.logEvent('HomepageVisit', {is_mobile: false, user_editcount: 1, user_id: 123, impact_module_state: 'unactivated', start_email_state: 'noemail', homepage_pageview_token: 'otto'});
{
  "event": {
    "is_mobile": false,
    "user_editcount": 1,
    "user_id": 123,
    "impact_module_state": "unactivated",
    "start_email_state": "noemail",
    "homepage_pageview_token": "otto"
  },
  "schema": "HomepageVisit",
  "webHost": "en.wikipedia.beta.wmflabs.org",
  "wiki": "enwiki",
  "$schema": "/analytics/legacy/homepagevisit/1.5.2",
  "client_dt": "2025-01-29T14:25:49.862Z",
  "meta": {
    "stream": "eventlogging_HomepageVisit",
    "domain": "en.wikipedia.beta.wmflabs.org",
    "id": "29b393b7-4ca5-4cf1-a4bc-06267a8ce088",
    "dt": "2025-01-29T14:25:50.533Z",
    "request_id": "f07c1840-de4c-11ef-88a7-8506bf2d2d08",
    "topic": "eventlogging_HomepageVisit",
    "partition": 0,
    "offset": 127876
  },
  "dt": "2025-01-29T14:25:50.533Z",
  "http": {
    "client_ip": "x.x.x.x"
  }
}

Thanks for testing @Ottomata, I was testing a different use case in GrowthExperiments and I'm finding different results. In particular I tested Growth's interaction logging from the server in SpecialHomepage.php#168 (via SpecialHomepageLogger::log, and done in a deferred update, not sure if that's relevant.

This call can be triggered visiting Special:Homepage, the logging exists in the server as the homepage has support for a no-JS experience.

Back on stream I get:

{
    "http": {
        "request_headers": {
            "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0"
        },
        "client_ip": "x.x.x.x"
    },
    "meta": {
        "domain": "en.wikipedia.beta.wmflabs.org",
        "stream": "eventlogging_HomepageVisit",
        "id": "f81059a4-532c-4cb6-b818-6decef79e56e",
        "dt": "2025-01-29T14:37:10.929Z",
        "request_id": "Z5o9FtFLyl7xayocZBPWGgAAAFU",
        "topic": "eventlogging_HomepageVisit",
        "partition": 0,
        "offset": 127881
    },
    "event": {
        "is_mobile": false,
        "referer_route": "personaltoolslink",
        "referer_namespace": 0,
        "referer_action": "view",
        "user_id": 108798,
        "user_editcount": 8,
        "impact_module_state": "activated",
        "start_email_state": "unconfirmed",
        "homepage_pageview_token": "o8sui51qutocmpof9ra1lc7bhgcbtefc"
    },
    "schema": "HomepageVisit",
    "wiki": "enwiki",
    "webHost": "en.wikipedia.beta.wmflabs.org",
    "$schema": "/analytics/legacy/homepagevisit/1.5.2",
    "client_dt": "2025-01-29T14:37:10Z",
    "dt": "2025-01-29T14:37:10.929Z"
}

I'm not fully aware yet of the event pipeline but I'd say since these events are produced in the server and not the client they are not using the same transport and we're missing the override logic totally. I will investigate forward, hints welcome.

Change #1115042 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/mediawiki-config@master] EventStreamConfig - prep for per stream user agent collection config

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

Okay! For PHP submitted events:

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/EventLogging/+/refs/heads/master/includes/EventSubmitter/EventBusEventSubmitter.php#82

EventLogging PHP extension is explicitly setting http.request_headers['user-agent'] before POSTing the event to eventgate!

Gonna need some code changes for legacy EventLogging PHP submitted events ... :/

EventLogging PHP extension is explicitly setting http.request_headers['user-agent'] before POSTing the event to eventgate!

Gonna need some code changes for legacy EventLogging PHP submitted events ... :/

Oof. Yeah ideally it would work like navigator.sendBeacon where the UA is attached as a header to the POST request rather than to the event data.

I think the reason it is done this way is that when MW POSTs to EventGate, the User-Agent header in that request will be whatever MW PHP HTTP client is.

This code takes the user's HTTP request User-Agent header and sticks it in the event.

This really is probably the better thing to do in all clients, like we discussed in Slack.

Clients should set the value of their user-agent in the event they submit. That is more flexible and probably more correct.

Change #1115042 merged by jenkins-bot:

[operations/mediawiki-config@master] EventStreamConfig - prep for per stream user agent collection config

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

Mentioned in SAL (#wikimedia-operations) [2025-01-29T15:37:39Z] <otto@deploy2002> Started scap sync-world: Backport for [[gerrit:1115042|EventStreamConfig - prep for per stream user agent collection config (T382173)]]

Mentioned in SAL (#wikimedia-operations) [2025-01-29T15:42:26Z] <otto@deploy2002> otto: Backport for [[gerrit:1115042|EventStreamConfig - prep for per stream user agent collection config (T382173)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-01-29T15:54:48Z] <otto@deploy2002> Finished scap sync-world: Backport for [[gerrit:1115042|EventStreamConfig - prep for per stream user agent collection config (T382173)]] (duration: 17m 08s)

Change #1115061 had a related patch set uploaded (by Ottomata; author: Ottomata):

[operations/deployment-charts@master] eventgate-analytics-external - bump to v1.9.0

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

Change #1115061 merged by jenkins-bot:

[operations/deployment-charts@master] eventgate-analytics-external - bump to v1.9.0

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

Change #1115074 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[operations/mediawiki-config@master] beta wgEventStreams: opt out collecting user agent for HelpPanel

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

Alright, deploying eventgate-analytics-external 1.9.0 (with this new config support).

First, testing that I can produce HelpPanel event to eventgate-analytics-external k8s staging and get user-agent set before deployment.

Find the staging pod IP and port.

19:04:28 1d [@deploy2002:/srv/ … /eventgate-analytics-external] (master+2/-2)+[b02ba1da] ± pwd
/srv/deployment-charts/helmfile.d/services/eventgate-analytics-external
19:04:28 1d [@deploy2002:/srv/ … /eventgate-analytics-external] (master+2/-2)+[b02ba1da] ± kube_env eventgate-analytics-external staging
19:04:34 1d [@deploy2002:/srv/ … /eventgate-analytics-external] (master+2/-2)+[b02ba1da] ± kubectl get pods -o wide
NAME                                   READY   STATUS    RESTARTS   AGE   IP            NODE                        NOMINATED NODE   READINESS GATES
eventgate-production-d48875cf6-rd974   2/2     Running   0          41d   10.64.75.39   kubestage1005.eqiad.wmnet   <none>           <none>

Find the k8s service port for eventgate-analytics-external at https://wikitech.wikimedia.org/wiki/Kubernetes/Service_ports. 4692.

So our service endpoint will be https://10.64.75.39:4692/v1/events

Consume eventlogging_HelpPanel using kafkacat or using eventstreams-internal.

# I'm grepping for an "ottotest" string that I will submit in my manual event POST
19:02:19 [@stat1010:/home/otto] $ kafkacat -u -q -C -b kafka-jumbo1007.eqiad.wmnet:9092 -t eventlogging_HelpPanel -o end | grep ottotest  | jq .

POST a dummy HelpPanel event

curl -H 'Content-Type: application/json' -k -v -d '
{
  "$schema": "/analytics/legacy/helppanel/1.5.0",
  "event": {
    "action": "impression",
    "context": "editing",
    "editor_interface": "visualeditor",
    "help_panel_session_id": "338abe4c324c68675fb2",
    "is_mobile": false,
    "page_id": 123456,
    "page_ns": 0,
    "page_title": "ottotest",
    "session_token": "ottotest_session",
    "user_can_edit": true,
    "user_editcount": 123456,
    "user_id": 123456
  },
  "meta": {
    "stream": "eventlogging_HelpPanel"
  },
  "schema": "HelpPanel"
}
' https://10.64.75.39:4692/v1/events
# ...
< HTTP/1.1 201 Created

Check that the event shows up in Kafka and has the expected fields

{
# ...
  "meta": {
    "stream": "eventlogging_HelpPanel",
    "id": "4be50a91-942b-4e56-acb7-e72fdf731d82",
    "dt": "2025-01-29T19:02:16.994Z",
    "request_id": "849ce62c-4302-4e18-97cc-e1765dda4898"
  },

# ...
  "http": {
    "request_headers": {
      "user-agent": "curl/7.74.0"
    },
    "client_ip": "127.0.0.1"
  }
}

Looks good! I have user-agent request_id as expected. After deploying eventgate with the default to collect user-agent enabled (already deployed), there should be no change.

19:08:51 1d [@deploy2002:/srv/ … /eventgate-analytics-external] (master+2/-2)+[b02ba1da] ± helmfile -e staging apply

The pod IP will have changed, so find the new one:

19:09:47 1d [@deploy2002:/srv/ … /eventgate-analytics-external] (master+2/-2)+[b02ba1da] ± kubectl get pods -o wide
NAME                                   READY   STATUS        RESTARTS   AGE   IP            NODE                        NOMINATED NODE   READINESS GATES
eventgate-production-68c9c884b-lnn7k   2/2     Running       0          29s   10.64.75.0    kubestage1006.eqiad.wmnet   <none>           <none>
eventgate-production-d48875cf6-rd974   2/2     Terminating   0          41d   10.64.75.39   kubestage1005.eqiad.wmnet   <none>           <none>

POST the dummy event again:

curl -H 'Content-Type: application/json' -k -v -d '
{
  "$schema": "/analytics/legacy/helppanel/1.5.0",
  "event": {
    "action": "impression",
    "context": "editing",
    "editor_interface": "visualeditor",
    "help_panel_session_id": "338abe4c324c68675fb2",
    "is_mobile": false,
    "page_id": 123456,
    "page_ns": 0,
    "page_title": "ottotest",
    "session_token": "ottotest_session",
    "user_can_edit": true,
    "user_editcount": 123456,
    "user_id": 123456
  },
  "meta": {
    "stream": "eventlogging_HelpPanel"
  },
  "schema": "HelpPanel"
}
' https://10.64.75.0:4692/v1/events

Check kafka and make sure meta.request_id and user-agent are still set:

{
#...
  "meta": {
    "stream": "eventlogging_HelpPanel",
    "id": "f97442e6-2fa6-4784-9396-77ae95c25b97",
    "dt": "2025-01-29T19:10:43.098Z",
    "request_id": "01e9d37e-9547-413c-b758-d84fa13bbd40"
  },
# ...
  "http": {
    "request_headers": {
      "user-agent": "curl/7.74.0"
    },
    "client_ip": "127.0.0.1"
  }
}

Looks good!

Finishing up deployment of eventgate-analytics-external to eqiad and codfw. Will verify this works there too.

I've fully deployed eventgate-analytics-external v1.9.0 to production. The new stream config setting should now be respected there.

I've verified that meta.request_id and http.request_headers.user-agent still flowing through for a few streams.

All should be well!

Clients should set the value of their user-agent in the event they submit. That is more flexible and probably more correct.

Created T385180: Implement agent.ua_string as contextual attribute to track this.

Ottomata renamed this task from Enable Event Platform instruments to opt out of collecting User-Agent data to Enable Event Platform streams to opt out of collecting User-Agent data.Jan 30 2025, 8:16 PM
Ottomata updated the task description. (Show Details)

Change #1115074 merged by jenkins-bot:

[operations/mediawiki-config@master] beta wgEventStreams: opt out collecting user agent for HelpPanel

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

Mentioned in SAL (#wikimedia-operations) [2025-03-04T16:01:15Z] <ottomata> eventgate-logging-external: rolling back to pre node 20 due to bug likely caused by T382173. -- T387850 , T383814

@Ottomata @Sgs Apologies for the pings on this task from earlier this year, but I thought I'd leave a message here as I recently discovered some potentially-counterintuitive behaviour within MediaWiki that seems like it might have affected/be affecting some of the config overrides set on beta-metawiki for this task (see T412118: SiteConfiguration discards wiki-specific array-value-config-overrides where the array value is `false`, T412118#11444081). If you have any input/thoughts about that from your perspectives then please feel free to leave a comment there :)