mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
feat(spotify): add userId to crawling traces
This commit is contained in:
parent
9ba47a560c
commit
1b67872402
1 changed files with 3 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable, Logger } from "@nestjs/common";
|
import { Injectable, Logger } from "@nestjs/common";
|
||||||
import { chunk, uniq } from "lodash";
|
import { chunk, uniq } from "lodash";
|
||||||
import { Span } from "nestjs-otel";
|
import { Span, TraceService } from "nestjs-otel";
|
||||||
import type { Job } from "pg-boss";
|
import type { Job } from "pg-boss";
|
||||||
import { ListensService } from "../../listens/listens.service";
|
import { ListensService } from "../../listens/listens.service";
|
||||||
import { Album } from "../../music-library/album.entity";
|
import { Album } from "../../music-library/album.entity";
|
||||||
|
|
@ -40,6 +40,7 @@ export class SpotifyService {
|
||||||
private readonly musicLibraryService: MusicLibraryService,
|
private readonly musicLibraryService: MusicLibraryService,
|
||||||
private readonly spotifyApi: SpotifyApiService,
|
private readonly spotifyApi: SpotifyApiService,
|
||||||
private readonly spotifyAuth: SpotifyAuthService,
|
private readonly spotifyAuth: SpotifyAuthService,
|
||||||
|
private readonly traceService: TraceService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Span()
|
@Span()
|
||||||
|
|
@ -89,6 +90,7 @@ export class SpotifyService {
|
||||||
retryOnExpiredToken: boolean = true,
|
retryOnExpiredToken: boolean = true,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.logger.debug({ userId: user.id }, `Crawling recently played tracks`);
|
this.logger.debug({ userId: user.id }, `Crawling recently played tracks`);
|
||||||
|
this.traceService.getSpan().setAttribute("userId", user.id);
|
||||||
|
|
||||||
let playHistory: PlayHistoryObject[];
|
let playHistory: PlayHistoryObject[];
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue