From 906d6e19ba93feb444f00d90b1aae183e37f9d50 Mon Sep 17 00:00:00 2001 From: Jamie Danielson Date: Wed, 25 Sep 2024 11:38:18 -0400 Subject: [PATCH] feat: add PHP to list of telemetry libraries (#278) ## Which problem is this PR solving? - lack of visibility into php library usage ## Short description of the changes - add PHP instrumentation library prefix - fix typo in test for `telemetry.instrumentation_name` --- otlp/common.go | 1 + otlp/traces_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/otlp/common.go b/otlp/common.go index 75a8e00..291f63c 100644 --- a/otlp/common.go +++ b/otlp/common.go @@ -77,6 +77,7 @@ var ( "OpenTelemetry::Instrumentation", // Ruby "go.opentelemetry.io/contrib/instrumentation", // Go "@opentelemetry/instrumentation", // JS + "io.opentelemetry.contrib.php", // PHP } ) diff --git a/otlp/traces_test.go b/otlp/traces_test.go index a7f01d3..dd737c7 100644 --- a/otlp/traces_test.go +++ b/otlp/traces_test.go @@ -1107,7 +1107,7 @@ func TestInstrumentationLibrarySpansHaveAttributeAdded(t *testing.T) { assert.Equal(t, "test_span_a", first_event.Attributes["name"]) assert.Equal(t, "First", first_event.Attributes["library.name"]) assert.Equal(t, "1.1.1", first_event.Attributes["library.version"]) - assert.NotContains(t, first_event.Attributes, "telemtetry.instrumentation_library") + assert.NotContains(t, first_event.Attributes, "telemetry.instrumentation_library") second_event := events[1] assert.Equal(t, "test_span_b", second_event.Attributes["name"]) assert.Equal(t, "io.opentelemetry.instrumentation.http", second_event.Attributes["library.name"]) @@ -1161,6 +1161,11 @@ func TestKnownInstrumentationPrefixesReturnTrue(t *testing.T) { libraryName: "@opentelemetry/instrumentation/http", isInstrumentationLibrary: true, }, + { + name: "php", + libraryName: "io.opentelemetry.contrib.php.slim", + isInstrumentationLibrary: true, + }, } for _, test := range tests {