Skip to content

Commit

Permalink
refactor(browser-detector): replace ResourceAtrributes with `Attrib…
Browse files Browse the repository at this point in the history
…utes` (#5004)
  • Loading branch information
david-luna authored Sep 20, 2024
1 parent cdfefb8 commit 0571e42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ All notable changes to experimental packages in this project will be documented

* refactor(exporter-prometheus): replace `MetricAttributes` and `MetricAttributeValues` with `Attributes` and `AttributeValues` [#4993](https://github.com/open-telemetry/opentelemetry-js/pull/4993)

* refactor(browser-detector): replace `ResourceAttributes` with `Attributes` [#5004](https://github.com/open-telemetry/opentelemetry-js/pull/5004)

## 0.53.0

### :boom: Breaking Change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import { diag } from '@opentelemetry/api';
import { Attributes, diag } from '@opentelemetry/api';
import {
Detector,
IResource,
Resource,
ResourceDetectionConfig,
} from '@opentelemetry/resources';
import { ResourceAttributes } from '@opentelemetry/resources';
import { BROWSER_ATTRIBUTES, UserAgentData } from './types';

/**
Expand All @@ -33,7 +32,7 @@ class BrowserDetector implements Detector {
if (!isBrowser) {
return Resource.empty();
}
const browserResource: ResourceAttributes = getBrowserAttributes();
const browserResource: Attributes = getBrowserAttributes();
return this._getResourceAttributes(browserResource, config);
}
/**
Expand All @@ -44,7 +43,7 @@ class BrowserDetector implements Detector {
* @returns The sanitized resource attributes.
*/
private _getResourceAttributes(
browserResource: ResourceAttributes,
browserResource: Attributes,
_config?: ResourceDetectionConfig
) {
if (
Expand All @@ -62,8 +61,8 @@ class BrowserDetector implements Detector {
}

// Add Browser related attributes to resources
function getBrowserAttributes(): ResourceAttributes {
const browserAttribs: ResourceAttributes = {};
function getBrowserAttributes(): Attributes {
const browserAttribs: Attributes = {};
const userAgentData: UserAgentData | undefined = (navigator as any)
.userAgentData;
if (userAgentData) {
Expand Down

0 comments on commit 0571e42

Please sign in to comment.