Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Michael Mayer
8990d48381 Develop: Upgrade base image from 231127-mantic to 231206-mantic
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-12-06 17:10:53 +01:00
Michael Mayer
9c6fae98d3 Frontend: Update deps in package-lock.json
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-12-06 17:10:16 +01:00
graciousgrey
55d5e7a732 Videos: Add file info for .mxf files #3935 2023-12-06 12:02:13 +01:00
graciousgrey
3507f5ef55 Add support for .mxf files #3935 2023-12-06 11:59:53 +01:00
Brandon Richardson
3d962e2382 Backend: Expose prometheus-style metrics endpoint
Expose a new API which can be scraped by prometheus to gather useful
metrics from an instance. The new endpoint exposes photoprism build
version information, golang version, edition and various count metrics.
2023-12-06 08:13:24 +01:00
13 changed files with 242 additions and 61 deletions

View file

@ -1,5 +1,5 @@
# Ubuntu 23.10 (Mantic Minotaur)
FROM photoprism/develop:231127-mantic
FROM photoprism/develop:231206-mantic
## Alternative Environments:
# FROM photoprism/develop:armv7 # ARMv7 (32bit)

View file

@ -3130,9 +3130,9 @@
}
},
"node_modules/@polka/url": {
"version": "1.0.0-next.23",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.23.tgz",
"integrity": "sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg=="
"version": "1.0.0-next.24",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.24.tgz",
"integrity": "sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ=="
},
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
@ -3279,49 +3279,49 @@
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
},
"node_modules/@vue/compiler-core": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.3.9.tgz",
"integrity": "sha512-+/Lf68Vr/nFBA6ol4xOtJrW+BQWv3QWKfRwGSm70jtXwfhZNF4R/eRgyVJYoxFRhdCTk/F6g99BP0ffPgZihfQ==",
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.3.10.tgz",
"integrity": "sha512-doe0hODR1+i1menPkRzJ5MNR6G+9uiZHIknK3Zn5OcIztu6GGw7u0XUzf3AgB8h/dfsZC9eouzoLo3c3+N/cVA==",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/shared": "3.3.9",
"@babel/parser": "^7.23.5",
"@vue/shared": "3.3.10",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.3.9.tgz",
"integrity": "sha512-nfWubTtLXuT4iBeDSZ5J3m218MjOy42Vp2pmKVuBKo2/BLcrFUX8nCSr/bKRFiJ32R8qbdnnnBgRn9AdU5v0Sg==",
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.3.10.tgz",
"integrity": "sha512-NCrqF5fm10GXZIK0GrEAauBqdy+F2LZRt3yNHzrYjpYBuRssQbuPLtSnSNjyR9luHKkWSH8we5LMB3g+4z2HvA==",
"dependencies": {
"@vue/compiler-core": "3.3.9",
"@vue/shared": "3.3.9"
"@vue/compiler-core": "3.3.10",
"@vue/shared": "3.3.10"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.3.9.tgz",
"integrity": "sha512-wy0CNc8z4ihoDzjASCOCsQuzW0A/HP27+0MDSSICMjVIFzk/rFViezkR3dzH+miS2NDEz8ywMdbjO5ylhOLI2A==",
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.3.10.tgz",
"integrity": "sha512-xpcTe7Rw7QefOTRFFTlcfzozccvjM40dT45JtrE3onGm/jBLZ0JhpKu3jkV7rbDFLeeagR/5RlJ2Y9SvyS0lAg==",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/compiler-core": "3.3.9",
"@vue/compiler-dom": "3.3.9",
"@vue/compiler-ssr": "3.3.9",
"@vue/reactivity-transform": "3.3.9",
"@vue/shared": "3.3.9",
"@babel/parser": "^7.23.5",
"@vue/compiler-core": "3.3.10",
"@vue/compiler-dom": "3.3.10",
"@vue/compiler-ssr": "3.3.10",
"@vue/reactivity-transform": "3.3.10",
"@vue/shared": "3.3.10",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.31",
"postcss": "^8.4.32",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.3.9.tgz",
"integrity": "sha512-NO5oobAw78R0G4SODY5A502MGnDNiDjf6qvhn7zD7TJGc8XDeIEw4fg6JU705jZ/YhuokBKz0A5a/FL/XZU73g==",
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.3.10.tgz",
"integrity": "sha512-12iM4jA4GEbskwXMmPcskK5wImc2ohKm408+o9iox3tfN9qua8xL0THIZtoe9OJHnXP4eOWZpgCAAThEveNlqQ==",
"dependencies": {
"@vue/compiler-dom": "3.3.9",
"@vue/shared": "3.3.9"
"@vue/compiler-dom": "3.3.10",
"@vue/shared": "3.3.10"
}
},
"node_modules/@vue/component-compiler-utils": {
@ -3393,26 +3393,26 @@
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A=="
},
"node_modules/@vue/reactivity-transform": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.9.tgz",
"integrity": "sha512-HnUFm7Ry6dFa4Lp63DAxTixUp8opMtQr6RxQCpDI1vlh12rkGIeYqMvJtK+IKyEfEOa2I9oCkD1mmsPdaGpdVg==",
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.10.tgz",
"integrity": "sha512-0xBdk+CKHWT+Gev8oZ63Tc0qFfj935YZx+UAynlutnrDZ4diFCVFMWixn65HzjE3S1iJppWOo6Tt1OzASH7VEg==",
"dependencies": {
"@babel/parser": "^7.23.3",
"@vue/compiler-core": "3.3.9",
"@vue/shared": "3.3.9",
"@babel/parser": "^7.23.5",
"@vue/compiler-core": "3.3.10",
"@vue/shared": "3.3.10",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5"
}
},
"node_modules/@vue/shared": {
"version": "3.3.9",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.9.tgz",
"integrity": "sha512-ZE0VTIR0LmYgeyhurPTpy4KzKsuDyQbMSdM49eKkMnT5X4VfFBLysMzjIZhLEFQYjjOVVfbvUDHckwjDFiO2eA=="
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.10.tgz",
"integrity": "sha512-2y3Y2J1a3RhFa0WisHvACJR2ncvWiVHcP8t0Inxo+NKz+8RKO4ZV8eZgCxRgQoA6ITfV12L4E6POOL9HOU5nqw=="
},
"node_modules/@vvo/tzdb": {
"version": "6.117.0",
"resolved": "https://registry.npmjs.org/@vvo/tzdb/-/tzdb-6.117.0.tgz",
"integrity": "sha512-vZkfoag1kHqItK/zebxT0Fkt3R/zscjgD+Ib7kaAdum0Sz9psXDfVHPW1Benv91d02zPWlLIvZtjBmzX4a+6fw=="
"version": "6.118.0",
"resolved": "https://registry.npmjs.org/@vvo/tzdb/-/tzdb-6.118.0.tgz",
"integrity": "sha512-5hHFIr0XnMOzaoQ4AgO4IRPc04H05KL0Y3lYlQ4HcZtoaEjs5JLB6i+lxdhQVcQ5An4SJOdgxTChhXkSz8plOg=="
},
"node_modules/@webassemblyjs/ast": {
"version": "1.11.6",
@ -3697,9 +3697,9 @@
}
},
"node_modules/acorn-walk": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz",
"integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==",
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz",
"integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==",
"engines": {
"node": ">=0.4.0"
}
@ -5037,9 +5037,9 @@
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
},
"node_modules/core-js": {
"version": "3.33.3",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.33.3.tgz",
"integrity": "sha512-lo0kOocUlLKmm6kv/FswQL8zbkH7mVsLJ/FULClOhv8WRVmKLVcs6XPNQAzstfeJTCHMyButEwG+z1kHxHoDZw==",
"version": "3.34.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.34.0.tgz",
"integrity": "sha512-aDdvlDder8QmY91H88GzNi9EtQi2TjvQhpCX6B1v/dAZHU1AuLgHvRh54RiOerpEhEW46Tkf+vgAViB/CWC0ag==",
"hasInstallScript": true,
"funding": {
"type": "opencollective",
@ -5047,11 +5047,11 @@
}
},
"node_modules/core-js-compat": {
"version": "3.33.3",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.3.tgz",
"integrity": "sha512-cNzGqFsh3Ot+529GIXacjTJ7kegdt5fPXxCBVS1G0iaZpuo/tBz399ymceLJveQhFFZ8qThHiP3fzuoQjKN2ow==",
"version": "3.34.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.34.0.tgz",
"integrity": "sha512-4ZIyeNbW/Cn1wkMMDy+mvrRUxrwFNjKwbhCfQpDd+eLgYipDqp8oGFGtLmhh18EDPKA0g3VUBYOxQGGwvWLVpA==",
"dependencies": {
"browserslist": "^4.22.1"
"browserslist": "^4.22.2"
},
"funding": {
"type": "opencollective",
@ -5888,9 +5888,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.4.601",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.601.tgz",
"integrity": "sha512-SpwUMDWe9tQu8JX5QCO1+p/hChAi9AE9UpoC3rcHVc+gdCGlbT3SGb5I1klgb952HRIyvt9wZhSz9bNBYz9swA=="
"version": "1.4.605",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.605.tgz",
"integrity": "sha512-V52j+P5z6cdRqTjPR/bYNxx7ETCHIkm5VIGuyCy3CMrfSnbEpIlLnk5oHmZo7gYvDfh2TfHeanB6rawyQ23ktg=="
},
"node_modules/emoji-regex": {
"version": "8.0.0",
@ -7554,9 +7554,9 @@
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ=="
},
"node_modules/flow-remove-types": {
"version": "2.223.2",
"resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.223.2.tgz",
"integrity": "sha512-w49sqmIs86Qofh1Ip4eWmuEv5e7oAAUQzDQVPddjvGErn5GxtGBy0JAymPGyRj3Q2kS5/ta5q+9v5+a8858gWw==",
"version": "2.223.3",
"resolved": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-2.223.3.tgz",
"integrity": "sha512-kHI94n1LabZgnjSyg5xIIRKkJf+AS7DA3dt6lSHeMW7AzdCYN+1X+a5gY9I4OXexJNIp6lGvJs0lBzk5pcdC/g==",
"dependencies": {
"hermes-parser": "0.17.1",
"pirates": "^3.0.2",
@ -13813,9 +13813,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/terser": {
"version": "5.24.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz",
"integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==",
"version": "5.25.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.25.0.tgz",
"integrity": "sha512-we0I9SIsfvNUMP77zC9HG+MylwYYsGFSBG8qm+13oud2Yh+O104y614FRbyjpxys16jZwot72Fpi827YvGzuqg==",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2",

9
go.mod
View file

@ -75,6 +75,8 @@ require github.com/go-ldap/ldap/v3 v3.4.6
require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
@ -95,11 +97,16 @@ require (
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mandykoh/go-parallel v0.1.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect

14
go.sum
View file

@ -621,6 +621,8 @@ github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4x
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
@ -633,6 +635,7 @@ github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
@ -1014,6 +1017,8 @@ github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw=
github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -1049,9 +1054,17 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
@ -1062,6 +1075,7 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=

View file

@ -15,6 +15,19 @@ import (
"github.com/photoprism/photoprism/internal/get"
)
type CloseableResponseRecorder struct {
*httptest.ResponseRecorder
closeCh chan bool
}
func (r *CloseableResponseRecorder) CloseNotify() <-chan bool {
return r.closeCh
}
func (r *CloseableResponseRecorder) closeClient() {
r.closeCh <- true
}
func TestMain(m *testing.M) {
log = logrus.StandardLogger()
log.SetLevel(logrus.TraceLevel)
@ -60,3 +73,13 @@ func PerformRequestWithBody(r http.Handler, method, path, body string) *httptest
return w
}
// Executes an API request with a stream response.
func PerformRequestWithStream(r http.Handler, method, path string) *CloseableResponseRecorder {
req, _ := http.NewRequest(method, path, nil)
w := &CloseableResponseRecorder{httptest.NewRecorder(), make(chan bool, 1)}
r.ServeHTTP(w, req)
return w
}

82
internal/api/metrics.go Normal file
View file

@ -0,0 +1,82 @@
package api
import (
"io"
"runtime"
"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/common/expfmt"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/internal/get"
)
// GET /api/v1/metrics
func GetMetrics(router *gin.RouterGroup) {
router.GET("/metrics", func(c *gin.Context) {
conf := get.Config()
counts := conf.ClientPublic().Count
c.Stream(func(w io.Writer) bool {
reg := prometheus.NewRegistry()
reg.MustRegister(collectors.NewGoCollector())
factory := promauto.With(reg)
registerCountMetrics(factory, counts)
registerBuildInfoMetric(factory, conf.ClientPublic())
metrics, err := reg.Gather()
if err != nil {
logError("metrics", err)
return false
}
for _, metric := range metrics {
if _, err := expfmt.MetricFamilyToText(w, metric); err != nil {
logError("metrics", err)
return false
}
}
return false
})
})
}
// Register metrics that exposes various statistics for this instance.
func registerCountMetrics(factory promauto.Factory, counts config.ClientCounts) {
metric := factory.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "photoprism",
Subsystem: "statistics",
Name: "media_count",
Help: "media statistics for this photoprism instance",
}, []string{"stat"},
)
metric.With(prometheus.Labels{"stat": "all"}).Set(float64(counts.All))
metric.With(prometheus.Labels{"stat": "photos"}).Set(float64(counts.Photos))
metric.With(prometheus.Labels{"stat": "videos"}).Set(float64(counts.Videos))
metric.With(prometheus.Labels{"stat": "albums"}).Set(float64(counts.Albums))
metric.With(prometheus.Labels{"stat": "folders"}).Set(float64(counts.Folders))
metric.With(prometheus.Labels{"stat": "files"}).Set(float64(counts.Files))
}
// Register a metric that exposes build information for this instance.
func registerBuildInfoMetric(factory promauto.Factory, conf config.ClientConfig) {
factory.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "photoprism",
Name: "build_info",
Help: "information about the photoprism instance",
}, []string{"edition", "goversion", "version"},
).With(prometheus.Labels{
"edition": conf.Edition,
"goversion": runtime.Version(),
"version": conf.Version,
}).Set(1.0)
}

View file

@ -0,0 +1,47 @@
package api
import (
"net/http"
"testing"
"regexp"
"github.com/stretchr/testify/assert"
)
func TestGetMetrics(t *testing.T) {
t.Run("expose count statistics", func(t *testing.T) {
app, router, _ := NewApiTest()
GetMetrics(router)
resp := PerformRequestWithStream(app, "GET", "/api/v1/metrics")
if resp.Code != http.StatusOK {
t.Fatal(resp.Body.String())
}
body := resp.Body.String()
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="all"} \d+`), body)
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="photos"} \d+`), body)
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="videos"} \d+`), body)
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="albums"} \d+`), body)
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="folders"} \d+`), body)
assert.Regexp(t, regexp.MustCompile(`photoprism_statistics_media_count{stat="files"} \d+`), body)
})
t.Run("expose build information", func(t *testing.T) {
app, router, _ := NewApiTest()
GetMetrics(router)
resp := PerformRequestWithStream(app, "GET", "/api/v1/metrics")
if resp.Code != http.StatusOK {
t.Fatal(resp.Body.String())
}
body := resp.Body.String()
assert.Regexp(t, regexp.MustCompile(`photoprism_build_info{edition=".+",goversion=".+",version=".+"} 1`), body)
})
}

View file

@ -166,4 +166,5 @@ func registerRoutes(router *gin.Engine, conf *config.Config) {
api.SendFeedback(APIv1)
api.Connect(APIv1)
api.WebSocket(APIv1)
api.GetMetrics(APIv1)
}

View file

@ -96,6 +96,7 @@ var Extensions = FileExtensions{
".mp": VideoMP4,
ExtMP4: VideoMP4, // .mp4
".m4v": VideoM4V,
".mxf": VideoMXF,
".3gp": Video3GP,
".3g2": Video3G2,
".flv": VideoFlash,

View file

@ -28,4 +28,7 @@ func TestFileExtensions_Known(t *testing.T) {
t.Run("mp", func(t *testing.T) {
assert.True(t, Extensions.Known("file.mp"))
})
t.Run("mxf", func(t *testing.T) {
assert.True(t, Extensions.Known("file.mxf"))
})
}

View file

@ -29,6 +29,7 @@ var TypeInfo = TypeMap{
VideoMOV: "Apple QuickTime",
VideoMP4: "Multimedia Container (MPEG-4 Part 14)",
VideoM4V: "Apple iTunes Multimedia Container",
VideoMXF: "Material Exchange Format",
VideoAVI: "Microsoft Audio Video Interleave",
VideoASF: "Advanced Systems Format ",
VideoWMV: "Windows Media",

View file

@ -39,6 +39,7 @@ const (
VideoMP2 Type = "mp2" // MPEG-2, H.222/H.262
VideoMP4 Type = "mp4" // MPEG-4 Container based on QuickTime, can contain AVC, HEVC,...
VideoM4V Type = "m4v" // Apple iTunes MPEG-4 Container, optionally with DRM copy protection
VideoMXF Type = "mxf" // Material Exchange Format
VideoAVI Type = "avi" // Microsoft Audio Video Interleave (AVI)
Video3GP Type = "3gp" // Mobile Multimedia Container, MPEG-4 Part 12
Video3G2 Type = "3g2" // Similar to 3GP, consumes less space & bandwidth

View file

@ -32,6 +32,7 @@ var Formats = map[fs.Type]Type{
fs.VideoM4V: Video,
fs.VideoMKV: Video,
fs.VideoMOV: Video,
fs.VideoMXF: Video,
fs.Video3GP: Video,
fs.Video3G2: Video,
fs.VideoFlash: Video,