Debug View Tag

Tag all subsequent outgoing pings with a given value, in order to redirect them to the Glean Debug View.

"To tag" a ping with the Debug View Tag means that the ping request will contain the X-Debug-Id header with the given tag.

Once enabled, the only way to disable this feature is to restart or manually reset the application.

Limits

  • Any valid HTTP header value is a valid debug view tag (e.g. any value that matches the regex [a-zA-Z0-9-]{1,20}). Invalid values will be ignored.

API

setDebugViewTag

Sets the Debug View Tag to a given value.

This API can safely be called before Glean.initialize. The tag will be applied upon initialization in this case.

Glean.setDebugViewTag("my-tag")
import Glean

Glean.shared.setDebugViewTag("my-tag")
use glean;

glean.set_debug_view_tag("my-tag");
import Glean from "@mozilla/glean/<platform>";

Glean.setDebugViewTag("my-tag");

getDebugViewTag

Gets the Debug View Tag if set, otherwise returns a language-specific empty/null value.

val tag = Glean.getDebugViewTag() ?: "none"
import Glean

if let tag = Glean.shared.getDebugViewTag() { ... }
use glean;

if let Some(tag) = glean.get_debug_view_tag() { ... };

Environment variable

GLEAN_DEBUG_VIEW_TAG

It is also possible to set the debug view tag through the GLEAN_DEBUG_VIEW_TAG environment variable.

This variable must be set at runtime, not at compile time. It will be checked upon Glean initialization.

Xcode IDE scheme editor popup screenshot

To set environment variables to the process running your app in an iOS device or emulator you need to edit the scheme for your app. In the Xcode IDE, use the shortcut Cmd + < to open the scheme editor popup. The environment variables editor is under the Arguments tab on this popup.

$ GLEAN_DEBUG_VIEW_TAG="my-tag" python my_application.py
$ GLEAN_DEBUG_VIEW_TAG="my-tag" cargo run
$ GLEAN_DEBUG_VIEW_TAG="my-tag" ./mach run