Commit 2b10d24
fix: report service.name and service.version as resource attributes (#236)
## Summary
- `service.name` (and `service.version`) were missing from exported
spans/logs/metrics. The value was only applied to the **instrumentation
scope**, not the OpenTelemetry **resource**, so backends saw an empty
`service.name`.
- This is a regression from #176, which removed the lines that copied
`options.serviceName` / `options.serviceVersion` into the resource
attributes. They had been present since Oct 2025 (#36).
- Restores those resource attributes in
`Observability.add(metadata:into:)` and re-adds the `service.name` /
`service.version` constants to `SemanticConvention`.
## Changes
- `SemanticConvention`: re-add `serviceName` (`service.name`) and
`serviceVersion` (`service.version`).
- `Observability.add(metadata:into:)`: populate `service.name` /
`service.version` resource attributes from `options.serviceName` /
`options.serviceVersion`.
## Test plan
- [ ] Build the SDK and TestApp.
- [ ] Emit a span/log/metric and confirm the exported OTLP
`resource.attributes` now includes `service.name` (and
`service.version`).
- [ ] Confirm the value reflects `ObservabilityOptions.serviceName`
(e.g. `observability-ios-test-app` in the TestApp).
Made with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 8673cad commit 2b10d24
2 files changed
Lines changed: 4 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
0 commit comments