Skip to content

Commit 1201522

Browse files
authored
Merge branch 'main' into rlamb/update-log-test-scenarios
2 parents 22dea3b + 087ef08 commit 1201522

File tree

37 files changed

+741
-92
lines changed

37 files changed

+741
-92
lines changed

.release-please-manifest.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"go": "0.3.0",
3-
"sdk/@launchdarkly/observability": "0.4.3",
4-
"sdk/@launchdarkly/observability-android": "0.9.0",
2+
"go": "0.3.1",
3+
"sdk/@launchdarkly/observability": "0.4.5",
4+
"sdk/@launchdarkly/observability-android": "0.10.0",
55
"sdk/@launchdarkly/observability-dotnet": "0.3.0",
6-
"sdk/@launchdarkly/observability-node": "0.3.0",
6+
"sdk/@launchdarkly/observability-node": "0.3.1",
77
"sdk/@launchdarkly/observability-python": "0.1.1",
88
"sdk/@launchdarkly/observability-react-native": "0.6.0",
9-
"sdk/@launchdarkly/session-replay": "0.4.3",
10-
"sdk/highlight-run": "9.22.0"
9+
"sdk/@launchdarkly/session-replay": "0.4.5",
10+
"sdk/highlight-run": "9.22.2"
1111
}

e2e/android/app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ dependencies {
6565
implementation("io.opentelemetry.android.instrumentation:httpurlconnection-library:0.11.0-alpha")
6666
byteBuddy("io.opentelemetry.android.instrumentation:httpurlconnection-agent:0.11.0-alpha")
6767

68+
// Used for accessing the SignalFromDiskExporter class in TestApplication
69+
implementation("io.opentelemetry.android:core:0.11.0-alpha")
70+
6871
// OkHTTP instrumentation
6972
implementation("io.opentelemetry.android.instrumentation:okhttp3-library:0.11.0-alpha")
7073
byteBuddy("io.opentelemetry.android.instrumentation:okhttp3-agent:0.11.0-alpha")

e2e/android/app/src/test/java/com/example/androidobservability/TestApplication.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.androidobservability
22

33
import com.launchdarkly.sdk.android.LDClient
4+
import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter
45
import okhttp3.mockwebserver.MockResponse
56
import okhttp3.mockwebserver.MockWebServer
67
import java.net.InetAddress
@@ -48,6 +49,7 @@ class TestApplication : BaseApplication() {
4849
mockWebServer = null
4950
}
5051
LDClient.get().close()
52+
SignalFromDiskExporter.resetForTesting()
5153
super.onTerminate()
5254
}
5355
}

go/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.3.1](https://github.com/launchdarkly/observability-sdk/compare/go/v0.3.0...go/v0.3.1) (2025-10-06)
4+
5+
6+
### Bug Fixes
7+
8+
* Fix an issue where logging configuration could over-match for log records without a message or severity. ([#261](https://github.com/launchdarkly/observability-sdk/issues/261)) ([500a6bf](https://github.com/launchdarkly/observability-sdk/commit/500a6bf2e7801c8076405257a31ba4a629311e0b))
9+
310
## [0.3.0](https://github.com/launchdarkly/observability-sdk/compare/go/v0.2.1...go/v0.3.0) (2025-09-23)
411

512

go/internal/metadata/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ const (
66

77
// InstrumentationVersion is the version of the instrumentation.
88
// This is automatically updated by the release process.
9-
InstrumentationVersion = "0.0.0" // {{ x-release-please-version }}
9+
InstrumentationVersion = "0.3.1" // {{ x-release-please-version }}
1010
)

go/internal/otel/custom_sampler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,12 @@ func (cs *CustomSampler) matchesLogConfig(
625625

626626
// Check message if defined
627627
if messageConfig := config.GetMessage(); !isMatchConfigEmpty(&messageConfig) {
628-
if record.Body().Kind() == log.KindString {
629-
if !matchesValue(cs, &messageConfig, record.Body().AsString()) {
630-
return false
631-
}
628+
// We only support string message bodies for now.
629+
if record.Body().Kind() != log.KindString {
630+
return false
631+
}
632+
if !matchesValue(cs, &messageConfig, record.Body().AsString()) {
633+
return false
632634
}
633635
}
634636

sdk/@launchdarkly/launchdarkly_flutter_observability/example/lib/main.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ void main() {
2828
AutoEnvAttributes.enabled,
2929
plugins: [
3030
ObservabilityPlugin(
31+
instrumentation: InstrumentationConfig(
32+
debugPrint: DebugPrintSetting.always(),
33+
),
3134
applicationName: 'test-application',
3235
// This could be a semantic version or a git commit hash.
3336
// This demonstrates how to use an environment variable to set the hash.
@@ -57,6 +60,9 @@ void main() {
5760

5861
// Any additional default error handling.
5962
},
63+
// Used to intercept print statements. Generally print statements in
64+
// production are treated as a warning and this is not required.
65+
zoneSpecification: Observe.zoneSpecification(),
6066
);
6167
}
6268

@@ -197,6 +203,19 @@ class _MyHomePageState extends State<MyHomePage> {
197203
},
198204
child: const Text('Record error log with stack trace'),
199205
),
206+
ElevatedButton(
207+
onPressed: () {
208+
debugPrint("This is a message from debug print");
209+
},
210+
child: const Text('Call debugPrint'),
211+
),
212+
ElevatedButton(
213+
onPressed: () {
214+
// ignore: avoid_print
215+
print('This is a message from print');
216+
},
217+
child: const Text('Call print'),
218+
),
200219
const Text('You have pushed the button this many times:'),
201220
Text(
202221
'$_counter',

sdk/@launchdarkly/launchdarkly_flutter_observability/lib/launchdarkly_flutter_observability.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export 'src/plugin/observability_plugin.dart' show ObservabilityPlugin;
2+
export 'src/plugin/observability_config.dart'
3+
show InstrumentationConfig, DebugPrintSetting;
24
export 'src/observe.dart' show Observe;
35
export 'src/api/attribute.dart'
46
show
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/foundation.dart';
2+
import 'package:launchdarkly_flutter_observability/src/instrumentation/instrumentation.dart';
3+
4+
import '../plugin/observability_config.dart';
5+
import '../observe.dart';
6+
7+
class DebugPrintInstrumentation implements Instrumentation {
8+
DebugPrintCallback? _originalCallback;
9+
10+
DebugPrintInstrumentation(InstrumentationConfig config) {
11+
switch (config.debugPrint) {
12+
case DebugPrintReleaseOnly():
13+
if (!kReleaseMode) {
14+
return;
15+
}
16+
case DebugPrintAlways():
17+
break;
18+
case DebugPrintDisabled():
19+
return;
20+
}
21+
_instrument();
22+
}
23+
24+
void _instrument() {
25+
_originalCallback = debugPrint;
26+
27+
debugPrint = (String? message, {int? wrapWidth}) {
28+
if (message != null) {
29+
Observe.recordLog(message, severity: 'debug');
30+
}
31+
};
32+
}
33+
34+
@override
35+
void dispose() {
36+
if (_originalCallback != null) {
37+
debugPrint = _originalCallback!;
38+
_originalCallback = null;
39+
}
40+
}
41+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/// Interfaces which instrumentations should implement.
2-
interface class Instrumentation {}
2+
abstract interface class Instrumentation {
3+
void dispose();
4+
}

0 commit comments

Comments
 (0)