mirror of https://github.com/jellyfin/jellyfin.git
Compare commits
13 Commits
e5da6c883f
...
7df71bf72a
Author | SHA1 | Date |
---|---|---|
clay | 7df71bf72a | |
Nyanmisaka | e2a22cec0e | |
queeup | 067962ae2a | |
Szilágyi Kristóf | 8a65d239b7 | |
HiPotionQ8 | 518404cd1d | |
clay | 74fb38eef8 | |
clay | d67f631979 | |
clay | 6f26d2cd34 | |
clay | 65f1a7e183 | |
Clay Buxton | 20d85066cc | |
Clay Buxton | f963ce1d58 | |
Ahmed Rafiq | d84db4b8e4 | |
Ahmed Rafiq Ullah | b220f1e127 |
|
@ -25,6 +25,7 @@ using Emby.Server.Implementations.HttpServer.Security;
|
|||
using Emby.Server.Implementations.IO;
|
||||
using Emby.Server.Implementations.Library;
|
||||
using Emby.Server.Implementations.Localization;
|
||||
using Emby.Server.Implementations.Metrics;
|
||||
using Emby.Server.Implementations.Playlists;
|
||||
using Emby.Server.Implementations.Plugins;
|
||||
using Emby.Server.Implementations.QuickConnect;
|
||||
|
@ -59,6 +60,7 @@ using MediaBrowser.Controller.Library;
|
|||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Lyrics;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.Metrics;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
|
@ -419,12 +421,6 @@ namespace Emby.Server.Implementations
|
|||
|
||||
NetManager = new NetworkManager(ConfigurationManager, _startupConfig, LoggerFactory.CreateLogger<NetworkManager>());
|
||||
|
||||
// Initialize runtime stat collection
|
||||
if (ConfigurationManager.Configuration.EnableMetrics)
|
||||
{
|
||||
DotNetRuntimeStatsBuilder.Default().StartCollecting();
|
||||
}
|
||||
|
||||
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
|
||||
HttpPort = networkConfiguration.InternalHttpPort;
|
||||
HttpsPort = networkConfiguration.InternalHttpsPort;
|
||||
|
@ -552,6 +548,7 @@ namespace Emby.Server.Implementations
|
|||
serviceCollection.AddScoped<DynamicHlsHelper>();
|
||||
serviceCollection.AddScoped<IClientEventLogger, ClientEventLogger>();
|
||||
serviceCollection.AddSingleton<IDirectoryService, DirectoryService>();
|
||||
serviceCollection.AddSingleton<IMetricsCollector, PrometheusMetricsCollector>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -579,6 +576,16 @@ namespace Emby.Server.Implementations
|
|||
|
||||
SetStaticProperties();
|
||||
|
||||
|
||||
var userDataRepo = (SqliteUserDataRepository)Resolve<IUserDataRepository>();
|
||||
((SqliteItemRepository)Resolve<IItemRepository>()).Initialize(userDataRepo, Resolve<IUserManager>());
|
||||
|
||||
// Initialize runtime stat collection
|
||||
if (ConfigurationManager.Configuration.EnableMetrics)
|
||||
{
|
||||
Resolve<IMetricsCollector>().Initialize();
|
||||
}
|
||||
|
||||
FindParts();
|
||||
}
|
||||
|
||||
|
|
|
@ -128,5 +128,7 @@
|
|||
"TaskRefreshTrickplayImages": "توليد صور Trickplay",
|
||||
"TaskRefreshTrickplayImagesDescription": "يُنشئ معاينات Trickplay لمقاطع الفيديو في المكتبات المُمكّنة.",
|
||||
"TaskCleanCollectionsAndPlaylists": "حذف المجموعات وقوائم التشغيل",
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "حذف عناصر من المجموعات وقوائم التشغيل التي لم تعد موجودة."
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "حذف عناصر من المجموعات وقوائم التشغيل التي لم تعد موجودة.",
|
||||
"TaskAudioNormalization": "تطبيع الصوت",
|
||||
"TaskAudioNormalizationDescription": "مسح الملفات لتطبيع بيانات الصوت."
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"Albums": "Albumok",
|
||||
"AppDeviceValues": "Program: {0}, eszköz: {1}",
|
||||
"AppDeviceValues": "Program: {0}, Eszköz: {1}",
|
||||
"Application": "Alkalmazás",
|
||||
"Artists": "Előadók",
|
||||
"AuthenticationSucceededWithUserName": "{0} sikeresen hitelesítve",
|
||||
"Books": "Könyvek",
|
||||
"CameraImageUploadedFrom": "Új kamerakép feltöltve innen: {0}",
|
||||
"CameraImageUploadedFrom": "Új kamerakép lett feltöltve innen: {0}",
|
||||
"Channels": "Csatornák",
|
||||
"ChapterNameValue": "{0}. jelenet",
|
||||
"ChapterNameValue": "Jelenet {0}",
|
||||
"Collections": "Gyűjtemények",
|
||||
"DeviceOfflineWithName": "{0} kijelentkezett",
|
||||
"DeviceOnlineWithName": "{0} belépett",
|
||||
|
@ -15,27 +15,27 @@
|
|||
"Favorites": "Kedvencek",
|
||||
"Folders": "Könyvtárak",
|
||||
"Genres": "Műfajok",
|
||||
"HeaderAlbumArtists": "Albumelőadók",
|
||||
"HeaderAlbumArtists": "Album előadók",
|
||||
"HeaderContinueWatching": "Megtekintés folytatása",
|
||||
"HeaderFavoriteAlbums": "Kedvenc albumok",
|
||||
"HeaderFavoriteAlbums": "Kedvenc Albumok",
|
||||
"HeaderFavoriteArtists": "Kedvenc előadók",
|
||||
"HeaderFavoriteEpisodes": "Kedvenc epizódok",
|
||||
"HeaderFavoriteShows": "Kedvenc sorozatok",
|
||||
"HeaderFavoriteSongs": "Kedvenc számok",
|
||||
"HeaderFavoriteSongs": "Kedvenc dalok",
|
||||
"HeaderLiveTV": "Élő TV",
|
||||
"HeaderNextUp": "Következik",
|
||||
"HeaderRecordingGroups": "Felvételi csoportok",
|
||||
"HomeVideos": "Házi videók",
|
||||
"HomeVideos": "Otthoni videók",
|
||||
"Inherit": "Örökölt",
|
||||
"ItemAddedWithName": "{0} hozzáadva a könyvtárhoz",
|
||||
"ItemRemovedWithName": "{0} eltávolítva a könyvtárból",
|
||||
"LabelIpAddressValue": "IP-cím: {0}",
|
||||
"LabelRunningTimeValue": "Lejátszási idő: {0}",
|
||||
"Latest": "Legújabb",
|
||||
"MessageApplicationUpdated": "A Jellyfin kiszolgáló frissítve",
|
||||
"MessageApplicationUpdated": "A Jellyfin kiszolgáló frissítve lett",
|
||||
"MessageApplicationUpdatedTo": "A Jellyfin kiszolgáló frissítve lett a következőre: {0}",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "A kiszolgálókonfigurációs rész frissítve: {0}",
|
||||
"MessageServerConfigurationUpdated": "Kiszolgálókonfiguráció frissítve",
|
||||
"MessageNamedServerConfigurationUpdatedWithValue": "A kiszolgálókonfigurációs rész frissítve lett: {0}",
|
||||
"MessageServerConfigurationUpdated": "Kiszolgálókonfiguráció frissítve lett",
|
||||
"MixedContent": "Vegyes tartalom",
|
||||
"Movies": "Filmek",
|
||||
"Music": "Zenék",
|
||||
|
@ -46,7 +46,7 @@
|
|||
"NewVersionIsAvailable": "Letölthető a Jellyfin kiszolgáló új verziója.",
|
||||
"NotificationOptionApplicationUpdateAvailable": "Frissítés érhető el az alkalmazáshoz",
|
||||
"NotificationOptionApplicationUpdateInstalled": "Alkalmazásfrissítés telepítve",
|
||||
"NotificationOptionAudioPlayback": "Hanglejátszás elkezdve",
|
||||
"NotificationOptionAudioPlayback": "Hanglejátszás elkezdődött",
|
||||
"NotificationOptionAudioPlaybackStopped": "Hanglejátszás leállítva",
|
||||
"NotificationOptionCameraImageUploaded": "Kamerakép feltöltve",
|
||||
"NotificationOptionInstallationFailed": "Telepítési hiba",
|
||||
|
@ -126,5 +126,9 @@
|
|||
"External": "Külső",
|
||||
"HearingImpaired": "Hallássérült",
|
||||
"TaskRefreshTrickplayImages": "Trickplay képek generálása",
|
||||
"TaskRefreshTrickplayImagesDescription": "Trickplay előnézetet készít az engedélyezett könyvtárakban lévő videókhoz."
|
||||
"TaskRefreshTrickplayImagesDescription": "Trickplay előnézetet készít az engedélyezett könyvtárakban lévő videókhoz.",
|
||||
"TaskAudioNormalization": "Hangerő Normalizáció",
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "Nem létező elemek törlése a gyűjteményekből és lejátszási listákról.",
|
||||
"TaskAudioNormalizationDescription": "Hangerő normalizációs adatok keresése.",
|
||||
"TaskCleanCollectionsAndPlaylists": "Gyűjtemények és lejátszási listák optimalizálása"
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@
|
|||
"TaskRefreshTrickplayImages": "Trickplay Görselleri Oluştur",
|
||||
"TaskRefreshTrickplayImagesDescription": "Etkin kütüphanelerdeki videolar için trickplay önizlemeleri oluşturur.",
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "Artık var olmayan koleksiyon ve çalma listelerindeki ögeleri kaldırır.",
|
||||
"TaskCleanCollectionsAndPlaylists": "Koleksiyonları ve çalma listelerini temizleyin"
|
||||
"TaskCleanCollectionsAndPlaylists": "Koleksiyonları ve çalma listelerini temizleyin",
|
||||
"TaskAudioNormalizationDescription": "Ses normalleştirme verileri için dosyaları tarar.",
|
||||
"TaskAudioNormalization": "Ses Normalleştirme"
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@
|
|||
"TaskRefreshTrickplayImages": "生成时间轴缩略图",
|
||||
"TaskRefreshTrickplayImagesDescription": "为启用的媒体库中的视频生成时间轴缩略图。",
|
||||
"TaskCleanCollectionsAndPlaylists": "清理合集和播放列表",
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "清理合集和播放列表中已不存在的项目。"
|
||||
"TaskCleanCollectionsAndPlaylistsDescription": "清理合集和播放列表中已不存在的项目。",
|
||||
"TaskAudioNormalization": "音频标准化",
|
||||
"TaskAudioNormalizationDescription": "扫描文件以寻找音频标准化数据。"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Metrics;
|
||||
using Prometheus;
|
||||
using Prometheus.DotNetRuntime;
|
||||
|
||||
namespace Emby.Server.Implementations.Metrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Prometheus backend for metrics.
|
||||
/// </summary>
|
||||
public class PrometheusMetricsCollector : IMetricsCollector
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
private static readonly Gauge _itemCountGauge = Prometheus.Metrics.CreateGauge("jellyfin_library_items_total", "The number of items in the library", new[] { "item_type" });
|
||||
private static readonly string[] _metricTypes = new string[]
|
||||
{
|
||||
nameof(Movie),
|
||||
nameof(Series), nameof(Season), nameof(Episode),
|
||||
nameof(MusicArtist), nameof(MusicAlbum), nameof(MusicVideo), nameof(Audio),
|
||||
nameof(Book),
|
||||
nameof(PhotoAlbum), nameof(Photo)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PrometheusMetricsCollector" /> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryManager">The library manager. </param>
|
||||
public PrometheusMetricsCollector(ILibraryManager libraryManager)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_libraryManager.ItemAdded += IncrementItemCount;
|
||||
_libraryManager.ItemRemoved += (s, e) => UpdateItemCount();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Initialize()
|
||||
{
|
||||
DotNetRuntimeStatsBuilder.Default().StartCollecting();
|
||||
UpdateItemCount();
|
||||
}
|
||||
|
||||
private void UpdateItemCount()
|
||||
{
|
||||
foreach (var type in _metricTypes)
|
||||
{
|
||||
BaseItemKind item;
|
||||
Enum.TryParse(type, out item);
|
||||
var query = new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { item }
|
||||
};
|
||||
int count = _libraryManager.GetCount(query);
|
||||
_itemCountGauge.WithLabels(type).Set(count);
|
||||
}
|
||||
}
|
||||
|
||||
private void IncrementItemCount(object? sender, ItemChangeEventArgs e)
|
||||
{
|
||||
var item = e.Item;
|
||||
var typeName = item.GetType().Name;
|
||||
if (_metricTypes.Contains(typeName))
|
||||
{
|
||||
_itemCountGauge.WithLabels(typeName).Inc();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Metrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for metric backends.
|
||||
/// </summary>
|
||||
public interface IMetricsCollector
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes metrics.
|
||||
/// </summary>
|
||||
public void Initialize();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue