Skip to content
Open

WIP #453

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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ open class BaseApplication : Application() {

var observabilityOptions = ObservabilityOptions(
resourceAttributes = Attributes.of(
AttributeKey.stringKey("example"), "value"
AttributeKey.stringKey("observabilityOptions.resourceAttributes"), "BaseApplication"
),
debug = true,
otlpEndpoint = BuildConfig.OTLP_ENDPOINT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class ViewModel(application: Application) : AndroidViewModel(application) {
newSpan1.makeCurrent().use {
val newSpan2 = LDObserve.startSpan("NestedSpan2", Attributes.empty())
newSpan2.makeCurrent().use {
LDObserve.recordCount(Metric("test-counter", 10.0))
LDObserve.recordLog("NestedLog", Severity.INFO, Attributes.empty())
sendOkHttpRequest()
sendURLRequest()
newSpan2.end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class ObservabilityBridge(
com.launchdarkly.observability.api.ObservabilityOptions(
enabled = observability.isEnabled,
serviceName = observability.serviceName,
serviceVersion = observabilityVersion,
serviceVersion = observability.serviceVersion,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS and Android service version sources now diverge

High Severity

The Android bridge now uses observability.serviceVersion (the user-configured value, defaulting to "0.1.0") whereas the iOS bridge in SRClient.iOS.cs still sets ServiceVersion = observabilityVersion (the SDK assembly version). This means the two platforms will report different serviceVersion values for the same user configuration, breaking cross-platform consistency for telemetry data.

Additional Locations (1)
Fix in Cursor Fix in Web

resourceAttributes = resourceAttributes,
debug = false,
otlpEndpoint = observability.otlpEndpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<PackageId>LaunchDarkly.SessionReplay</PackageId>
<Version>0.5.5</Version>
<Version>0.6.0</Version>
<UseLocalClientSdk>false</UseLocalClientSdk>
<Authors>LaunchDarkly</Authors>
<Owners>LaunchDarkly</Owners>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using LaunchDarkly.Observability;

Expand All @@ -24,13 +25,21 @@ private LDNative(ObservabilityOptions observability, SessionReplayOptions replay
Replay = replay;
}

public static LDNative Start(string mobileKey, ObservabilityOptions observability, SessionReplayOptions replay)
private static string GetObservabilityVersion()
{
var ldNative = new LDNative(observability, replay);
var rawVersion = typeof(LDNative).Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion ?? string.Empty;
var observabilityVersion = rawVersion.Split('+')[0];
return rawVersion.Split('+')[0];
}

public static LDNative Start(string mobileKey, ObservabilityOptions observability, SessionReplayOptions replay)
{
var ldNative = new LDNative(observability, replay);
var observabilityVersion = GetObservabilityVersion();
observability.Attributes ??= new Dictionary<string, object?>();
observability.Attributes["maui-observability-version"] = observabilityVersion;

#if ANDROID
var app = (Android.App.Application)global::Android.App.Application.Context;
var bridge = new ObservabilityBridge();
Expand Down
3 changes: 3 additions & 0 deletions sdk/@launchdarkly/mobile-dotnet/sample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ await Task.Run(async () =>
using var span1 = LDObserve.StartActiveSpan("NestedSpan1");
using var span2 = LDObserve.StartActiveSpan("NestedSpan2");

LDObserve.RecordCount("test-counter", 10.0);
LDObserve.RecordLog("NestedLog", Severity.Info);

try
{
await _httpClient.GetAsync("https://www.google.com");
Expand Down
Loading