Closed Bug 1619288 Opened 5 years ago Closed 4 years ago

Can we do without `registerPings`?

Categories

(Data Platform and Tools :: Glean: SDK, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Dexter, Unassigned)

Details

We require users of custom pings to call registerPings(Object), a bogus empty function that has the only task of forcing the passed object to be initialized. In Kotlin, object(s) are lazily initialized on the first call.

Would something like this work, instead?

object HelloObject {
    init {
    	println("initing HelloObject")    
    }
    
    fun print() {
        println("Hello I'm Mr Meeseeks!")
    }
}

//val _asd = HelloObject // UCOMMENT me to see what's different.

fun main(args: Array<String>) {
    // If HelloObject is instantiated, we should see "initing HelloObject" before
    // "The main".
    println("The main")
    HelloObject.print()
}

The generated code for custom pings definition would define something like val _ignore = Pings, which would trigger the Pings definitions to be loaded.

Priority: -- → P3
Whiteboard: [telemetry:glean-rs:m?]
Whiteboard: [telemetry:glean-rs:m?] → [telemetry:glean-rs:backlog]

Back then we tried finding a way, but it's impossible to do that cross-language/platform wise.
We need pings registered at initialize time in case we need to send pending events.
There's no way to do this without instantiation.

Going to close this.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Whiteboard: [telemetry:glean-rs:backlog]
You need to log in before you can comment on or make changes to this bug.