Skip to content

Commit 55bc327

Browse files
ibesoragithub-actions[bot]
authored andcommitted
Add event to collect appearances runtime API usage
GitOrigin-RevId: 52c45d4b9cd91523b904702dd16f2e773797b137
1 parent 075ceee commit 55bc327

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/ui/map.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
AUTH_ERR_MSG,
1515
storeAuthState,
1616
removeAuthState,
17-
postStyleWithAppearanceEvent
17+
postStyleWithAppearanceEvent,
18+
postAddedAppearanceEvent
1819
} from '../util/mapbox';
1920
import Style from '../style/style';
2021
import IndoorManager from '../style/indoor_manager';
@@ -3516,6 +3517,10 @@ export class Map extends Camera {
35163517
return this;
35173518
}
35183519

3520+
if (name === 'appearances') {
3521+
this._postAddingAppearancesToStyleEvent();
3522+
}
3523+
35193524
this.style.setLayerProperty(layerId, name, value, options);
35203525
return this._update(true);
35213526
}
@@ -4814,6 +4819,10 @@ export class Map extends Camera {
48144819
postStyleWithAppearanceEvent(this._requestManager._customAccessToken);
48154820
}
48164821

4822+
_postAddingAppearancesToStyleEvent() {
4823+
postAddedAppearanceEvent(this._requestManager._customAccessToken);
4824+
}
4825+
48174826
_updateTerrain() {
48184827
// Recalculate if enabled/disabled and calculate elevation cover. As camera is using elevation tiles before
48194828
// render (and deferred update after zoom recalculation), this needs to be called when removing terrain source.

src/util/mapbox.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,10 @@ export const styleWithAppearanceEvent = new MetricsEvent({attributes: [{name: 'm
866866
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
867867
export const postStyleWithAppearanceEvent: (arg1: string | null | undefined) => void = styleWithAppearanceEvent.postMetricsEvent.bind(styleWithAppearanceEvent);
868868

869+
export const addedAppearanceEvent = new MetricsEvent({attributes: [{name: 'maps/js/layer-animations/runtime-appearances'}]});
870+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
871+
export const postAddedAppearanceEvent: (arg1: string | null | undefined) => void = addedAppearanceEvent.postMetricsEvent.bind(addedAppearanceEvent);
872+
869873
export const performanceEvent_: PerformanceEvent = new PerformanceEvent();
870874
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
871875
export const postPerformanceEvent: (arg1: string | null | undefined, arg2: LivePerformanceData) => void = performanceEvent_.postPerformanceEvent.bind(performanceEvent_);

0 commit comments

Comments
 (0)