Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1766457 - Make source tag API public #2035

Merged
merged 2 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
It is marked as version 1 in the definition now. ([#2026](https://github.com/mozilla/glean/pull/2026))
* Kotlin
* (Development only) Allow to override the used `glean_parser` in the Glean Gradle Plugin ([#2029](https://github.com/mozilla/glean/pull/2029))
* `setSourceTags` is now a public API ([#2035](https://github.com/mozilla/glean/pull/2035)))
* iOS
* `setSourceTags` is now a public API ([#2035](https://github.com/mozilla/glean/pull/2035))

# v44.1.1 (2022-04-14)

Expand Down
9 changes: 1 addition & 8 deletions docs/user/reference/debug/debugViewTag.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ The tag will be applied upon initialization in this case.
{{#include ../../../shared/tab_header.md}}
<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

Glean.shared.setDebugViewTag("my-tag")
```
</div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Rust" class="tab">

Expand Down
9 changes: 1 addition & 8 deletions docs/user/reference/debug/logPings.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ The tag will be applied upon initialization in this case.
{{#include ../../../shared/tab_header.md}}
<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Swift" class="tab">

```Swift
import Glean

Glean.shared.setLogPings(true)
```
</div>
<div data-lang="Swift" class="tab"></div>
<div data-lang="Python" class="tab"></div>
<div data-lang="Rust" class="tab">

Expand Down
18 changes: 16 additions & 2 deletions docs/user/reference/debug/sourceTags.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ This API can safely be called before `Glean.initialize`.
The tag will be applied upon initialization in this case.

{{#include ../../../shared/tab_header.md}}
<div data-lang="Kotlin" class="tab"></div>
<div data-lang="Java" class="tab"></div>
<div data-lang="Kotlin" class="tab">

```Kotlin
import mozilla.telemetry.glean.Glean

Glean.setSourceTags(setOf("my-tag", "your-tag", "our-tag"))
```

</div>
<div data-lang="Java" class="tab">

```Java
Glean.INSTANCE.setSourceTags(setOf("my-tag", "your-tag", "our-tag"))
```

</div>
<div data-lang="Swift" class="tab">

```Swift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ open class GleanInternalAPI internal constructor () {
*
* @param tags A list of tags, which must be valid HTTP header values.
*/
internal fun setSourceTags(tags: Set<String>): Boolean {
fun setSourceTags(tags: Set<String>): Boolean {
return if (isInitialized()) {
val tagList = StringArray(tags.toList().toTypedArray(), "utf-8")
LibGleanFFI.INSTANCE.glean_set_source_tags(tagList, tags.size).toBoolean()
Expand Down
2 changes: 1 addition & 1 deletion glean-core/ios/Glean/Glean.swift
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public class Glean {
///
/// - parameters:
/// * tags: A list of tags, which must be valid HTTP header values.
func setSourceTags(_ value: [String]) -> Bool {
public func setSourceTags(_ value: [String]) -> Bool {
if self.isInitialized() {
let len = value.count
return withArrayOfCStrings(value) { value in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GleanApplication : Application() {

// Initialize the Glean library. Ideally, this is the first thing that
// must be done right after enabling logging.
Glean.setSourceTags(setOf("automation"))
Glean.initialize(
applicationContext = applicationContext,
uploadEnabled = true,
Expand Down
1 change: 1 addition & 0 deletions samples/ios/app/glean-sample-app/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

print("using a mock server, setting address: \(address)")
let cfg = Configuration(serverEndpoint: address)
glean.setSourceTags(["automation"])
glean.initialize(uploadEnabled: true, configuration: cfg, buildInfo: GleanMetrics.GleanBuild.info)
} else {
print("using default config for Glean")
Expand Down