Skip to content

Commit

Permalink
feat: add PHP to list of telemetry libraries (#278)
Browse files Browse the repository at this point in the history
## 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`
  • Loading branch information
JamieDanielson authored Sep 25, 2024
1 parent 02036d4 commit 906d6e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions otlp/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var (
"OpenTelemetry::Instrumentation", // Ruby
"go.opentelemetry.io/contrib/instrumentation", // Go
"@opentelemetry/instrumentation", // JS
"io.opentelemetry.contrib.php", // PHP
}
)

Expand Down
7 changes: 6 additions & 1 deletion otlp/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 906d6e1

Please sign in to comment.