jetstream icon indicating copy to clipboard operation
jetstream copied to clipboard

Cannot reference `{experiment.*}` in `metrics.METRIC.select_expression`

Open ncalexan opened this issue 3 years ago • 2 comments

For background task messaging experiments, I want to identify events in telemetry.events where the identified events depend on the experiment -- in this case, the experiment slug.

That is, my events have an extra field name that looks like slug:branch (or will in Firefox 109 -- see https://bugzilla.mozilla.org/show_bug.cgi?id=1804988). I want my metric's select to depend on experiment.normandy_slug, in the same way my experiment's custom query does.

I am aware that metrics can be defined independently of experiments, but it's also clear that the definition specs are resolved in the context of a particular experiment. Given this, it seems like it should be possible.

More generally, is there a reason to not allow interpolation uniformly for all string valued fields? As an outsider, this seems like an arbitrary limitation; I'd be interested to know if there's a principled reason behind it.

┆Issue is synchronized with this Jira Task

ncalexan avatar Jan 14 '23 03:01 ncalexan

I think you can reference experiment_slug in the select_expression for a Metric. Here's an example where that's done. The actual referencing is done here

danielkberry avatar May 17 '23 19:05 danielkberry

I think you can reference experiment_slug in the select_expression for a Metric. Here's an example where that's done. The actual referencing is done here

Thanks for reminding me of this. I see that experiment_slug=self.config.experiment.normandy_slug in a few places, so this should work.

This ticket, however, stands: why can't we reference the experiment and all its string-valued fields?

ncalexan avatar May 24 '23 19:05 ncalexan