@ossy/observability 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/observability",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Structured logger with pluggable backends for the Ossy platform",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"src",
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "51e33c2eaff6973c34f00024a082c6912252ec72"
|
|
32
32
|
}
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export const id = 'logger-grafana-loki'
|
|
15
|
+
// Only the push URL is required; user/key are optional (not needed for local Loki).
|
|
15
16
|
export const credentials = [
|
|
16
17
|
'GRAFANA_LOKI_URL',
|
|
17
|
-
'GRAFANA_LOKI_USER',
|
|
18
|
-
'GRAFANA_LOKI_API_KEY',
|
|
19
18
|
]
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -26,7 +25,9 @@ export async function connect ({ env }) {
|
|
|
26
25
|
const url = env.GRAFANA_LOKI_URL
|
|
27
26
|
const user = env.GRAFANA_LOKI_USER
|
|
28
27
|
const key = env.GRAFANA_LOKI_API_KEY
|
|
29
|
-
const
|
|
28
|
+
const authHeader = (user && key)
|
|
29
|
+
? { Authorization: 'Basic ' + Buffer.from(`${user}:${key}`).toString('base64') }
|
|
30
|
+
: {}
|
|
30
31
|
|
|
31
32
|
function push (level, ns, msg, ctx, err) {
|
|
32
33
|
const entry = {
|
|
@@ -53,7 +54,7 @@ export async function connect ({ env }) {
|
|
|
53
54
|
method: 'POST',
|
|
54
55
|
headers: {
|
|
55
56
|
'Content-Type': 'application/json',
|
|
56
|
-
|
|
57
|
+
...authHeader,
|
|
57
58
|
},
|
|
58
59
|
body,
|
|
59
60
|
}).catch(() => {})
|
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
export const id = 'metrics-grafana'
|
|
19
|
+
// Only the push URL is required; user/key are optional (not needed for local Pushgateway).
|
|
19
20
|
export const credentials = [
|
|
20
21
|
'GRAFANA_METRICS_URL',
|
|
21
|
-
'GRAFANA_METRICS_USER',
|
|
22
|
-
'GRAFANA_METRICS_API_KEY',
|
|
23
22
|
]
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -90,7 +89,9 @@ export async function connect ({ env }) {
|
|
|
90
89
|
const url = env.GRAFANA_METRICS_URL
|
|
91
90
|
const user = env.GRAFANA_METRICS_USER
|
|
92
91
|
const key = env.GRAFANA_METRICS_API_KEY
|
|
93
|
-
const
|
|
92
|
+
const authHeader = (user && key)
|
|
93
|
+
? { Authorization: 'Basic ' + Buffer.from(`${user}:${key}`).toString('base64') }
|
|
94
|
+
: {}
|
|
94
95
|
|
|
95
96
|
// In-memory accumulators — all values are cumulative (Prometheus semantics).
|
|
96
97
|
/** @type {Map<string, { name: string, labels: Record<string,string>|undefined, value: number }>} */
|
|
@@ -171,7 +172,7 @@ export async function connect ({ env }) {
|
|
|
171
172
|
method: 'POST',
|
|
172
173
|
headers: {
|
|
173
174
|
'Content-Type': 'text/plain',
|
|
174
|
-
|
|
175
|
+
...authHeader,
|
|
175
176
|
},
|
|
176
177
|
body,
|
|
177
178
|
})
|