Skip to content

Commit 70ba248

Browse files
committed
Merge branch 'main' into agrognetti/O11Y-362
2 parents 70551c3 + de306bd commit 70ba248

File tree

66 files changed

+2150
-1106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2150
-1106
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"go": "0.3.1",
2+
"go": "0.4.0",
33
"sdk/@launchdarkly/observability": "0.4.5",
44
"sdk/@launchdarkly/observability-android": "0.10.0",
55
"sdk/@launchdarkly/observability-dotnet": "0.3.0",

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

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributeKey
99
import io.opentelemetry.api.common.Attributes
1010
import io.opentelemetry.api.logs.Severity
1111
import com.example.androidobservability.TestUtils.TelemetryType
12+
import com.launchdarkly.observability.api.Options
1213
import junit.framework.TestCase.assertEquals
1314
import junit.framework.TestCase.assertFalse
1415
import junit.framework.TestCase.assertNotNull
@@ -27,22 +28,23 @@ class DisablingConfigOptionsE2ETest {
2728
private val application = ApplicationProvider.getApplicationContext<Application>() as TestApplication
2829

2930
@Test
30-
fun `Logs should not be exported when disableLogs is set to true`() {
31-
application.pluginOptions = application.pluginOptions.copy(disableLogs = true)
31+
fun `Logs should NOT be exported when disableLogs is set to true`() {
32+
application.pluginOptions = getOptionsAllEnabled().copy(disableLogs = true)
3233
application.initForTest()
3334
val logsUrl = "http://localhost:${application.mockWebServer?.port}/v1/logs"
3435

3536
triggerTestLog()
3637
LDObserve.flush()
3738
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.LOGS)
39+
val logsExported = application.telemetryInspector?.logExporter?.finishedLogRecordItems
3840

39-
assertNull(application.telemetryInspector?.logExporter)
41+
assertTrue(logsExported?.isEmpty() == true)
4042
assertFalse(requestsContainsUrl(logsUrl))
4143
}
4244

4345
@Test
4446
fun `Logs should be exported when disableLogs is set to false`() {
45-
application.pluginOptions = application.pluginOptions.copy(disableLogs = false)
47+
application.pluginOptions = getOptionsAllEnabled().copy(disableLogs = false)
4648
application.initForTest()
4749
val logsUrl = "http://localhost:${application.mockWebServer?.port}/v1/logs"
4850

@@ -56,21 +58,23 @@ class DisablingConfigOptionsE2ETest {
5658

5759
@Test
5860
fun `Spans should NOT be exported when disableTraces is set to true`() {
59-
application.pluginOptions = application.pluginOptions.copy(disableTraces = true)
61+
application.pluginOptions = getOptionsAllEnabled().copy(disableTraces = true)
6062
application.initForTest()
6163
val tracesUrl = "http://localhost:${application.mockWebServer?.port}/v1/traces"
6264

6365
triggerTestSpan()
6466
LDObserve.flush()
67+
6568
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.SPANS)
69+
val spansExported = application.telemetryInspector?.spanExporter?.finishedSpanItems
6670

67-
assertNull(application.telemetryInspector?.spanExporter)
71+
assertTrue(spansExported?.isEmpty() == true)
6872
assertFalse(requestsContainsUrl(tracesUrl))
6973
}
7074

7175
@Test
7276
fun `Spans should be exported when disableTraces is set to false`() {
73-
application.pluginOptions = application.pluginOptions.copy(disableTraces = false)
77+
application.pluginOptions = getOptionsAllEnabled().copy(disableTraces = false)
7478
application.initForTest()
7579
val tracesUrl = "http://localhost:${application.mockWebServer?.port}/v1/traces"
7680

@@ -84,7 +88,7 @@ class DisablingConfigOptionsE2ETest {
8488

8589
@Test
8690
fun `Metrics should NOT be exported when disableMetrics is set to true`() {
87-
application.pluginOptions = application.pluginOptions.copy(disableMetrics = true)
91+
application.pluginOptions = getOptionsAllEnabled().copy(disableMetrics = true)
8892
application.initForTest()
8993
val metricsUrl = "http://localhost:${application.mockWebServer?.port}/v1/metrics"
9094

@@ -98,7 +102,7 @@ class DisablingConfigOptionsE2ETest {
98102

99103
@Test
100104
fun `Metrics should be exported when disableMetrics is set to false`() {
101-
application.pluginOptions = application.pluginOptions.copy(disableMetrics = false)
105+
application.pluginOptions = getOptionsAllEnabled().copy(disableMetrics = false)
102106
application.initForTest()
103107
val metricsUrl = "http://localhost:${application.mockWebServer?.port}/v1/metrics"
104108

@@ -112,7 +116,7 @@ class DisablingConfigOptionsE2ETest {
112116

113117
@Test
114118
fun `Errors should NOT be exported when disableErrorTracking is set to true`() {
115-
application.pluginOptions = application.pluginOptions.copy(disableErrorTracking = true)
119+
application.pluginOptions = getOptionsAllEnabled().copy(disableErrorTracking = true)
116120
application.initForTest()
117121
val tracesUrl = "http://localhost:${application.mockWebServer?.port}/v1/traces"
118122

@@ -127,8 +131,8 @@ class DisablingConfigOptionsE2ETest {
127131
}
128132

129133
@Test
130-
fun `Errors should be exported when disableErrorTracking is set to false`() {
131-
application.pluginOptions = application.pluginOptions.copy(disableErrorTracking = false)
134+
fun `Errors should be exported as spans when disableErrorTracking is set to false and disableTraces set to true`() {
135+
application.pluginOptions = getOptionsAllEnabled().copy(disableTraces = true, disableErrorTracking = false)
132136
application.initForTest()
133137
val tracesUrl = "http://localhost:${application.mockWebServer?.port}/v1/traces"
134138

@@ -146,6 +150,41 @@ class DisablingConfigOptionsE2ETest {
146150
)
147151
}
148152

153+
@Test
154+
fun `Crashes should NOT be exported when disableErrorTracking is set to true`() {
155+
application.pluginOptions = getOptionsAllEnabled().copy(disableErrorTracking = true)
156+
application.initForTest()
157+
val logsUrl = "http://localhost:${application.mockWebServer?.port}/v1/logs"
158+
159+
Thread { throw RuntimeException("Exception for testing") }.start()
160+
161+
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.LOGS)
162+
val logsExported = application.telemetryInspector?.logExporter?.finishedLogRecordItems
163+
164+
assertFalse(requestsContainsUrl(logsUrl))
165+
assertEquals(0, logsExported?.size)
166+
}
167+
168+
@Test
169+
fun `Crashes should be exported as logs when disableErrorTracking is set to false and disableLogs set to true`() {
170+
application.pluginOptions = getOptionsAllEnabled().copy(disableLogs = true, disableErrorTracking = false)
171+
application.initForTest()
172+
val logsUrl = "http://localhost:${application.mockWebServer?.port}/v1/logs"
173+
val exceptionMessage = "Exception for testing"
174+
175+
Thread { throw RuntimeException(exceptionMessage) }.start()
176+
177+
waitForTelemetryData(telemetryInspector = application.telemetryInspector, telemetryType = TelemetryType.LOGS)
178+
val logsExported = application.telemetryInspector?.logExporter?.finishedLogRecordItems
179+
180+
assertTrue(requestsContainsUrl(logsUrl))
181+
assertEquals(1, logsExported?.size)
182+
assertEquals(
183+
exceptionMessage,
184+
logsExported?.get(0)?.attributes?.get(AttributeKey.stringKey("exception.message"))
185+
)
186+
}
187+
149188
private fun requestsContainsUrl(url: String): Boolean {
150189
while (true) {
151190
val request = application.mockWebServer?.takeRequest(100, TimeUnit.MILLISECONDS)
@@ -180,4 +219,14 @@ class DisablingConfigOptionsE2ETest {
180219
private fun triggerTestMetric() {
181220
LDObserve.recordMetric(Metric("test", 50.0))
182221
}
222+
223+
private fun getOptionsAllEnabled(): Options {
224+
return Options(
225+
debug = true,
226+
disableTraces = false,
227+
disableLogs = false,
228+
disableMetrics = false,
229+
disableErrorTracking = false
230+
)
231+
}
183232
}

e2e/go-plugin/go.mod

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/bytedance/sonic v1.13.3 // indirect
2222
github.com/bytedance/sonic/loader v0.2.4 // indirect
2323
github.com/cloudwego/base64x v0.1.5 // indirect
24+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2425
github.com/felixge/httpsnoop v1.0.4 // indirect
2526
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
2627
github.com/gin-contrib/sse v1.1.0 // indirect
@@ -38,13 +39,17 @@ require (
3839
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3940
github.com/modern-go/reflect2 v1.0.2 // indirect
4041
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
42+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
4143
github.com/rivo/uniseg v0.4.7 // indirect
44+
github.com/samber/lo v1.51.0 // indirect
4245
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
4346
github.com/ugorji/go/codec v1.3.0 // indirect
4447
github.com/valyala/bytebufferpool v1.0.0 // indirect
4548
github.com/valyala/fasthttp v1.64.0 // indirect
46-
github.com/vektah/gqlparser/v2 v2.5.19 // indirect
49+
github.com/vektah/gqlparser/v2 v2.5.25 // indirect
4750
go.opentelemetry.io/contrib v1.37.0 // indirect
51+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect
52+
go.opentelemetry.io/otel/sdk/log/logtest v0.14.0 // indirect
4853
golang.org/x/arch v0.18.0 // indirect
4954
golang.org/x/crypto v0.40.0 // indirect
5055
gopkg.in/yaml.v3 v3.0.1 // indirect
@@ -56,7 +61,7 @@ require (
5661
github.com/go-logr/logr v1.4.3 // indirect
5762
github.com/go-logr/stdr v1.2.2 // indirect
5863
github.com/google/uuid v1.6.0 // indirect
59-
github.com/gregjones/httpcache v0.0.0-20171119193500-2bcd89a1743f // indirect
64+
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
6065
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
6166
github.com/josharian/intern v1.0.0 // indirect
6267
github.com/launchdarkly/ccache v1.1.0 // indirect
@@ -72,22 +77,22 @@ require (
7277
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
7378
go.opentelemetry.io/contrib/bridges/otellogrus v0.12.0
7479
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.62.0
75-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0
76-
go.opentelemetry.io/otel v1.37.0
80+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0
81+
go.opentelemetry.io/otel v1.38.0
7782
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.13.0 // indirect
7883
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.37.0 // indirect
7984
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
8085
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.37.0 // indirect
81-
go.opentelemetry.io/otel/log v0.13.0 // indirect
82-
go.opentelemetry.io/otel/metric v1.37.0 // indirect
83-
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
84-
go.opentelemetry.io/otel/sdk/log v0.13.0 // indirect
85-
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
86-
go.opentelemetry.io/otel/trace v1.37.0
86+
go.opentelemetry.io/otel/log v0.14.0 // indirect
87+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
88+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
89+
go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect
90+
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
91+
go.opentelemetry.io/otel/trace v1.38.0
8792
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
8893
golang.org/x/net v0.42.0 // indirect
8994
golang.org/x/sync v0.16.0 // indirect
90-
golang.org/x/sys v0.34.0 // indirect
95+
golang.org/x/sys v0.35.0 // indirect
9196
golang.org/x/text v0.27.0 // indirect
9297
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
9398
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect

0 commit comments

Comments
 (0)