mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-30 11:55:49 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 198eebaf4d | |||
| 6f579b6854 | |||
| d600525bb2 | |||
| 6dac6f7928 | |||
| 318af2e1ff | |||
| a44e419d5a | |||
| 2509a28813 | |||
| a12ee2e5d7 | |||
| 703aa2360b | |||
| cb58ff32a4 | |||
| f6979333d4 | |||
| e897255e71 | |||
| daf2a85539 | |||
| 1a59ec20e3 | |||
| 3e31e59bcd | |||
| 982d4905c0 | |||
| 7ecce0901c | |||
| c70fb20b9e | |||
| cde2fe24c4 | |||
| e8951b7aa1 | |||
| d2973ecdca | |||
| cf7a6b6efc | |||
| 7c29a18d61 | |||
| 16ca5a72a6 | |||
| db8ee16e03 | |||
| 521f6006fe | |||
| 19fa9a24ab |
@@ -173,8 +173,31 @@ id: 'aidx'
|
||||
|
||||
#sentryForBackend:
|
||||
# enableNodeProfiling: true
|
||||
# # Specify Sentry integration names to disable individual auto-instrumentation.
|
||||
# # The names are integration .name values, not factory function names.
|
||||
# # To check enabled names, set `options.debug: true` and see
|
||||
# # "Integration installed: <name>" in the Sentry logs.
|
||||
# #
|
||||
# # As of 2026-07-07 / @sentry/node 10.62.0, useful names for Misskey include:
|
||||
# # Postgres ... DB queries (when pg is externalized)
|
||||
# # Redis ... ioredis commands
|
||||
# # Fastify ... inbound HTTP routes
|
||||
# # Http ... inbound/outbound HTTP; disabling this can also affect request isolation
|
||||
# # NodeFetch ... fetch/undici requests
|
||||
# disabledIntegrations: ['Postgres']
|
||||
# options:
|
||||
# dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0'
|
||||
# # By default, Misskey prevents Sentry trace headers (`sentry-trace` and
|
||||
# # `baggage`) from being sent to remote ActivityPub/Webhook/etc. hosts.
|
||||
# # To intentionally propagate distributed traces to trusted internal services,
|
||||
# # list only those internal URL patterns here.
|
||||
# # Avoid broad patterns that match remote servers unless you intentionally
|
||||
# # want to restore Sentry's legacy behavior of propagating traces to all
|
||||
# # outbound HTTP requests.
|
||||
# #tracePropagationTargets: []
|
||||
# # Internal allowlist example:
|
||||
# #tracePropagationTargets:
|
||||
# # - 'internal-service.example'
|
||||
|
||||
#sentryForFrontend:
|
||||
# vueIntegration:
|
||||
|
||||
@@ -329,63 +329,6 @@ id: 'aidx'
|
||||
# #tracePropagationTargets:
|
||||
# # - 'internal-service.example'
|
||||
|
||||
# ┌─────────┐
|
||||
#───┘ Tracing └────────────────────────────────────────────────
|
||||
# OpenTelemetry distributed tracing (Traces only, opt-in).
|
||||
# Existing API and Queue spans are exported to an OTLP http/protobuf endpoint.
|
||||
#
|
||||
# Standard OTEL_* environment variables are honored for values omitted below:
|
||||
# OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT,
|
||||
# OTEL_EXPORTER_OTLP_HEADERS, OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG, etc.
|
||||
#
|
||||
# When this is enabled together with sentryForBackend, Misskey shares Sentry's
|
||||
# TracerProvider and adds an OTLP SpanProcessor to it. In that mode:
|
||||
# - sampleRate below is ignored; sampling follows sentryForBackend.options
|
||||
# tracesSampleRate / tracesSampler.
|
||||
# - resourceAttributes below is ignored; set OTEL_SERVICE_NAME and
|
||||
# OTEL_RESOURCE_ATTRIBUTES in the environment if you need to override them.
|
||||
# - spans produced by Sentry integrations are exported to both Sentry and OTLP.
|
||||
# - sentry-trace / baggage propagation to outbound remote requests is disabled
|
||||
# by default while OTel is enabled. Set propagateTraceToRemote: true only if
|
||||
# you intentionally want Sentry trace propagation for your deployment.
|
||||
|
||||
#otelForBackend:
|
||||
# endpoint: 'http://localhost:4318/v1/traces'
|
||||
# #headers:
|
||||
# # authorization: 'Bearer xxxxx'
|
||||
# #sampleRate: 1.0
|
||||
# # Record PostgreSQL query spans. Disabled by default to avoid instrumentation
|
||||
# # overhead when database-level diagnostics are not needed.
|
||||
# #capturePgSpans: false
|
||||
# # Include raw SQL text in PostgreSQL spans. Requires capturePgSpans and is
|
||||
# # disabled by default because non-parameterized queries can expose values to
|
||||
# # the OTLP Collector.
|
||||
# #capturePgStatement: false
|
||||
# # Include PostgreSQL connection-pool spans with an existing parent span.
|
||||
# # Requires capturePgSpans and is disabled by default to avoid noisy spans
|
||||
# # from connection churn.
|
||||
# #capturePgConnectionSpans: false
|
||||
# # Record Redis command spans. Disabled by default because subscribing to the
|
||||
# # ioredis diagnostics channel adds work to every Redis command, including
|
||||
# # commands without a parent span. Enable for development diagnostics or when
|
||||
# # the added overhead is acceptable in production.
|
||||
# #captureRedisCommandSpans: false
|
||||
# # Include Redis startup/reconnect spans. Disabled by default to avoid noisy
|
||||
# # connection churn; these spans are recorded even without an HTTP or job
|
||||
# # parent span.
|
||||
# #captureRedisConnectionSpans: false
|
||||
# # Record Redis commands without an HTTP or job parent span. Disabled by
|
||||
# # default because queue polling and background work can produce many root
|
||||
# # traces; only applies when captureRedisCommandSpans is enabled.
|
||||
# #captureRedisRootSpans: false
|
||||
# #resourceAttributes:
|
||||
# # deployment.environment: 'production'
|
||||
# #propagateTraceToRemote: false
|
||||
# # Queue worker spans are independent traces linked to their enqueuer by default.
|
||||
# # Set to 'parent' to make them child spans instead. This can create very large
|
||||
# # traces for high-fan-out queues such as federation delivery.
|
||||
# #jobTraceContextMode: 'link'
|
||||
|
||||
#sentryForFrontend:
|
||||
# vueIntegration:
|
||||
# tracingOptions:
|
||||
|
||||
@@ -16,13 +16,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -17,12 +17,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -35,13 +35,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
ref: ${{ github.base_ref }}
|
||||
path: base
|
||||
submodules: true
|
||||
- name: Checkout head
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.number }}/merge
|
||||
path: head
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
with:
|
||||
package_json_file: head/package.json
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: 'head/.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -12,13 +12,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout head
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v6
|
||||
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: pnpm
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
name: Check Misskey JS autogen (comment)
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
types: [completed]
|
||||
workflows:
|
||||
- Check Misskey JS autogen # check-misskey-js-autogen.yml
|
||||
|
||||
jobs:
|
||||
comment-misskey-js-autogen:
|
||||
runs-on: ubuntu-latest
|
||||
# No code is cloned or executed here, so it is safe to hold pull-requests: write
|
||||
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
# The result is missing when the run failed before the check job (e.g. the PR does not build), so do not fail here
|
||||
- name: Download result
|
||||
id: download-result
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: misskey-js-autogen-result
|
||||
path: result
|
||||
github-token: ${{ github.token }}
|
||||
repository: ${{ github.repository }}
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
|
||||
# The artifact comes from a run that built fork code, so validate it before using
|
||||
- name: Load result
|
||||
id: load-result
|
||||
if: steps.download-result.outcome == 'success'
|
||||
run: |
|
||||
pr_number="$(cat result/pr-number)"
|
||||
changes="$(cat result/changes)"
|
||||
|
||||
case "$pr_number" in
|
||||
''|*[!0-9]*) echo "invalid pr number"; exit 1;;
|
||||
esac
|
||||
case "$changes" in
|
||||
true|false) ;;
|
||||
*) echo "invalid result"; exit 1;;
|
||||
esac
|
||||
|
||||
echo "pr-number=$pr_number" >> "$GITHUB_OUTPUT"
|
||||
echo "changes=$changes" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: send message
|
||||
if: steps.load-result.outputs.changes == 'true'
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
with:
|
||||
pr-number: ${{ steps.load-result.outputs.pr-number }}
|
||||
comment-tag: check-misskey-js-autogen
|
||||
message: |-
|
||||
Thank you for sending us a great Pull Request! 👍
|
||||
Please regenerate misskey-js type definitions! 🙏
|
||||
|
||||
example:
|
||||
```sh
|
||||
pnpm run build-misskey-js-with-types
|
||||
```
|
||||
|
||||
- name: send message
|
||||
if: steps.load-result.outputs.changes == 'false'
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
with:
|
||||
pr-number: ${{ steps.load-result.outputs.pr-number }}
|
||||
comment-tag: check-misskey-js-autogen
|
||||
mode: delete
|
||||
message: "Thank you!"
|
||||
create_if_not_exists: false
|
||||
@@ -1,7 +1,8 @@
|
||||
# this name is used in check-misskey-js-autogen.comment.yml so be careful when change name
|
||||
name: Check Misskey JS autogen
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
@@ -10,7 +11,6 @@ on:
|
||||
- packages/backend/**
|
||||
|
||||
jobs:
|
||||
# pull_request_target safety: permissions: read-all, and there are no secrets used in this job
|
||||
generate-misskey-js:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
persist-credentials: false
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
- name: setup node
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: pnpm
|
||||
@@ -58,7 +58,6 @@ jobs:
|
||||
name: generated-misskey-js
|
||||
path: packages/misskey-js/generator/built/autogen
|
||||
|
||||
# pull_request_target safety: permissions: read-all, and no user codes are executed
|
||||
get-actual-misskey-js:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@@ -66,7 +65,7 @@ jobs:
|
||||
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
persist-credentials: false
|
||||
@@ -78,12 +77,11 @@ jobs:
|
||||
name: actual-misskey-js
|
||||
path: packages/misskey-js/src/autogen
|
||||
|
||||
# pull_request_target safety: nothing is cloned from repository
|
||||
comment-misskey-js-autogen:
|
||||
check-misskey-js-autogen:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [generate-misskey-js, get-actual-misskey-js]
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: download generated-misskey-js
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -111,28 +109,21 @@ jobs:
|
||||
- name: Print full diff
|
||||
run: cat ./misskey-js.diff
|
||||
|
||||
- name: send message
|
||||
if: steps.check-changes.outputs.changes == 'true'
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
with:
|
||||
comment-tag: check-misskey-js-autogen
|
||||
message: |-
|
||||
Thank you for sending us a great Pull Request! 👍
|
||||
Please regenerate misskey-js type definitions! 🙏
|
||||
# A fork's pull_request token cannot comment, so hand the result to check-misskey-js-autogen.comment.yml
|
||||
- name: Save result
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
CHANGES: ${{ steps.check-changes.outputs.changes }}
|
||||
run: |
|
||||
mkdir -p result
|
||||
echo "$PR_NUMBER" > result/pr-number
|
||||
echo "$CHANGES" > result/changes
|
||||
|
||||
example:
|
||||
```sh
|
||||
pnpm run build-misskey-js-with-types
|
||||
```
|
||||
|
||||
- name: send message
|
||||
if: steps.check-changes.outputs.changes == 'false'
|
||||
uses: thollander/actions-comment-pull-request@v3
|
||||
- name: Upload result
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
comment-tag: check-misskey-js-autogen
|
||||
mode: delete
|
||||
message: "Thank you!"
|
||||
create_if_not_exists: false
|
||||
name: misskey-js-autogen-result
|
||||
path: result
|
||||
|
||||
- name: Make failure if changes are detected
|
||||
if: steps.check-changes.outputs.changes == 'true'
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
- name: Check version
|
||||
run: |
|
||||
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/misskey-js/package.json)" ]; then
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
- name: Check
|
||||
run: |
|
||||
counter=0
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
check_copyright_year:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
- run: |
|
||||
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then
|
||||
echo "Please change copyright year!"
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
platform=${{ matrix.platform }}
|
||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Log in to Docker Hub
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
platform=${{ matrix.platform }}
|
||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Docker meta
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
DOCKLE_VERSION: 0.4.15
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
|
||||
- name: Download and install dockle v${{ env.DOCKLE_VERSION }}
|
||||
run: |
|
||||
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout base
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: ${{ github.event.pull_request.base.repo.full_name }}
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
submodules: true
|
||||
|
||||
- name: Checkout head
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
package_json_file: head/package.json
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: head/.node-version
|
||||
cache: pnpm
|
||||
|
||||
@@ -25,14 +25,14 @@ jobs:
|
||||
ref: refs/pull/${{ github.event.number }}/merge
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
ref: ${{ matrix.ref }}
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -11,6 +11,6 @@ jobs:
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v6
|
||||
- uses: actions/labeler@v7
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
@@ -40,13 +40,13 @@ jobs:
|
||||
pnpm_install:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
@@ -73,19 +73,19 @@ jobs:
|
||||
eslint-cache-version: v1
|
||||
eslint-cache-path: ${{ github.workspace }}/node_modules/.cache/eslint-${{ matrix.workspace }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm i --frozen-lockfile
|
||||
- name: Restore eslint cache
|
||||
uses: actions/cache@v5.0.5
|
||||
uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: ${{ env.eslint-cache-path }}
|
||||
key: eslint-${{ env.eslint-cache-version }}-${{ matrix.workspace }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
@@ -104,13 +104,13 @@ jobs:
|
||||
- sw
|
||||
- misskey-js
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
@@ -123,13 +123,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -16,13 +16,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: ".node-version"
|
||||
cache: "pnpm"
|
||||
|
||||
@@ -16,13 +16,13 @@ jobs:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -36,12 +36,12 @@ jobs:
|
||||
- diagnostics-frontend
|
||||
- changelog-checker
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- uses: actions/setup-node@v6.4.0
|
||||
- uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
edit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
# headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得
|
||||
- name: Get PR
|
||||
run: |
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
outputs:
|
||||
pr_number: ${{ steps.get_pr.outputs.pr_number }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
# headが$GITHUB_REF_NAME, baseが$STABLE_BRANCHかつopenのPRを1つ取得
|
||||
- name: Get PRs
|
||||
run: |
|
||||
|
||||
@@ -22,12 +22,12 @@ jobs:
|
||||
NODE_OPTIONS: "--max_old_space_size=7168"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
if: github.event_name != 'pull_request_target'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
if: github.event_name == 'pull_request_target'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
ports:
|
||||
- 56312:6379
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:v1.48.1
|
||||
image: getmeili/meilisearch:v1.49.0
|
||||
ports:
|
||||
- 57712:7700
|
||||
env:
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
MEILI_ENV: development
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt install -y ffmpeg
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: ${{ matrix.node-version-file }}
|
||||
cache: 'pnpm'
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
- name: Test
|
||||
run: pnpm --filter backend test-and-coverage
|
||||
- name: Upload to Codecov
|
||||
uses: codecov/codecov-action@v6
|
||||
uses: codecov/codecov-action@v7
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/backend/coverage/coverage-final.json
|
||||
@@ -103,13 +103,13 @@ jobs:
|
||||
- 56312:6379
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: ${{ matrix.node-version-file }}
|
||||
cache: 'pnpm'
|
||||
@@ -123,7 +123,7 @@ jobs:
|
||||
- name: Test
|
||||
run: pnpm --filter backend test-and-coverage:e2e
|
||||
- name: Upload to Codecov
|
||||
uses: codecov/codecov-action@v6
|
||||
uses: codecov/codecov-action@v7
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/backend/coverage/coverage-final.json
|
||||
@@ -147,7 +147,7 @@ jobs:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
@@ -156,7 +156,7 @@ jobs:
|
||||
id: current-date
|
||||
run: echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: ${{ matrix.node-version-file }}
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- .node-version
|
||||
- .github/min.node-version
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt install -y ffmpeg
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: ${{ matrix.node-version-file }}
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -28,13 +28,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- name: Test
|
||||
run: pnpm --filter frontend test-and-coverage
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@v6
|
||||
uses: codecov/codecov-action@v7
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/frontend/coverage/coverage-final.json
|
||||
@@ -71,13 +71,13 @@ jobs:
|
||||
- 56312:6379
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -22,13 +22,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.3
|
||||
uses: actions/checkout@v7.0.0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
CI: true
|
||||
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@v6
|
||||
uses: codecov/codecov-action@v7
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/misskey-js/coverage/coverage-final.json
|
||||
|
||||
@@ -16,13 +16,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
@@ -17,13 +17,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.0
|
||||
with:
|
||||
submodules: true
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v6.0.9
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6.4.0
|
||||
uses: actions/setup-node@v7.0.0
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
+10
-13
@@ -12,16 +12,19 @@
|
||||
- Node.js のセキュリティアップデートに伴い、最低動作バージョンを 22.22.2 / 24.17.0 / 26.4.0 に引き上げました。
|
||||
- Docker Image は Node.js 26.4.0-trixie に更新されています。
|
||||
- バックエンドで画像処理に用いているライブラリ sharp のシステム要件の変更により、**SSE4.2 命令セットをサポートしていない x86_64 CPU では Misskey が正しく動作しなくなります**。仮想マシンに Misskey をデプロイしている場合や、古いハードウェアをお使いの場合は、アップデート前にお使いの環境をご確認ください。なお、ARM64 など x86_64 ではない環境においてはこの変更による影響はありません。
|
||||
- YAMLパーサーをアップデートし、より厳格なチェックが行われるようになりました。起動時にconfigの読み取りで構文エラーが発生する可能性があります。\
|
||||
例えば `allowPrivateNetworks` を 2026.6.0 までの `example.yml` の構文を元に記述している場合は、配列の閉じ括弧のインデントを上げるか、リスト表示に書き換える必要があります。詳しくは https://github.com/misskey-dev/misskey/pull/17701 をご覧ください。
|
||||
|
||||
### General
|
||||
- Feat: コントロールパネルから二要素認証を解除できるように
|
||||
- Feat: 条件に一致したURLプレビューのサムネイルを隠すことができるように
|
||||
(Based on https://github.com/MisskeyIO/misskey/pull/214)
|
||||
- Enhance: 依存関係の更新
|
||||
|
||||
### Client
|
||||
- 2025.4.0 以前の設定情報の移行処理が削除されました
|
||||
- 2025.4.0 から直接 2026.6.0 以上にアップデートする場合は設定が移行されませんので注意してください。移行したい場合は一度 2026.5.1 を経由してください。
|
||||
- Enhance: 画像ビューワーを独自実装に変更・動画プレイヤーを統合
|
||||
- Enhance: 画像ビューワーを刷新・動画プレイヤーを統合
|
||||
- 操作性の改善
|
||||
- ビューワーとMisskeyの各種機能との統合を強化
|
||||
- パフォーマンスの向上
|
||||
@@ -29,8 +32,9 @@
|
||||
- Fix: 幅が狭い画面で動画の再生が困難な問題を修正
|
||||
- Fix: 一部の画像のみセンシティブなとき、ビューワー内で画像を切り替えるとセンシティブな画像がそのまま表示される問題を修正
|
||||
- Fix: 一部の画像をビューワーで読み込んだ際に正しく表示されない問題を修正
|
||||
- Enhance: タイムラインの読み込みパフォーマンスを改善
|
||||
- Enhance: ファイルアップロード前にプレビューできるように
|
||||
- Enhance: タブがバックグラウンドの間は必要ない定期更新処理を停止するように
|
||||
- Enhance: 翻訳の更新
|
||||
- Fix: 「画像を新しいタブで開く」が機能しなくなっていた問題を修正
|
||||
- Fix: デバイスタイプをスマートフォンに固定している状態で画面幅が広いとき、画面左上のアイコンが表示されない問題を修正
|
||||
- Fix: チャットでIMEの変換を確定するEnterでメッセージが送信されてしまうことがある問題を修正
|
||||
@@ -44,21 +48,12 @@
|
||||
- Fix: ノートの詳細表示で削除された引用元が表示されない問題を修正
|
||||
|
||||
### Server
|
||||
- Feat: OpenTelemetryサポート
|
||||
- 詳細な設定はconfigファイルを参照してください。
|
||||
- Sentryとの併用も可能です。Sentry併用時は、PostgreSQL Query と Redis command は Sentry で計装されます。
|
||||
- 以下の自動計装をサポートしています。(計装対象にする項目は設定可能)
|
||||
- PostgreSQL query
|
||||
- Redis command
|
||||
- 全ての受信HTTPリクエスト
|
||||
- 全ての送信HTTPリクエスト
|
||||
- ジョブキュー(エンキュー元のトレースを含む)
|
||||
- Feat: ログ基盤の刷新
|
||||
- API内部エラーのログに構造化属性と正規化したエラー情報を付与し、認証情報を自動的に秘匿するように(従来形式の表示は維持)
|
||||
- ログ全体の既定出力レベルとドメインごとの出力レベルを設定できるように
|
||||
- バックエンドのログを1行JSON形式で出力できるように
|
||||
- OpenTelemetryのTrace ContextをJSON形式のログへ関連付けられるように
|
||||
- HTTPのAccess logをstatus class単位で出力できるように(開発時のリクエスト・レスポンス本文、OpenTelemetryのTrace Contextにも対応)
|
||||
- SentryのTrace ContextをJSON形式のログへ関連付けられるように
|
||||
- HTTPのAccess logをstatus class単位で出力できるように(開発時のリクエスト・レスポンス本文、SentryのTrace Contextにも対応)
|
||||
- Enhance: Sentry バックエンドの自動計装を `sentryForBackend.disabledIntegrations` で個別に無効化できるように
|
||||
- Enhance: センシティブメディアの判定を外部サービス ([sensitive-detector](https://github.com/misskey-dev/sensitive-detector)) に分離し、`nsfwjs` / `@tensorflow/tfjs(-node)` の同梱と NSFW 判定モデルを廃止 (#16804)
|
||||
- Enhance: Node.js 22.22.2以降、24.17.0以降、26.4.0以降をサポートするように
|
||||
@@ -71,6 +66,8 @@
|
||||
- Fix: フォロワー限定投稿へのリプライをホーム投稿に出来る問題を修正
|
||||
- Fix: ファイルをアップロードするAPIにて、処理終了後に一時ファイルが削除されないことがある問題を修正
|
||||
- Fix: 初期設定で作成したアカウント以外でアカウント作成APIが使用できない問題を修正
|
||||
- Fix: フォロー中のチャンネルを再度フォローした際にALREADY_FOLLOWINGエラーを返すように
|
||||
- Fix: セキュリティに関する修正
|
||||
|
||||
## 2026.6.0
|
||||
|
||||
|
||||
@@ -619,6 +619,8 @@ output: "Sortida"
|
||||
script: "Script"
|
||||
disablePagesScript: "Desactivar AiScript a les pàgines "
|
||||
updateRemoteUser: "Actualitzar la informació de l'usuari remot"
|
||||
unsetMfa: "Desactiva l'autenticació de dos factors"
|
||||
unsetMfaConfirm: "Voldries desactivar l'autenticació de dos factors?"
|
||||
unsetUserAvatar: "Desactiva l'avatar "
|
||||
unsetUserAvatarConfirm: "Segur que vols desactivar l'avatar?"
|
||||
unsetUserBanner: "Desactiva el bàner "
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "Afegeix al calaix d'emojis"
|
||||
emojiPaletteAlreadyAddedConfirm: "Aquest emoji ja està inclòs en aquest calaix d'emojis. Vols afegir-lo de nou?"
|
||||
append: "Afegeix al final"
|
||||
prepend: "Afegeix al principi"
|
||||
urlPreviewSensitiveList: "Llista d'URLs per restringir la visualització de miniatures"
|
||||
urlPreviewSensitiveListDescription: "Si separeu els termes amb un espai, s'interpretarà com una condició 'AND'; si els separeu amb un salt de línia, s'interpretarà com una condició 'OR'. Si envolupeu els termes amb barres obliqües, s'interpretarà com una expressió regular. Si es troba una coincidència, la miniatura ja no es mostrarà."
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "Títol de l'arxiu"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "Els resultats de la detecció interna seran desats, inclòs si aquesta opció es troba desactivada."
|
||||
analyzeVideos: "Activar anàlisis de vídeos "
|
||||
analyzeVideosDescription: "Analitzar els vídeos a més de les imatges. Això incrementarà lleugerament la càrrega del servidor."
|
||||
externalServiceInfo: "La detecció de mitjans sensibles s'ha delegat a un servei extern (sensitive-detector). Per utilitzar aquesta funció, cal configurar un servei sidecar separat i establir els detalls de connexió que es detallen a continuació. Si no es configuren els detalls de connexió, no es durà a terme cap detecció (el contingut es tractarà com a no sensible)."
|
||||
apiUrl: "URL per connectar-se al servei de verificació"
|
||||
apiUrlDescription: "L'URL base del servei de detector de sensibilitat (per exemple, http://localhost:3009). Si us connecteu a un servei en una xarxa privada, afegiu la xarxa de destinació a la configuració `allowedPrivateNetworks` del fitxer de configuració. Si utilitzeu un proxy, configureu també `proxyBypassHosts`. Si es deixa en blanc, no es realitzaran comprovacions de sensibilitat."
|
||||
apiKey: "Clau de l'API"
|
||||
apiKeyDescription: "Introduïu això si l'autenticació (token Bearer) està configurada al costat del servei d'autenticació. Si no està configurada, deixeu aquest camp en blanc."
|
||||
timeout: "Temps d'espera (mil·lisegons)"
|
||||
timeoutDescription: "1 Aquesta és la durada del temps mort per sol·licitud de validació."
|
||||
maxImagesPerRequest: "1 Nombre màxim d'imatges per sol·licitud"
|
||||
maxImagesPerRequestDescription: "1 Quan s'analitzen múltiples fotogrames, com en un vídeo, aquest és el nombre màxim d'imatges que es poden enviar en una única petició. Qualsevol imatge que superi aquest límit es dividirà en parts i s'enviarà seqüencialment. Assegureu-vos que aquest ajust no superi el valor de `maxParts` al costat del `sensitive-detector` (per defecte: 10). Si es supera aquest límit, totes les imatges d'aquest lot es consideraran no sensibles."
|
||||
_emailUnavailable:
|
||||
used: "Aquest correu electrònic ja s'està fent servir"
|
||||
format: "El format del correu electrònic és invàlid "
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "Veure registre de moderació "
|
||||
"read:admin:show-user": "Veure informació privada de l'usuari "
|
||||
"write:admin:suspend-user": "Suspendre usuari"
|
||||
"write:admin:unset-mfa": "Desactiva l'autenticació de dos factors per a un usuari"
|
||||
"write:admin:unset-user-avatar": "Esborrar avatar d'usuari "
|
||||
"write:admin:unset-user-banner": "Esborrar bàner de l'usuari "
|
||||
"write:admin:unsuspend-user": "Treure la suspensió d'un usuari"
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "Decoració de l'avatar creada"
|
||||
updateAvatarDecoration: "S'ha actualitzat la decoració de l'avatar "
|
||||
deleteAvatarDecoration: "S'ha esborrat la decoració de l'avatar "
|
||||
unsetMfa: "Desactiva l'autenticació de dos factors per a l'usuari"
|
||||
unsetUserAvatar: "Esborrar l'avatar d'aquest usuari"
|
||||
unsetUserBanner: "Esborrar el bàner d'aquest usuari"
|
||||
createSystemWebhook: "Crear un SystemWebhook"
|
||||
|
||||
@@ -619,6 +619,8 @@ output: "Output"
|
||||
script: "Script"
|
||||
disablePagesScript: "Disable AiScript on Pages"
|
||||
updateRemoteUser: "Update remote user information"
|
||||
unsetMfa: "Reset two-factor authentication"
|
||||
unsetMfaConfirm: "Are you sure you want to reset two-factor authentication?"
|
||||
unsetUserAvatar: "Unset avatar"
|
||||
unsetUserAvatarConfirm: "Are you sure you want to unset the avatar?"
|
||||
unsetUserBanner: "Unset banner"
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "Add to emoji palette"
|
||||
emojiPaletteAlreadyAddedConfirm: "This emoji is already included in this emoji palette. Do you want to add it again?"
|
||||
append: "Append to end"
|
||||
prepend: "Append to beginning"
|
||||
urlPreviewSensitiveList: "URL to restrict thumbnail display"
|
||||
urlPreviewSensitiveListDescription: "Use spaces to specify AND conditions, and line breaks to specify OR conditions. Enclose text in slashes to use regular expressions. If a match is found, the thumbnail will be hidden."
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "File caption"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "The results of the internal detection will be retained even if this option is turned off."
|
||||
analyzeVideos: "Enable analysis of videos"
|
||||
analyzeVideosDescription: "Analyzes videos in addition to images. This will slightly increase the load on the server."
|
||||
externalServiceInfo: "The detection of sensitive media has been offloaded to an external service (sensitive-detector). To use this feature, you must set up a separate service and configure the connection details provided below. If no connection details are configured, no detection will be performed (it will be treated as non-sensitive)."
|
||||
apiUrl: "Detection service endpoint URL"
|
||||
apiUrlDescription: "The base URL for the sensitive-detector service (e.g., http://localhost:3009). If you are connecting to a service on a private network, please allow the target network in the allowedPrivateNetworks setting in the configuration file. If you are using a proxy, please also configure proxyBypassHosts. If left blank, sensitive media detection will not be performed."
|
||||
apiKey: "API key"
|
||||
apiKeyDescription: "Enter this if authentication (Bearer token) is configured on the detector service. If it is not configured, please leave it blank."
|
||||
timeout: "Timeout (Milliseconds)"
|
||||
timeoutDescription: "Timeout duration for each judgment request."
|
||||
maxImagesPerRequest: "Max images per request"
|
||||
maxImagesPerRequestDescription: "Maximum number of images that can be sent in a single request when processing multi-frame at once, such as videos. Any images exceeding this limit will be split and sent sequentially. Please ensure this is set to not exceed the maxParts setting (default: 10) on the detector service. If it exceeds this limit, all items in that chunk will be treated as non-sensitive."
|
||||
_emailUnavailable:
|
||||
used: "This email address is already being used"
|
||||
format: "The format of this email address is invalid"
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "View moderation log"
|
||||
"read:admin:show-user": "View private user info"
|
||||
"write:admin:suspend-user": "Suspend user"
|
||||
"write:admin:unset-mfa": "Reset two-factor authentication for the user"
|
||||
"write:admin:unset-user-avatar": "Remove user avatar"
|
||||
"write:admin:unset-user-banner": "Remove user banner"
|
||||
"write:admin:unsuspend-user": "Unsuspend user"
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "Avatar decoration created"
|
||||
updateAvatarDecoration: "Avatar decoration updated"
|
||||
deleteAvatarDecoration: "Avatar decoration deleted"
|
||||
unsetMfa: "Reset two-factor authentication for the user"
|
||||
unsetUserAvatar: "User avatar unset"
|
||||
unsetUserBanner: "User banner unset"
|
||||
createSystemWebhook: "System Webhook created"
|
||||
|
||||
@@ -619,6 +619,8 @@ output: "Salida"
|
||||
script: "Script"
|
||||
disablePagesScript: "Deshabilitar AiScript en Páginas"
|
||||
updateRemoteUser: "Actualizar información de usuario remoto"
|
||||
unsetMfa: "Desactivar la autenticación de dos factores"
|
||||
unsetMfaConfirm: "¿Desea desactivar la autenticación de dos factores?"
|
||||
unsetUserAvatar: "Quitar avatar"
|
||||
unsetUserAvatarConfirm: "¿Confirmas que quieres quitar tu avatar?"
|
||||
unsetUserBanner: "Quitar banner"
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "Añadir a la paleta de emojis"
|
||||
emojiPaletteAlreadyAddedConfirm: "Este emoji ya está incluido en esta paleta de emojis. ¿Quieres volver a añadirlo?"
|
||||
append: "Añadir al final"
|
||||
prepend: "Añadir al principio"
|
||||
urlPreviewSensitiveList: "URL para restringir la visualización de miniaturas"
|
||||
urlPreviewSensitiveListDescription: "Si se separan con un espacio, se interpretará como una condición «AND»; si se separan con un salto de línea, se interpretará como una condición «OR». Si se escriben entre barras, se interpretarán como expresiones regulares. Si se encuentra una coincidencia, no se mostrará la miniatura."
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "Título del archivo"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "Los resultados de la detección interna pueden ser retenidos incluso si la opción está desactivada."
|
||||
analyzeVideos: "Habilitar el análisis de videos"
|
||||
analyzeVideosDescription: "Analizar videos en adición a las imágenes. Esto puede incrementar ligeramente la carga del servidor."
|
||||
externalServiceInfo: "La detección de contenidos sensibles se ha externalizado a un servicio externo (sensitive-detector). Para utilizar esta función, es necesario configurar por separado un servicio «sidecar» y establecer los datos de conexión que se indican a continuación. Si no se configuran los datos de conexión, no se realizará la detección (se tratará como contenido no sensible)."
|
||||
apiUrl: "URL de conexión al servicio de verificación"
|
||||
apiUrlDescription: "URL base del servicio «sensitive-detector» (por ejemplo: http://localhost:3009). Si te conectas a un servicio situado en una red privada, debes permitir la red de destino en el parámetro «allowedPrivateNetworks» del archivo de configuración. Si utilizas un proxy, configura también el parámetro «proxyBypassHosts». Si se deja en blanco, no se realizará la evaluación de datos sensibles."
|
||||
apiKey: "Clave API"
|
||||
apiKeyDescription: "Introduce este dato si se ha configurado la autenticación (token Bearer) en el servicio de validación. Si no se ha configurado, déjalo en blanco."
|
||||
timeout: "Tiempo de espera (milisegundos)"
|
||||
timeoutDescription: "Duración del tiempo de espera para cada solicitud de resolución."
|
||||
maxImagesPerRequest: "Número máximo de imágenes por solicitud"
|
||||
maxImagesPerRequestDescription: "Es el número máximo de imágenes que se pueden enviar en una sola solicitud al analizar varios fotogramas, como en un vídeo. Las imágenes que superen este límite se dividirán y se enviarán de forma secuencial. Configúralo de manera que no se supere el valor de «maxParts» de sensitive-detector (por defecto: 10). Si se supera este límite, todas las imágenes de ese fragmento se considerarán no sensibles."
|
||||
_emailUnavailable:
|
||||
used: "Ya fue usado"
|
||||
format: "Formato no válido."
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "Ver log de moderación"
|
||||
"read:admin:show-user": "Ver información privada de usuario"
|
||||
"write:admin:suspend-user": "Suspender cuentas de usuario"
|
||||
"write:admin:unset-mfa": "Desactivar la autenticación de dos factores del usuario"
|
||||
"write:admin:unset-user-avatar": "Quitar avatares de usuario"
|
||||
"write:admin:unset-user-banner": "Quitar banner de usuarios"
|
||||
"write:admin:unsuspend-user": "Quitar suspensión de cuentas de usuario"
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "Decoración de avatar creada"
|
||||
updateAvatarDecoration: "Decoración de avatar actualizada"
|
||||
deleteAvatarDecoration: "Decoración de avatar eliminada"
|
||||
unsetMfa: "Desactivar la autenticación de dos factores del usuario"
|
||||
unsetUserAvatar: "Quitar decoración de avatar de este usuario"
|
||||
unsetUserBanner: "Quitar banner de este usuario"
|
||||
createSystemWebhook: "Crear un SystemWebhook"
|
||||
|
||||
@@ -619,6 +619,8 @@ output: "Output"
|
||||
script: "Script"
|
||||
disablePagesScript: "Disabilitare AiScript nelle pagine"
|
||||
updateRemoteUser: "Aggiorna dati dal profilo remoto"
|
||||
unsetMfa: "Rimuovere l'autenticazione a due fattori (2FA/MFA)"
|
||||
unsetMfaConfirm: "Vuoi davvero rimuovere l'autenticazione a due fattori?"
|
||||
unsetUserAvatar: "Rimozione foto profilo"
|
||||
unsetUserAvatarConfirm: "Vuoi davvero rimuovere la foto profilo?"
|
||||
unsetUserBanner: "Rimuovi intestazione profilo"
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "Aggiungi alla tavolozza emoji"
|
||||
emojiPaletteAlreadyAddedConfirm: "Questa emoji è già inclusa in nella tavolozza. Vuoi davvero aggiungerla?"
|
||||
append: "Accodare"
|
||||
prepend: "Anteporre"
|
||||
urlPreviewSensitiveList: "URL da impedire alla vista delle anteprime"
|
||||
urlPreviewSensitiveListDescription: "Separando con uno spazio si indica E, separando con una linea si indica O. Circondando con barre / si indica una Espressione Regolare.\nLe URL che coincidono con le indicazioni non verranno visualizzate."
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "Didascalia dell'immagine"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "Anche se questa impostazione è disattivata, il risultato della decisione viene conservato internamente."
|
||||
analyzeVideos: "Abilitazione dell'analisi video."
|
||||
analyzeVideosDescription: "Assicuratevi che vengano analizzati anche i video oltre alle immagini fisse. Il carico del server aumenterà leggermente."
|
||||
externalServiceInfo: "Abbiamo spostato esternamente il riconoscimento di media espliciti (sensitive-detector). Per usufruirne devi impostare un servizio separato e indicare di seguito la destinazione. Se non è impostata, non viene emesso alcun giudizio (contenuto NON esplicito)."
|
||||
apiUrl: "URL di connessione a Sensitive-Detector"
|
||||
apiUrlDescription: "L'URL di base del servizio (ad esempio http://localhost:3009). Collegandosi a una rete privata, autorizzare la rete nel parametro allowedPrivateNetworks nel file di configurazione.\nCollegandosi con un proxy, è anche necessario impostare proxyBypassHosts. Nel caso il campo sia vuoto, non vengono emessi giudizi di sensibilità."
|
||||
apiKey: "Chiave API"
|
||||
apiKeyDescription: "Indicare il token di autenticazione (Bearer token), soltanto se occorre, altrimenti lasciare vuoto."
|
||||
timeout: "Timeout (ms)"
|
||||
timeoutDescription: "Tempo limite per ogni richiesta"
|
||||
maxImagesPerRequest: "Numero massimo di media per ogni richiesta"
|
||||
maxImagesPerRequestDescription: "In caso ci siano più fotogrammi, come nei video, questo è il numero massimo di immagini da inviare in una richiesta. Oltre questo numero, il totale sarà diviso e inviato in sequenza.\nImpostare in modo che non superi il valore maxParts (default: 10) in Sensitive-Detector. Se viene superato, il media sarà considerato non esplicito."
|
||||
_emailUnavailable:
|
||||
used: "Email già in uso"
|
||||
format: "Formato email non valido"
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "Vedere lo storico di moderazione"
|
||||
"read:admin:show-user": "Vedere le informazioni private dei profili"
|
||||
"write:admin:suspend-user": "Sospendere i profili"
|
||||
"write:admin:unset-mfa": "Può rimuovere l'autenticazione a due fattori (2FA/MFA)"
|
||||
"write:admin:unset-user-avatar": "Rimuovere la foto profilo dai profili"
|
||||
"write:admin:unset-user-banner": "Rimuovere l'immagine testata dai profili"
|
||||
"write:admin:unsuspend-user": "Rimuovere la sospensione ai profili"
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "Crea una decorazione della foto profilo"
|
||||
updateAvatarDecoration: "Modifica una decorazione della foto profilo"
|
||||
deleteAvatarDecoration: "Elimina una decorazione della foto profilo"
|
||||
unsetMfa: "Rimossa l'autenticazione a due fattori (2FA7MFA)"
|
||||
unsetUserAvatar: "Toglie una foto profilo"
|
||||
unsetUserBanner: "Toglie una immagine di intestazione profilo"
|
||||
createSystemWebhook: "Aggiunge un System Webhook"
|
||||
|
||||
@@ -619,6 +619,8 @@ output: "출력"
|
||||
script: "스크립트"
|
||||
disablePagesScript: "Pages 에서 AiScript 를 사용하지 않음"
|
||||
updateRemoteUser: "리모트 유저 정보 갱신"
|
||||
unsetMfa: "2단계 인증 해제"
|
||||
unsetMfaConfirm: "2단계 인증을 해제하시겠습니까?"
|
||||
unsetUserAvatar: "아바타 제거"
|
||||
unsetUserAvatarConfirm: "아바타를 제거할까요?"
|
||||
unsetUserBanner: "배너 제거"
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "이모지 팔레트에 추가"
|
||||
emojiPaletteAlreadyAddedConfirm: "이 이모지는 이미 이 이모지 팔레트에 포함돼있습니다. 다시 추가하시겠습니까?"
|
||||
append: "맨뒤에 추가"
|
||||
prepend: "맨앞에 추가"
|
||||
urlPreviewSensitiveList: "썸네일 표시 제한 URL"
|
||||
urlPreviewSensitiveListDescription: "공백으로 구분하면 AND 지정으로 되고, 줄내림으로 구분하면 OR 지정으로 됩니다. 슬래시로 감싸면 정규 표현으로 됩니다. 일치한 경우에 썸네일이 표시되지 않게 됩니다."
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "파일 설명"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "이 설정을 해제해도 탐지 결과는 유지됩니다."
|
||||
analyzeVideos: "동영상도 같이 확인하기"
|
||||
analyzeVideosDescription: "사진 뿐만 아니라 동영상의 NSFW 여부도 탐지합니다. 서버의 부하를 약간 증가시킵니다."
|
||||
externalServiceInfo: "민감한 미디어 판정은 외부 서비스(sensitive-detector)로 분리됐습니다. 이 기능을 이용하려면 별도 사이드카 서비스를 설정하고, 아래의 접속 위치를 설정해야 합니다. 접속 위치가 설정되지 않은 경우에는 판정이 이루어지지 않습니다. (민감하지 않음 처리)"
|
||||
apiUrl: "판정 서비스의 접속 위치 URL"
|
||||
apiUrlDescription: "sensitive-detector 서비스의 베이스 URL(예시: http://localhost:3009). 프라이빗 네트워크상의 서비스에 접속하는 경우에는 설정 파일의 allowedPrivateNetworks로 접속 위치 네트워크를 허가해 주십시오. 프록시를 사용하고 있는 경우에는 proxyBypassHosts도 설정해 주십시오. 비어있으면 민감함 판정은 이루어지지 않습니다."
|
||||
apiKey: "API 키"
|
||||
apiKeyDescription: "판정 서비스 측에서 인증(Bearer 토큰)을 설정하고 있는 경우에 입력합니다. 설정하고 있지 않은 경우에는 빈칸으로 둬주십시오."
|
||||
timeout: "타임아웃 (밀리초)"
|
||||
timeoutDescription: "판정 요청 1회당 타임아웃 시간입니다."
|
||||
maxImagesPerRequest: "한 요청당 최대 이미지 수"
|
||||
maxImagesPerRequestDescription: "동영상 등 여러 프레임을 판정할 때, 한 번의 요청에 모아서 보내는 이미지의 최대 장수입니다. 이를 넘으면 분할해 순차적으로 송신됩니다. sensitive-detector 측의 maxParts 설정(기본: 10)을 남지 않도록 설정해 주십시오. 넘은 경우에는 그 청크는 전부 민감하지 않음 처리로 됩니다."
|
||||
_emailUnavailable:
|
||||
used: "이 메일 주소는 사용중입니다"
|
||||
format: "형식이 올바르지 않습니다"
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "조정 기록 보기"
|
||||
"read:admin:show-user": "유저 개인정보 보기"
|
||||
"write:admin:suspend-user": "유저 정지하기"
|
||||
"write:admin:unset-mfa": "사용자의 2단계 인증 해제"
|
||||
"write:admin:unset-user-avatar": "유저 아바타 삭제하기"
|
||||
"write:admin:unset-user-banner": "유저 배너 삭제하기"
|
||||
"write:admin:unsuspend-user": "유저 정지 해제하기"
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "아바타 장식 만들기"
|
||||
updateAvatarDecoration: "아바타 장식 수정"
|
||||
deleteAvatarDecoration: "아바타 장식 삭제"
|
||||
unsetMfa: "사용자의 2단계 인증 해제"
|
||||
unsetUserAvatar: "유저 아바타 제거"
|
||||
unsetUserBanner: "유저 배너 제거"
|
||||
createSystemWebhook: "SystemWebhook을 생성"
|
||||
|
||||
+20
-5
@@ -57,7 +57,7 @@ deleteAndEditConfirm: "要删除该帖并重新编辑吗?该帖下的所有回
|
||||
addToList: "添加至列表"
|
||||
addToAntenna: "添加到天线"
|
||||
sendMessage: "发送消息"
|
||||
copyRSS: "复制RSS"
|
||||
copyRSS: "复制 RSS"
|
||||
copyUsername: "复制用户名"
|
||||
copyUserId: "复制用户 ID"
|
||||
copyNoteId: "复制帖子 ID"
|
||||
@@ -456,8 +456,8 @@ about: "关于"
|
||||
aboutMisskey: "关于 Misskey"
|
||||
administrator: "管理员"
|
||||
token: "Token (令牌)"
|
||||
2fa: "双因素认证"
|
||||
setupOf2fa: "设置双因素认证"
|
||||
2fa: "双重验证"
|
||||
setupOf2fa: "设置双重验证"
|
||||
totp: "验证器"
|
||||
totpDescription: "使用验证器输入一次性密码"
|
||||
moderator: "监察员"
|
||||
@@ -485,7 +485,7 @@ markAsReadAllNotifications: "将所有通知标为已读"
|
||||
markAsReadAllUnreadNotes: "将所有帖子标记为已读"
|
||||
markAsReadAllTalkMessages: "将所有私信标记为已读"
|
||||
help: "帮助"
|
||||
inputMessageHere: "在此键入信息"
|
||||
inputMessageHere: "在此输入信息"
|
||||
close: "关闭"
|
||||
invites: "邀请"
|
||||
members: "成员"
|
||||
@@ -619,6 +619,8 @@ output: "输出"
|
||||
script: "脚本"
|
||||
disablePagesScript: "禁用页面脚本"
|
||||
updateRemoteUser: "更新远程用户信息"
|
||||
unsetMfa: "解除双重验证"
|
||||
unsetMfaConfirm: "确认解除双重验证吗?"
|
||||
unsetUserAvatar: "清除头像"
|
||||
unsetUserAvatarConfirm: "要清除头像吗?"
|
||||
unsetUserBanner: "清除横幅"
|
||||
@@ -1417,6 +1419,8 @@ addToEmojiPalette: "添加至表情符号选择器"
|
||||
emojiPaletteAlreadyAddedConfirm: "此表情符号已存在于此表情符号选择器中。要再次添加吗?"
|
||||
append: "加到最后"
|
||||
prepend: "加到最前"
|
||||
urlPreviewSensitiveList: "限制显示缩略图的 URL"
|
||||
urlPreviewSensitiveListDescription: "AND 条件用空格分隔,OR 条件用换行符分隔,正则表达式用斜线包裹。成功匹配则不再显示缩略图。"
|
||||
_imageEditing:
|
||||
_vars:
|
||||
caption: "文件标题"
|
||||
@@ -2149,6 +2153,15 @@ _sensitiveMediaDetection:
|
||||
setSensitiveFlagAutomaticallyDescription: "即使关闭此配置,识别结果也会在内部保存。"
|
||||
analyzeVideos: "启用对视频的检测"
|
||||
analyzeVideosDescription: "除了静止图像之外,还对视频进行分析。服务器负载会略微增加。"
|
||||
externalServiceInfo: "检测敏感媒体已分离至外部服务 (sensitive-detector)。若要使用,需额外部署 Sidecar 服务,并设置下方的连接 URL。未设定时将不会进行检测(视为非敏感媒体)。"
|
||||
apiUrl: "检测服务的连接 URL"
|
||||
apiUrlDescription: "sensitive-detector 服务的 base URL(如:http://localhost:3009)。若是连接至部署在专用网络上的服务,请在配置文件中的 allowedPrivateNetworks 里允许目标网络。若是使用了代理,请一并设置 proxyBypassHosts。留空则不进行敏感媒体检测。"
|
||||
apiKey: "API 密钥"
|
||||
apiKeyDescription: "若服务端有设置验证(Bearer token)则填写,未设置则留空。"
|
||||
timeout: "超时(毫秒)"
|
||||
timeoutDescription: "此为单次检测请求的超时时长。"
|
||||
maxImagesPerRequest: "单次检测请求最大图像数量"
|
||||
maxImagesPerRequestDescription: "此为在检测动画等多帧图像时,单次请求中可发送的图像数量上限。超出此值时动画将被拆分并按序发送。请勿将此值设为超出 sensitive-detector 侧的 maxParts 的值(默认:10),否则对应的分块将全被视为非敏感媒体。"
|
||||
_emailUnavailable:
|
||||
used: "已经被使用过"
|
||||
format: "无效的格式"
|
||||
@@ -2461,6 +2474,7 @@ _permissions:
|
||||
"read:admin:show-moderation-log": "查看管理日志"
|
||||
"read:admin:show-user": "查看用户的非公开信息"
|
||||
"write:admin:suspend-user": "冻结用户"
|
||||
"write:admin:unset-mfa": "解除用户的双重验证"
|
||||
"write:admin:unset-user-avatar": "删除用户头像"
|
||||
"write:admin:unset-user-banner": "删除用户横幅"
|
||||
"write:admin:unsuspend-user": "解除用户冻结"
|
||||
@@ -2586,7 +2600,7 @@ _widgetOptions:
|
||||
_jobQueue:
|
||||
sound: "播放音效"
|
||||
_rss:
|
||||
url: "RSS feed 的 URL"
|
||||
url: "RSS 订阅源网址"
|
||||
refreshIntervalSec: "更新间隔(秒)"
|
||||
maxEntries: "最大显示个数"
|
||||
_rssTicker:
|
||||
@@ -2976,6 +2990,7 @@ _moderationLogTypes:
|
||||
createAvatarDecoration: "新建头像挂件"
|
||||
updateAvatarDecoration: "更新头像挂件"
|
||||
deleteAvatarDecoration: "删除头像挂件"
|
||||
unsetMfa: "解除用户的双重验证"
|
||||
unsetUserAvatar: "清除用户头像"
|
||||
unsetUserBanner: "清除用户横幅"
|
||||
createSystemWebhook: "新建了 SystemWebhook"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"version": "2026.7.0-beta.5",
|
||||
"version": "2026.7.0-rc.0",
|
||||
"codename": "nasubi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -57,8 +57,8 @@
|
||||
"esbuild": "0.28.1",
|
||||
"execa": "9.6.1",
|
||||
"ignore-walk": "9.0.0",
|
||||
"js-yaml": "5.2.1",
|
||||
"tar": "7.5.20"
|
||||
"js-yaml": "5.2.2",
|
||||
"tar": "7.5.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.39.5",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class HashtagTableDefaults1784899839024 {
|
||||
name = 'HashtagTableDefaults1784899839024'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedUserIds" SET DEFAULT '{}'`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedLocalUserIds" SET DEFAULT '{}'`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedRemoteUserIds" SET DEFAULT '{}'`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedUserIds" SET DEFAULT '{}'`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedLocalUserIds" SET DEFAULT '{}'`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedRemoteUserIds" SET DEFAULT '{}'`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedRemoteUserIds" DROP DEFAULT`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedLocalUserIds" DROP DEFAULT`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "attachedUserIds" DROP DEFAULT`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedRemoteUserIds" DROP DEFAULT`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedLocalUserIds" DROP DEFAULT`);
|
||||
await queryRunner.query(`ALTER TABLE "hashtag" ALTER COLUMN "mentionedUserIds" DROP DEFAULT`);
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,7 @@
|
||||
"@fastify/cors": "11.3.0",
|
||||
"@fastify/http-proxy": "11.5.0",
|
||||
"@fastify/multipart": "10.1.0",
|
||||
"@fastify/otel": "0.20.1",
|
||||
"@fastify/static": "10.1.0",
|
||||
"@fastify/static": "10.1.2",
|
||||
"@kitajs/html": "4.2.13",
|
||||
"@misskey-dev/emoji-assets": "17.0.3",
|
||||
"@misskey-dev/emoji-data": "17.0.3",
|
||||
@@ -68,15 +67,6 @@
|
||||
"@nestjs/common": "11.1.28",
|
||||
"@nestjs/core": "11.1.28",
|
||||
"@nestjs/testing": "11.1.28",
|
||||
"@opentelemetry/api": "1.9.1",
|
||||
"@opentelemetry/core": "2.9.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.220.0",
|
||||
"@opentelemetry/instrumentation": "0.219.0",
|
||||
"@opentelemetry/instrumentation-pg": "0.72.0",
|
||||
"@opentelemetry/resources": "2.9.0",
|
||||
"@opentelemetry/sdk-trace-base": "2.9.0",
|
||||
"@opentelemetry/sdk-trace-node": "2.9.0",
|
||||
"@opentelemetry/semantic-conventions": "1.43.0",
|
||||
"@oxc-project/runtime": "0.139.0",
|
||||
"@peertube/http-signature": "1.7.0",
|
||||
"@sentry/node": "10.65.0",
|
||||
@@ -193,7 +183,7 @@
|
||||
"eslint-plugin-import": "2.32.0",
|
||||
"execa": "9.6.1",
|
||||
"fkill": "10.0.3",
|
||||
"js-yaml": "5.2.1",
|
||||
"js-yaml": "5.2.2",
|
||||
"pid-port": "2.1.1",
|
||||
"rolldown": "1.1.5",
|
||||
"simple-oauth2": "5.1.0",
|
||||
|
||||
@@ -87,7 +87,6 @@ export default defineConfig((args) => {
|
||||
'class-validator',
|
||||
/^@sentry\/.*/,
|
||||
/^@sentry-internal\/.*/,
|
||||
/^@opentelemetry\/.*/,
|
||||
'@nestjs/websockets/socket-module',
|
||||
'@nestjs/microservices/microservices-module',
|
||||
'@nestjs/microservices',
|
||||
|
||||
@@ -27,21 +27,6 @@ type SentryBackendConfig = {
|
||||
disabledIntegrations?: string[];
|
||||
};
|
||||
|
||||
type OtelBackendConfig = {
|
||||
endpoint?: string;
|
||||
headers?: Record<string, string>;
|
||||
sampleRate?: number;
|
||||
capturePgSpans?: boolean;
|
||||
capturePgStatement?: boolean;
|
||||
capturePgConnectionSpans?: boolean;
|
||||
captureRedisCommandSpans?: boolean;
|
||||
captureRedisConnectionSpans?: boolean;
|
||||
captureRedisRootSpans?: boolean;
|
||||
resourceAttributes?: Record<string, string>;
|
||||
propagateTraceToRemote?: boolean;
|
||||
jobTraceContextMode?: 'link' | 'parent';
|
||||
};
|
||||
|
||||
/**
|
||||
* 設定ファイルの型
|
||||
*/
|
||||
@@ -87,7 +72,6 @@ type Source = {
|
||||
scope?: 'local' | 'global' | string[];
|
||||
};
|
||||
sentryForBackend?: SentryBackendConfig;
|
||||
otelForBackend?: OtelBackendConfig;
|
||||
sentryForFrontend?: {
|
||||
options: Partial<SentryVue.BrowserOptions> & { dsn: string };
|
||||
vueIntegration?: SentryVue.VueIntegrationOptions | null;
|
||||
@@ -233,7 +217,6 @@ export type Config = {
|
||||
redisForTimelines: RedisOptions & RedisOptionsSource;
|
||||
redisForReactions: RedisOptions & RedisOptionsSource;
|
||||
sentryForBackend: SentryBackendConfig | undefined;
|
||||
otelForBackend: OtelBackendConfig | undefined;
|
||||
sentryForFrontend: {
|
||||
options: Partial<SentryVue.BrowserOptions> & { dsn: string };
|
||||
vueIntegration?: SentryVue.VueIntegrationOptions | null;
|
||||
@@ -339,7 +322,6 @@ export function loadConfig(): Config {
|
||||
redisForTimelines: config.redisForTimelines ? convertRedisOptions(config.redisForTimelines, host) : redis,
|
||||
redisForReactions: config.redisForReactions ? convertRedisOptions(config.redisForReactions, host) : redis,
|
||||
sentryForBackend: config.sentryForBackend,
|
||||
otelForBackend: config.otelForBackend,
|
||||
sentryForFrontend: config.sentryForFrontend,
|
||||
id: config.id,
|
||||
proxy: config.proxy,
|
||||
|
||||
@@ -13,6 +13,8 @@ import { GlobalEvents, GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { MiLocalUser } from '@/models/User.js';
|
||||
import { RedisKVCache } from '@/misc/cache.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
|
||||
@Injectable()
|
||||
export class ChannelFollowingService implements OnModuleInit {
|
||||
@@ -96,11 +98,18 @@ export class ChannelFollowingService implements OnModuleInit {
|
||||
requestUser: MiLocalUser,
|
||||
targetChannel: MiChannel,
|
||||
): Promise<void> {
|
||||
await this.channelFollowingsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
followerId: requestUser.id,
|
||||
followeeId: targetChannel.id,
|
||||
});
|
||||
try {
|
||||
await this.channelFollowingsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
followerId: requestUser.id,
|
||||
followeeId: targetChannel.id,
|
||||
});
|
||||
} catch (e) {
|
||||
if (isDuplicateKeyValueError(e)) {
|
||||
throw new IdentifiableError('6e335e39-0203-4418-a936-b3f2dc987845', 'already following');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
this.globalEventService.publishInternalEvent('followChannel', {
|
||||
userId: requestUser.id,
|
||||
|
||||
@@ -16,11 +16,20 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { FeaturedService } from '@/core/FeaturedService.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import Logger from '../logger.js';
|
||||
|
||||
const logger = new Logger('hashtag/create');
|
||||
|
||||
type AttachedOrMentioned = 'attached' | 'mentioned';
|
||||
type UpdatingHashtagColumn = {
|
||||
totalUserIds: keyof MiHashtag & `${AttachedOrMentioned}UserIds`,
|
||||
totalUsersCount: keyof MiHashtag & `${AttachedOrMentioned}UsersCount`,
|
||||
localUserIds: keyof MiHashtag & `${AttachedOrMentioned}LocalUserIds`,
|
||||
localUsersCount: keyof MiHashtag & `${AttachedOrMentioned}LocalUsersCount`,
|
||||
remoteUserIds: keyof MiHashtag & `${AttachedOrMentioned}RemoteUserIds`,
|
||||
remoteUsersCount: keyof MiHashtag & `${AttachedOrMentioned}RemoteUsersCount`,
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class HashtagService {
|
||||
constructor(
|
||||
@@ -68,126 +77,93 @@ export class HashtagService {
|
||||
// TODO: サンプリング
|
||||
this.updateHashtagsRanking(tag, user.id);
|
||||
|
||||
{
|
||||
const index = await this.hashtagsRepository.findOneBy({ name: tag });
|
||||
const column: UpdatingHashtagColumn = isUserAttached ? {
|
||||
totalUserIds: 'attachedUserIds',
|
||||
totalUsersCount: 'attachedUsersCount',
|
||||
localUserIds: 'attachedLocalUserIds',
|
||||
localUsersCount: 'attachedLocalUsersCount',
|
||||
remoteUserIds: 'attachedRemoteUserIds',
|
||||
remoteUsersCount: 'attachedRemoteUsersCount',
|
||||
} : {
|
||||
totalUserIds: 'mentionedUserIds',
|
||||
totalUsersCount: 'mentionedUsersCount',
|
||||
localUserIds: 'mentionedLocalUserIds',
|
||||
localUsersCount: 'mentionedLocalUsersCount',
|
||||
remoteUserIds: 'mentionedRemoteUserIds',
|
||||
remoteUsersCount: 'mentionedRemoteUsersCount',
|
||||
};
|
||||
|
||||
if (index == null && inc) {
|
||||
try {
|
||||
if (isUserAttached) {
|
||||
await this.hashtagsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
name: tag,
|
||||
mentionedUserIds: [],
|
||||
mentionedUsersCount: 0,
|
||||
mentionedLocalUserIds: [],
|
||||
mentionedLocalUsersCount: 0,
|
||||
mentionedRemoteUserIds: [],
|
||||
mentionedRemoteUsersCount: 0,
|
||||
attachedUserIds: [user.id],
|
||||
attachedUsersCount: 1,
|
||||
attachedLocalUserIds: this.userEntityService.isLocalUser(user) ? [user.id] : [],
|
||||
attachedLocalUsersCount: this.userEntityService.isLocalUser(user) ? 1 : 0,
|
||||
attachedRemoteUserIds: this.userEntityService.isRemoteUser(user) ? [user.id] : [],
|
||||
attachedRemoteUsersCount: this.userEntityService.isRemoteUser(user) ? 1 : 0,
|
||||
} as MiHashtag);
|
||||
} else {
|
||||
await this.hashtagsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
name: tag,
|
||||
mentionedUserIds: [user.id],
|
||||
mentionedUsersCount: 1,
|
||||
mentionedLocalUserIds: this.userEntityService.isLocalUser(user) ? [user.id] : [],
|
||||
mentionedLocalUsersCount: this.userEntityService.isLocalUser(user) ? 1 : 0,
|
||||
mentionedRemoteUserIds: this.userEntityService.isRemoteUser(user) ? [user.id] : [],
|
||||
mentionedRemoteUsersCount: this.userEntityService.isRemoteUser(user) ? 1 : 0,
|
||||
attachedUserIds: [],
|
||||
attachedUsersCount: 0,
|
||||
attachedLocalUserIds: [],
|
||||
attachedLocalUsersCount: 0,
|
||||
attachedRemoteUserIds: [],
|
||||
attachedRemoteUsersCount: 0,
|
||||
} as MiHashtag);
|
||||
}
|
||||
return;
|
||||
} catch (err) {
|
||||
if (isDuplicateKeyValueError(err)) {
|
||||
logger.info(`Duplicate insertion detected. Falling back to update. #${tag}`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inc) {
|
||||
await this.#incrementHashTag(user, tag, column);
|
||||
} else {
|
||||
await this.#decrementHashTag(user, tag, column);
|
||||
}
|
||||
}
|
||||
|
||||
async #incrementHashTag(
|
||||
user: { id: MiUser['id']; host: MiUser['host']; },
|
||||
tag: string,
|
||||
columns: UpdatingHashtagColumn,
|
||||
) {
|
||||
const isLocal = this.userEntityService.isLocalUser(user);
|
||||
const { totalUserIds, totalUsersCount } = columns;
|
||||
const localOrRemoteUserIds = isLocal ? columns.localUserIds : columns.remoteUserIds;
|
||||
const localOrRemoteUserCount = isLocal ? columns.localUsersCount : columns.remoteUsersCount;
|
||||
|
||||
const runner = this.db.createQueryRunner('master');
|
||||
try {
|
||||
await runner.query(
|
||||
`INSERT into "hashtag"("id", "name", "${totalUserIds}", "${totalUsersCount}", "${localOrRemoteUserIds}",
|
||||
"${localOrRemoteUserCount}")
|
||||
VALUES ($3, $1, ARRAY [$2], 1, ARRAY [$2], 1)
|
||||
ON CONFLICT ("name")
|
||||
DO UPDATE SET "${totalUserIds}" = ${appendUserIdIfNotExists(totalUserIds)},
|
||||
"${totalUsersCount}" = ${incrementCountIfNotExists(totalUserIds, totalUsersCount)},
|
||||
"${localOrRemoteUserIds}" = ${appendUserIdIfNotExists(localOrRemoteUserIds)},
|
||||
"${localOrRemoteUserCount}" = ${incrementCountIfNotExists(localOrRemoteUserIds, localOrRemoteUserCount)}`,
|
||||
[tag, user.id, this.idService.gen()],
|
||||
);
|
||||
} finally {
|
||||
await runner.release();
|
||||
}
|
||||
|
||||
await this.db.transaction(async transactionalEntityManager => {
|
||||
const transactionalHashtagRepository = transactionalEntityManager
|
||||
.getRepository(MiHashtag);
|
||||
function appendUserIdIfNotExists(userIds: keyof MiHashtag & `${string}UserIds`): string {
|
||||
return `CASE WHEN NOT ("hashtag"."${userIds}" @> ARRAY[$2 ::varchar]) THEN array_append("hashtag"."${userIds}", $2) ELSE "hashtag"."${userIds}" END`;
|
||||
}
|
||||
|
||||
const index = await transactionalHashtagRepository
|
||||
.createQueryBuilder()
|
||||
.setLock('pessimistic_write')
|
||||
.where('name = :name', { name: tag })
|
||||
.getOne();
|
||||
function incrementCountIfNotExists(userIds: keyof MiHashtag & `${string}UserIds`, userCount: keyof MiHashtag & `${string}UsersCount`): string {
|
||||
return `CASE WHEN NOT ("hashtag"."${userIds}" @> ARRAY[$2 ::varchar]) THEN "hashtag"."${userCount}" + 1 ELSE "hashtag"."${userCount}" END`;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == null) return;
|
||||
async #decrementHashTag(
|
||||
user: { id: MiUser['id']; host: MiUser['host']; },
|
||||
tag: string,
|
||||
columns: UpdatingHashtagColumn,
|
||||
) {
|
||||
const isLocal = this.userEntityService.isLocalUser(user);
|
||||
const { totalUserIds, totalUsersCount } = columns;
|
||||
const localOrRemoteUserIds = isLocal ? columns.localUserIds : columns.remoteUserIds;
|
||||
const localOrRemoteUserCount = isLocal ? columns.localUsersCount : columns.remoteUsersCount;
|
||||
|
||||
const set = {} as any;
|
||||
const runner = this.db.createQueryRunner('master');
|
||||
try {
|
||||
await runner.query(
|
||||
`UPDATE "hashtag"
|
||||
SET "${totalUserIds}" = array_remove("${totalUserIds}", $2),
|
||||
"${totalUsersCount}" = ${decrementIfExists(totalUserIds, totalUsersCount)},
|
||||
"${localOrRemoteUserIds}" = array_remove("${localOrRemoteUserIds}", $2),
|
||||
"${localOrRemoteUserCount}" = ${decrementIfExists(localOrRemoteUserIds, localOrRemoteUserCount)}
|
||||
WHERE "name" = $1`,
|
||||
[tag, user.id],
|
||||
);
|
||||
} finally {
|
||||
await runner.release();
|
||||
}
|
||||
|
||||
if (isUserAttached) {
|
||||
if (inc) {
|
||||
// 自分が初めてこのタグを使ったなら
|
||||
if (!index.attachedUserIds.some(id => id === user.id)) {
|
||||
set.attachedUserIds = () => `array_append("attachedUserIds", '${user.id}')`;
|
||||
set.attachedUsersCount = () => '"attachedUsersCount" + 1';
|
||||
}
|
||||
// 自分が(ローカル内で)初めてこのタグを使ったなら
|
||||
if (this.userEntityService.isLocalUser(user) && !index.attachedLocalUserIds.some(id => id === user.id)) {
|
||||
set.attachedLocalUserIds = () => `array_append("attachedLocalUserIds", '${user.id}')`;
|
||||
set.attachedLocalUsersCount = () => '"attachedLocalUsersCount" + 1';
|
||||
}
|
||||
// 自分が(リモートで)初めてこのタグを使ったなら
|
||||
if (this.userEntityService.isRemoteUser(user) && !index.attachedRemoteUserIds.some(id => id === user.id)) {
|
||||
set.attachedRemoteUserIds = () => `array_append("attachedRemoteUserIds", '${user.id}')`;
|
||||
set.attachedRemoteUsersCount = () => '"attachedRemoteUsersCount" + 1';
|
||||
}
|
||||
} else {
|
||||
set.attachedUserIds = () => `array_remove("attachedUserIds", '${user.id}')`;
|
||||
set.attachedUsersCount = () => '"attachedUsersCount" - 1';
|
||||
if (this.userEntityService.isLocalUser(user)) {
|
||||
set.attachedLocalUserIds = () => `array_remove("attachedLocalUserIds", '${user.id}')`;
|
||||
set.attachedLocalUsersCount = () => '"attachedLocalUsersCount" - 1';
|
||||
} else {
|
||||
set.attachedRemoteUserIds = () => `array_remove("attachedRemoteUserIds", '${user.id}')`;
|
||||
set.attachedRemoteUsersCount = () => '"attachedRemoteUsersCount" - 1';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 自分が初めてこのタグを使ったなら
|
||||
if (!index.mentionedUserIds.some(id => id === user.id)) {
|
||||
set.mentionedUserIds = () => `array_append("mentionedUserIds", '${user.id}')`;
|
||||
set.mentionedUsersCount = () => '"mentionedUsersCount" + 1';
|
||||
}
|
||||
// 自分が(ローカル内で)初めてこのタグを使ったなら
|
||||
if (this.userEntityService.isLocalUser(user) && !index.mentionedLocalUserIds.some(id => id === user.id)) {
|
||||
set.mentionedLocalUserIds = () => `array_append("mentionedLocalUserIds", '${user.id}')`;
|
||||
set.mentionedLocalUsersCount = () => '"mentionedLocalUsersCount" + 1';
|
||||
}
|
||||
// 自分が(リモートで)初めてこのタグを使ったなら
|
||||
if (this.userEntityService.isRemoteUser(user) && !index.mentionedRemoteUserIds.some(id => id === user.id)) {
|
||||
set.mentionedRemoteUserIds = () => `array_append("mentionedRemoteUserIds", '${user.id}')`;
|
||||
set.mentionedRemoteUsersCount = () => '"mentionedRemoteUsersCount" + 1';
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(set).length > 0) {
|
||||
await transactionalHashtagRepository
|
||||
.createQueryBuilder()
|
||||
.update()
|
||||
.where('id = :id', { id: index.id })
|
||||
.set(set)
|
||||
.execute();
|
||||
}
|
||||
});
|
||||
function decrementIfExists(userIds: keyof MiHashtag & `${string}UserIds`, userCount: keyof MiHashtag & `${string}UsersCount`): string {
|
||||
return `CASE WHEN ("${userIds}" @> ARRAY[$2]) THEN "${userCount}" - 1 ELSE "${userCount}" END`;
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
||||
@@ -9,7 +9,6 @@ import { DI } from '@/di-symbols.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { baseQueueOptions, QUEUE } from '@/queue/const.js';
|
||||
import { allSettled } from '@/misc/promise-tracker.js';
|
||||
import { instrumentQueue } from '@/core/telemetry/queue-instrumentation.js';
|
||||
import {
|
||||
DeliverJobData,
|
||||
EndedPollNotificationJobData,
|
||||
@@ -33,12 +32,7 @@ export type UserWebhookDeliverQueue = Bull.Queue<UserWebhookDeliverJobData>;
|
||||
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
|
||||
|
||||
function createQueue<T extends object>(queueName: string, config: Config): Bull.Queue<T> {
|
||||
const queue = new Bull.Queue<T>(queueName, baseQueueOptions(config, queueName));
|
||||
// Queue のラップは、enqueue 時に OTel context をジョブデータへ埋め込むためのもの。
|
||||
// Sentry 単独ではジョブ間の context 伝播を使わないので、OTel 未設定時は元の Queue を返す。
|
||||
if (config.otelForBackend == null) return queue;
|
||||
|
||||
return instrumentQueue(queue);
|
||||
return new Bull.Queue<T>(queueName, baseQueueOptions(config, queueName));
|
||||
}
|
||||
|
||||
const $system: Provider = {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { captureMessage, shutdownTelemetry, startSpan, startSpanWithTraceContext } from './telemetry-registry.js';
|
||||
import { captureMessage, shutdownTelemetry, startSpan } from './telemetry-registry.js';
|
||||
import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
import type { TelemetryCaptureMessageOptions } from './adapters/TelemetryAdapter.js';
|
||||
|
||||
@@ -21,13 +21,6 @@ export class TelemetryService implements OnApplicationShutdown {
|
||||
return startSpan(name, fn);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public startSpanWithTraceContext<T>(name: string, jobData: object, fn: () => T): T {
|
||||
// jobData に enqueue 元の context があれば worker span へ復元する。
|
||||
// context の無い既存ジョブは、通常の startSpan と同じ扱いになる。
|
||||
return startSpanWithTraceContext(name, jobData, fn);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async onApplicationShutdown(_signal?: string): Promise<void> {
|
||||
await shutdownTelemetry();
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as os from 'node:os';
|
||||
import cluster from 'node:cluster';
|
||||
import { envOption } from '@/env.js';
|
||||
import { registerDiagLogger } from '@/core/telemetry/telemetry-diag.js';
|
||||
import { installHttpClientInstrumentation } from '@/core/telemetry/http-client-instrumentation.js';
|
||||
import { installDatabaseInstrumentation } from '@/core/telemetry/database-instrumentation.js';
|
||||
import { installRedisInstrumentation } from '@/core/telemetry/redis-instrumentation.js';
|
||||
import { executeSpan, getQueueTraceContextMode, injectActiveTraceContext, recordSpanError, startSpanWithQueueTraceContext } from '@/core/telemetry/queue-trace-context.js';
|
||||
import type { LogTraceContext } from '@/logging/types.js';
|
||||
import type { Span, SpanStatusCode, Tracer } from '@opentelemetry/api';
|
||||
import type { Resource, ResourceDetector } from '@opentelemetry/resources';
|
||||
import type { ParentBasedSampler, Sampler } from '@opentelemetry/sdk-trace-base';
|
||||
import type { OtelBackendRuntimeConfig, TelemetryAdapter, TelemetryCaptureMessageOptions } from './TelemetryAdapter.js';
|
||||
import type { QueueTraceContextCarrier, QueueTraceContextDeps } from '../queue-trace-context.js';
|
||||
|
||||
const DEFAULT_SHUTDOWN_TIMEOUT = 5000;
|
||||
|
||||
type OpenTelemetryAdapterDeps = {
|
||||
tracer: Pick<Tracer, 'startActiveSpan'>;
|
||||
provider: {
|
||||
shutdown(): Promise<void>;
|
||||
};
|
||||
getActiveSpan: () => Span | undefined;
|
||||
spanStatusCodeError: SpanStatusCode;
|
||||
shutdownTimeout: number;
|
||||
shutdownHttpClientInstrumentation?: () => void;
|
||||
shutdownDatabaseInstrumentation?: () => void;
|
||||
shutdownRedisInstrumentation?: () => void;
|
||||
queueTraceContext?: QueueTraceContextDeps;
|
||||
};
|
||||
|
||||
type CreateSamplerDeps = {
|
||||
ParentBasedSampler: new (config: { root: Sampler }) => ParentBasedSampler;
|
||||
TraceIdRatioBasedSampler: new (sampleRate: number) => Sampler;
|
||||
};
|
||||
|
||||
type CreateResourceDeps = {
|
||||
defaultResource: () => Resource;
|
||||
resourceFromAttributes: (attributes: Record<string, string>) => Resource;
|
||||
detectResources: (config: { detectors: ResourceDetector[] }) => Resource;
|
||||
envDetector: ResourceDetector;
|
||||
serviceNameAttribute: string;
|
||||
serviceInstanceIdAttribute: string;
|
||||
serviceVersionAttribute: string;
|
||||
serviceVersion: string;
|
||||
};
|
||||
|
||||
export class OpenTelemetryAdapter implements TelemetryAdapter {
|
||||
public constructor(
|
||||
private readonly deps: OpenTelemetryAdapterDeps,
|
||||
) {
|
||||
}
|
||||
|
||||
public static async create(config: OtelBackendRuntimeConfig): Promise<OpenTelemetryAdapter> {
|
||||
const [
|
||||
{ context, diag, DiagLogLevel, propagation, ROOT_CONTEXT, SpanKind, SpanStatusCode, trace },
|
||||
{ W3CTraceContextPropagator },
|
||||
{ OTLPTraceExporter },
|
||||
{ defaultResource, detectResources, envDetector, resourceFromAttributes },
|
||||
{ BatchSpanProcessor, ParentBasedSampler, TraceIdRatioBasedSampler },
|
||||
{ NodeTracerProvider },
|
||||
{ ATTR_SERVICE_INSTANCE_ID, ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION },
|
||||
] = await Promise.all([
|
||||
import('@opentelemetry/api'),
|
||||
import('@opentelemetry/core'),
|
||||
import('@opentelemetry/exporter-trace-otlp-proto'),
|
||||
import('@opentelemetry/resources'),
|
||||
import('@opentelemetry/sdk-trace-base'),
|
||||
import('@opentelemetry/sdk-trace-node'),
|
||||
import('@opentelemetry/semantic-conventions'),
|
||||
]);
|
||||
|
||||
// OTel SDK内部のexport失敗は既定だと見えにくいため、Misskeyのloggerへ橋渡しする。
|
||||
registerDiagLogger(diag, DiagLogLevel.WARN);
|
||||
|
||||
// endpoint/headersを未指定にしておくと、OTEL_EXPORTER_OTLP_* 環境変数の標準fallbackが効く。
|
||||
const exporter = new OTLPTraceExporter({
|
||||
...(config.endpoint != null ? { url: config.endpoint } : {}),
|
||||
...(config.headers != null ? { headers: config.headers } : {}),
|
||||
});
|
||||
const spanProcessor = new BatchSpanProcessor(exporter);
|
||||
|
||||
// SDK 2.xではSpanProcessorをprovider生成時に渡す。ここでOTel単体用のproviderを作る。
|
||||
const provider = new NodeTracerProvider({
|
||||
resource: createResource(config, {
|
||||
defaultResource,
|
||||
resourceFromAttributes,
|
||||
detectResources,
|
||||
envDetector,
|
||||
serviceNameAttribute: ATTR_SERVICE_NAME,
|
||||
serviceInstanceIdAttribute: ATTR_SERVICE_INSTANCE_ID,
|
||||
serviceVersionAttribute: ATTR_SERVICE_VERSION,
|
||||
serviceVersion: config.serviceVersion,
|
||||
}),
|
||||
...(config.sampleRate != null ? { sampler: createSampler(config.sampleRate, {
|
||||
ParentBasedSampler,
|
||||
TraceIdRatioBasedSampler,
|
||||
}) } : {}),
|
||||
spanProcessors: [spanProcessor],
|
||||
});
|
||||
|
||||
// HTTP送信には注入しないが、将来のQueue連結でpropagation APIを使える状態にする。
|
||||
provider.register({
|
||||
propagator: new W3CTraceContextPropagator(),
|
||||
});
|
||||
|
||||
// provider操作をdepsに閉じ込め、span wrapper本体をユニットテストしやすくする。
|
||||
const tracer = provider.getTracer('misskey-backend');
|
||||
|
||||
return new OpenTelemetryAdapter({
|
||||
tracer,
|
||||
provider,
|
||||
getActiveSpan: () => trace.getActiveSpan(),
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: DEFAULT_SHUTDOWN_TIMEOUT,
|
||||
shutdownHttpClientInstrumentation: installHttpClientInstrumentation({
|
||||
tracer,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}),
|
||||
// pg のrequire hookとioredis diagnostics channelは、Nest moduleの動的importより前に有効化する。
|
||||
shutdownDatabaseInstrumentation: await installDatabaseInstrumentation(provider, {
|
||||
capturePgSpans: config.capturePgSpans === true,
|
||||
capturePgStatement: config.capturePgStatement === true,
|
||||
capturePgConnectionSpans: config.capturePgConnectionSpans === true,
|
||||
}),
|
||||
shutdownRedisInstrumentation: installRedisInstrumentation(tracer, SpanKind.CLIENT, SpanStatusCode.ERROR, {
|
||||
captureConnectionSpans: config.captureRedisConnectionSpans === true,
|
||||
captureCommandSpans: config.captureRedisCommandSpans === true,
|
||||
requireParentSpan: config.captureRedisRootSpans !== true,
|
||||
}),
|
||||
queueTraceContext: {
|
||||
tracer,
|
||||
propagation,
|
||||
trace,
|
||||
getActiveContext: () => context.active(),
|
||||
rootContext: ROOT_CONTEXT,
|
||||
mode: getQueueTraceContextMode(config.jobTraceContextMode),
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public captureMessage(message: string, _opts: TelemetryCaptureMessageOptions): void {
|
||||
// captureMessageは例外通知APIなので、OTelでは対象spanにエラー状態を付ける。
|
||||
// アクティブspanが無い場合(例: BullMQのjob処理が既に完了しspanが閉じた後の'failed'イベント)でも
|
||||
// 通知を握り潰さないよう、報告専用の短命spanを作ってそこに記録する。
|
||||
const span = this.deps.getActiveSpan();
|
||||
if (span != null) {
|
||||
recordSpanError(span, new Error(message), this.deps.spanStatusCodeError);
|
||||
return;
|
||||
}
|
||||
|
||||
this.deps.tracer.startActiveSpan('captureMessage', reportSpan => {
|
||||
recordSpanError(reportSpan, new Error(message), this.deps.spanStatusCodeError);
|
||||
reportSpan.end();
|
||||
});
|
||||
}
|
||||
|
||||
/** activeなSpanの識別子を、Logging基盤で扱える形式へ変換します。 */
|
||||
public getActiveTraceContext(): LogTraceContext | undefined {
|
||||
const activeSpan = this.deps.getActiveSpan();
|
||||
if (activeSpan == null) return undefined;
|
||||
|
||||
const { traceId, spanId, traceFlags } = activeSpan.spanContext();
|
||||
return { traceId, spanId, traceFlags };
|
||||
}
|
||||
|
||||
public startSpan<T>(name: string, fn: () => T): T {
|
||||
// 既存のTelemetryAdapter契約に合わせ、同期/非同期どちらでも同じspan lifetimeを保証する。
|
||||
return this.deps.tracer.startActiveSpan(name, span => executeSpan(span, fn, this.deps.spanStatusCodeError));
|
||||
}
|
||||
|
||||
public injectTraceContext(carrier: QueueTraceContextCarrier): void {
|
||||
const queueTraceContext = this.deps.queueTraceContext;
|
||||
// Queue context 用の依存は任意なので、無い場合はジョブデータを変更しない。
|
||||
if (queueTraceContext == null) return;
|
||||
injectActiveTraceContext(queueTraceContext, carrier);
|
||||
}
|
||||
|
||||
public startSpanWithTraceContext<T>(name: string, jobData: object, fn: () => T): T {
|
||||
const queueTraceContext = this.deps.queueTraceContext;
|
||||
// Queue context 用の依存が無い場合は、従来の span 作成経路と同じ動作を保つ。
|
||||
if (queueTraceContext == null) return this.startSpan(name, fn);
|
||||
|
||||
return startSpanWithQueueTraceContext(queueTraceContext, name, jobData, fn, () => this.startSpan(name, fn));
|
||||
}
|
||||
|
||||
public async shutdown(): Promise<void> {
|
||||
this.deps.shutdownHttpClientInstrumentation?.();
|
||||
this.deps.shutdownDatabaseInstrumentation?.();
|
||||
this.deps.shutdownRedisInstrumentation?.();
|
||||
// BatchSpanProcessorのflushが詰まってもプロセス終了を妨げないよう、上限時間を設ける。
|
||||
// タイムアウト側のtimerは、flushが先に終わった場合にイベントループを無駄に引き留めないようclearする。
|
||||
let timer: NodeJS.Timeout | undefined;
|
||||
await Promise.race([
|
||||
this.deps.provider.shutdown(),
|
||||
new Promise<void>(resolve => {
|
||||
timer = setTimeout(resolve, this.deps.shutdownTimeout);
|
||||
}),
|
||||
]).finally(() => {
|
||||
if (timer != null) clearTimeout(timer);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function createResource(config: OtelBackendRuntimeConfig, deps: CreateResourceDeps): Resource {
|
||||
// resourceを明示指定するとSDKのdefaultResource()は自動付与されなくなる(マージではなく上書き)ため、
|
||||
// telemetry.sdk.*等の標準属性を失わないよう明示的にmergeする。
|
||||
const misskeyDefaultResource = deps.resourceFromAttributes({
|
||||
[deps.serviceNameAttribute]: 'misskey-backend',
|
||||
[deps.serviceInstanceIdAttribute]: `${os.hostname()}:${process.pid}`,
|
||||
[deps.serviceVersionAttribute]: deps.serviceVersion,
|
||||
'misskey.process.role': getMisskeyProcessRole(),
|
||||
});
|
||||
|
||||
// OTel標準の OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES を尊重する。
|
||||
// mergeは右辺が優先されるため、config.resourceAttributesを最優先にする。
|
||||
return deps.defaultResource()
|
||||
.merge(misskeyDefaultResource)
|
||||
.merge(deps.detectResources({ detectors: [deps.envDetector] }))
|
||||
.merge(deps.resourceFromAttributes(config.resourceAttributes ?? {}));
|
||||
}
|
||||
|
||||
export function createSampler(sampleRate: number, deps: CreateSamplerDeps): ParentBasedSampler {
|
||||
// 設定ミスを無言でAlwaysOn/AlwaysOffに倒さず、起動時に明確に失敗させる。
|
||||
// (YAMLでクォートされた数値文字列などnumber型の保証が無い値が来てもここで弾く)
|
||||
if (typeof sampleRate !== 'number' || !Number.isFinite(sampleRate) || sampleRate < 0 || sampleRate > 1) {
|
||||
throw new Error('otelForBackend.sampleRate must be a number between 0.0 and 1.0.');
|
||||
}
|
||||
|
||||
return new deps.ParentBasedSampler({
|
||||
root: new deps.TraceIdRatioBasedSampler(sampleRate),
|
||||
});
|
||||
}
|
||||
|
||||
export function getMisskeyProcessRole(): string {
|
||||
// Trace backend上でserver/queue/workerを見分けられるよう、Misskey固有の役割をresourceに載せる。
|
||||
if (envOption.disableClustering) {
|
||||
if (envOption.onlyServer) return 'primary-server';
|
||||
if (envOption.onlyQueue) return 'primary-queue';
|
||||
return 'primary-server+queue';
|
||||
}
|
||||
|
||||
if (cluster.isPrimary) {
|
||||
if (envOption.onlyServer) return 'fork-only';
|
||||
if (envOption.onlyQueue) return 'primary-queue';
|
||||
return 'primary-server';
|
||||
}
|
||||
|
||||
// worker.tsのworkerMainに合わせる: onlyServerならserver()、それ以外はjobQueue()を実行する。
|
||||
if (envOption.onlyServer) return 'worker-server';
|
||||
return 'worker-queue';
|
||||
}
|
||||
@@ -3,18 +3,13 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import Logger from '@/logger.js';
|
||||
import { registerDiagLogger } from '@/core/telemetry/telemetry-diag.js';
|
||||
import { getQueueTraceContextMode, injectActiveTraceContext, startSpanWithQueueTraceContext } from '@/core/telemetry/queue-trace-context.js';
|
||||
import type { LogTraceContext } from '@/logging/types.js';
|
||||
import type * as SentryNode from '@sentry/node';
|
||||
import type { NodeOptions } from '@sentry/node';
|
||||
import type { OtelBackendRuntimeConfig, SentryBackendConfig, TelemetryAdapter, TelemetryCaptureMessageOptions } from './TelemetryAdapter.js';
|
||||
import type { QueueTraceContextCarrier, QueueTraceContextDeps } from '../queue-trace-context.js';
|
||||
import type { SentryBackendConfig, TelemetryAdapter, TelemetryCaptureMessageOptions } from './TelemetryAdapter.js';
|
||||
|
||||
// OpenTelemetryAdapterのDEFAULT_SHUTDOWN_TIMEOUTと揃え、Sentryのtransportが詰まってもプロセス終了を妨げないようにする。
|
||||
// Sentryのtransportが詰まってもプロセス終了を妨げないようにする。
|
||||
const DEFAULT_SHUTDOWN_TIMEOUT = 5000;
|
||||
const logger = new Logger('telemetry', 'green');
|
||||
|
||||
type SentryIntegrationsOption = NonNullable<NodeOptions['integrations']>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -73,50 +68,9 @@ export function buildSentryNodeOptions(
|
||||
};
|
||||
}
|
||||
|
||||
type BuildSentryOtlpInitOptions = {
|
||||
sentryConfig: SentryBackendConfig;
|
||||
otelConfig: OtelBackendRuntimeConfig;
|
||||
otlpProcessor: unknown;
|
||||
nodeProfilingIntegration?: () => SentryIntegration;
|
||||
warn?: (message: string) => void;
|
||||
};
|
||||
|
||||
export function buildSentryOtlpInitOptions(options: BuildSentryOtlpInitOptions): SentryNodeOptions {
|
||||
// OTel併存時も、remoteへtrace headerを漏らさないデフォルトはSentry単体時と揃える。
|
||||
// propagateTraceToRemote: true か、options.tracePropagationTargets の明示指定がある場合のみ既定を上書きする。
|
||||
const { tracePropagationTargets, ...sentryOptions } = options.sentryConfig.options;
|
||||
const propagateTraceToRemote = options.otelConfig.propagateTraceToRemote === true || tracePropagationTargets != null;
|
||||
const warn = options.warn ?? ((message: string) => logger.warn(message));
|
||||
|
||||
if (options.otelConfig.sampleRate != null) {
|
||||
warn('otelForBackend.sampleRate is ignored when sentryForBackend is also configured; configure sentryForBackend.options.tracesSampleRate or tracesSampler instead.');
|
||||
}
|
||||
|
||||
if (options.otelConfig.resourceAttributes != null) {
|
||||
warn('otelForBackend.resourceAttributes is ignored when sentryForBackend is also configured; configure OTEL_RESOURCE_ATTRIBUTES instead.');
|
||||
}
|
||||
|
||||
return {
|
||||
...buildSentryNodeOptions({
|
||||
...options.sentryConfig,
|
||||
options: {
|
||||
...sentryOptions,
|
||||
...(propagateTraceToRemote ? { tracePropagationTargets } : {}),
|
||||
},
|
||||
}, options.nodeProfilingIntegration),
|
||||
|
||||
// Sentryの単一TracerProviderにOTLP processorを追加し、親欠損や二重providerを避ける。
|
||||
openTelemetrySpanProcessors: [
|
||||
...(options.sentryConfig.options.openTelemetrySpanProcessors ?? []),
|
||||
options.otlpProcessor as NonNullable<SentryNodeOptions['openTelemetrySpanProcessors']>[number],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export class SentryTelemetryAdapter implements TelemetryAdapter {
|
||||
private constructor(
|
||||
private readonly Sentry: typeof SentryNode,
|
||||
private readonly queueTraceContext?: QueueTraceContextDeps,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -129,45 +83,6 @@ export class SentryTelemetryAdapter implements TelemetryAdapter {
|
||||
return new SentryTelemetryAdapter(Sentry);
|
||||
}
|
||||
|
||||
public static async createWithOtlpExport(
|
||||
sentryConfig: SentryBackendConfig,
|
||||
otelConfig: OtelBackendRuntimeConfig,
|
||||
): Promise<SentryTelemetryAdapter> {
|
||||
const Sentry = await import('@sentry/node');
|
||||
const { nodeProfilingIntegration } = await import('@sentry/profiling-node');
|
||||
const { context, diag, DiagLogLevel, propagation, ROOT_CONTEXT, SpanStatusCode, trace } = await import('@opentelemetry/api');
|
||||
const { BatchSpanProcessor } = await import('@opentelemetry/sdk-trace-base');
|
||||
const { OTLPTraceExporter } = await import('@opentelemetry/exporter-trace-otlp-proto');
|
||||
|
||||
registerDiagLogger(diag, DiagLogLevel.WARN);
|
||||
|
||||
// OTLP送信だけを担うprocessorを作り、provider生成はSentry.init側に任せる。
|
||||
const otlpProcessor = new BatchSpanProcessor(new OTLPTraceExporter({
|
||||
...(otelConfig.endpoint != null ? { url: otelConfig.endpoint } : {}),
|
||||
...(otelConfig.headers != null ? { headers: otelConfig.headers } : {}),
|
||||
}));
|
||||
|
||||
// SentryとOTLPを同一providerに集約することで、どちらの宛先にも同じspan実体を流す。
|
||||
Sentry.init(buildSentryOtlpInitOptions({
|
||||
sentryConfig,
|
||||
otelConfig,
|
||||
otlpProcessor,
|
||||
nodeProfilingIntegration,
|
||||
}));
|
||||
|
||||
// Sentry が初期化した同じ OTel provider から tracer/context API を受け取り、
|
||||
// Queue を跨ぐ context 伝播も Sentry と OTLP の両方へ同一 span として出力する。
|
||||
return new SentryTelemetryAdapter(Sentry, {
|
||||
tracer: trace.getTracer('misskey-backend'),
|
||||
propagation,
|
||||
trace,
|
||||
getActiveContext: () => context.active(),
|
||||
rootContext: ROOT_CONTEXT,
|
||||
mode: getQueueTraceContextMode(otelConfig.jobTraceContextMode),
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
});
|
||||
}
|
||||
|
||||
public captureMessage(message: string, opts: TelemetryCaptureMessageOptions): void {
|
||||
this.Sentry.captureMessage(message, {
|
||||
level: opts.level,
|
||||
@@ -189,19 +104,6 @@ export class SentryTelemetryAdapter implements TelemetryAdapter {
|
||||
return this.Sentry.startSpan({ name }, fn);
|
||||
}
|
||||
|
||||
public injectTraceContext(carrier: QueueTraceContextCarrier): void {
|
||||
// Sentry 単体構成では queueTraceContext を持たず、従来どおりジョブデータを変更しない。
|
||||
if (this.queueTraceContext == null) return;
|
||||
injectActiveTraceContext(this.queueTraceContext, carrier);
|
||||
}
|
||||
|
||||
public startSpanWithTraceContext<T>(name: string, jobData: object, fn: () => T): T {
|
||||
// Sentry 単体構成では Sentry 既存の span 作成経路を使う。
|
||||
if (this.queueTraceContext == null) return this.startSpan(name, fn);
|
||||
|
||||
return startSpanWithQueueTraceContext(this.queueTraceContext, name, jobData, fn, () => this.startSpan(name, fn));
|
||||
}
|
||||
|
||||
public async shutdown(): Promise<void> {
|
||||
// timeout未指定だとtransportのflushが詰まった際にプロセス終了を妨げるため、上限時間を設ける。
|
||||
await this.Sentry.close(DEFAULT_SHUTDOWN_TIMEOUT);
|
||||
|
||||
@@ -5,19 +5,14 @@
|
||||
|
||||
import type { Config } from '@/config.js';
|
||||
import type { LogTraceContext } from '@/logging/types.js';
|
||||
import type { QueueTraceContextCarrier } from '../queue-trace-context.js';
|
||||
|
||||
export type SentryBackendConfig = NonNullable<Config['sentryForBackend']>;
|
||||
export type OtelBackendConfig = NonNullable<Config['otelForBackend']>;
|
||||
export type OtelBackendRuntimeConfig = OtelBackendConfig & {
|
||||
serviceVersion: string;
|
||||
};
|
||||
|
||||
export interface TelemetryCaptureMessageOptions {
|
||||
/** 現在はエラー通知用途だけに絞る。追加する場合は各adapterでの扱いを揃えること。 */
|
||||
level: 'error';
|
||||
|
||||
/** Sentryではuser.idへ渡す。OTel adapterは現在span属性へ付与していないため、必要ならadapter側で拡張する。 */
|
||||
/** Sentryではuser.idへ渡す補助情報です。 */
|
||||
userId?: string;
|
||||
|
||||
/** queue名やendpoint名など、通知先で調査に使う補助情報。 */
|
||||
@@ -25,14 +20,14 @@ export interface TelemetryCaptureMessageOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sentry・OpenTelemetryなど、エラートラッキング/APMサービスごとの実装差異を隠蔽するための抽象。
|
||||
* エラートラッキング/APMサービスごとの実装差異を隠蔽するための抽象。
|
||||
* 新しいサービスを追加する場合はこのインターフェースを実装するアダプタをこのディレクトリに追加し、
|
||||
* telemetry-registry.tsのinitTelemetry内で登録する。
|
||||
*/
|
||||
export interface TelemetryAdapter {
|
||||
/**
|
||||
* 実行中の処理で起きたエラー相当の事象を記録する。
|
||||
* Sentryはmessage通知、OTelはactive spanまたは短命spanへの例外記録として扱う。
|
||||
* Sentryではmessage通知として扱う。
|
||||
*/
|
||||
captureMessage(message: string, opts: TelemetryCaptureMessageOptions): void;
|
||||
|
||||
@@ -45,18 +40,6 @@ export interface TelemetryAdapter {
|
||||
*/
|
||||
startSpan<T>(name: string, fn: () => T): T;
|
||||
|
||||
/**
|
||||
* BullMQ のジョブデータへ保存する carrier に、active trace context を注入する。
|
||||
* OTel を使わない adapter は実装しない。
|
||||
*/
|
||||
injectTraceContext?(carrier: QueueTraceContextCarrier): void;
|
||||
|
||||
/**
|
||||
* ジョブに保存された enqueue 元の context を、worker span の Link または parent として復元する。
|
||||
* context を持たないジョブの互換性は adapter 側で保つ。
|
||||
*/
|
||||
startSpanWithTraceContext?<T>(name: string, jobData: object, fn: () => T): T;
|
||||
|
||||
/**
|
||||
* プロセス終了時にtelemetry backendへ残りのデータをflushする。
|
||||
* 実装側ではtransport停止に引きずられないよう、待機時間に上限を設ける。
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Span, TracerProvider } from '@opentelemetry/api';
|
||||
|
||||
type Instrumentation = {
|
||||
setTracerProvider(provider: TracerProvider): void;
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
};
|
||||
|
||||
type PgInstrumentationConfig = {
|
||||
enhancedDatabaseReporting: boolean;
|
||||
requireParentSpan: boolean;
|
||||
ignoreConnectSpans: boolean;
|
||||
requestHook?(span: Span): void;
|
||||
};
|
||||
|
||||
type InstrumentationConstructor = new (config: PgInstrumentationConfig) => Instrumentation;
|
||||
|
||||
type InstrumentationDeps = {
|
||||
PgInstrumentation: InstrumentationConstructor;
|
||||
};
|
||||
|
||||
type DatabaseInstrumentationOptions = {
|
||||
capturePgStatement: boolean;
|
||||
capturePgConnectionSpans: boolean;
|
||||
};
|
||||
|
||||
type InstallDatabaseInstrumentationOptions = DatabaseInstrumentationOptions & {
|
||||
capturePgSpans: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* pg はアプリケーションが import する前に有効化しないと、require hook 型の
|
||||
* 自動計装がモジュールを patch できない。そのため、
|
||||
* telemetry provider の登録直後にこの関数を呼び出す。
|
||||
*/
|
||||
export async function installDatabaseInstrumentation(provider: TracerProvider, options: InstallDatabaseInstrumentationOptions): Promise<() => void> {
|
||||
if (!options.capturePgSpans) return () => {};
|
||||
|
||||
const { PgInstrumentation } = await import('@opentelemetry/instrumentation-pg');
|
||||
|
||||
return installInstrumentation(provider, { PgInstrumentation }, options);
|
||||
}
|
||||
|
||||
export function installInstrumentation(provider: TracerProvider, deps: InstrumentationDeps, options: DatabaseInstrumentationOptions = {
|
||||
capturePgStatement: false,
|
||||
capturePgConnectionSpans: false,
|
||||
}): () => void {
|
||||
const instrumentations = [
|
||||
new deps.PgInstrumentation({
|
||||
// SQLパラメータには投稿内容・認証情報などが含まれ得るため、常に記録しない。
|
||||
enhancedDatabaseReporting: false,
|
||||
requireParentSpan: true,
|
||||
ignoreConnectSpans: !options.capturePgConnectionSpans,
|
||||
// instrumentation-pgはSQL本文を無加工で属性へ追加する。明示opt-in時だけ残す。
|
||||
...(options.capturePgStatement ? {} : {
|
||||
requestHook: (span: Span) => {
|
||||
span.setAttribute('db.statement', '[REDACTED]');
|
||||
span.setAttribute('db.query.text', '[REDACTED]');
|
||||
},
|
||||
}),
|
||||
}),
|
||||
];
|
||||
|
||||
try {
|
||||
for (const instrumentation of instrumentations) {
|
||||
instrumentation.setTracerProvider(provider);
|
||||
instrumentation.enable();
|
||||
}
|
||||
} catch (error) {
|
||||
for (const instrumentation of instrumentations) {
|
||||
instrumentation.disable();
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
return () => {
|
||||
for (const instrumentation of instrumentations) {
|
||||
instrumentation.disable();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { channel } from 'node:diagnostics_channel';
|
||||
import type { ClientRequest, IncomingMessage } from 'node:http';
|
||||
import type { Span, SpanOptions, SpanStatusCode, Tracer } from '@opentelemetry/api';
|
||||
|
||||
const HTTP_CLIENT_REQUEST_CREATED = 'http.client.request.created';
|
||||
const HTTP_CLIENT_RESPONSE_FINISH = 'http.client.response.finish';
|
||||
const HTTP_CLIENT_REQUEST_ERROR = 'http.client.request.error';
|
||||
|
||||
type HttpClientSpan = Pick<Span, 'end' | 'recordException' | 'setAttribute' | 'setStatus'>;
|
||||
|
||||
type HttpClientInstrumentationDeps = {
|
||||
tracer: Pick<Tracer, 'startSpan'>;
|
||||
spanKindClient: SpanOptions['kind'];
|
||||
spanStatusCodeError: SpanStatusCode;
|
||||
subscribe: (name: string, listener: (message: unknown) => void) => () => void;
|
||||
};
|
||||
|
||||
type RequestCreatedMessage = { request: ClientRequest };
|
||||
type ResponseFinishMessage = { request: ClientRequest; response: IncomingMessage };
|
||||
type RequestErrorMessage = { request: ClientRequest; error: Error };
|
||||
|
||||
/**
|
||||
* require フックを使わず、Node.js 組み込み HTTP クライアントの diagnostics channel を計装する。
|
||||
* telemetry 初期化前に読み込まれたモジュールも対象になる。
|
||||
*/
|
||||
export function createHttpClientInstrumentation(deps: HttpClientInstrumentationDeps): () => void {
|
||||
const spans = new WeakMap<ClientRequest, HttpClientSpan>();
|
||||
|
||||
const unsubscribeCreated = deps.subscribe(HTTP_CLIENT_REQUEST_CREATED, (message: unknown) => {
|
||||
const { request } = message as RequestCreatedMessage;
|
||||
const { url, host, port } = getRequestDetails(request);
|
||||
const method = request.method ?? 'GET';
|
||||
const span = deps.tracer.startSpan(method, {
|
||||
kind: deps.spanKindClient,
|
||||
attributes: {
|
||||
'http.request.method': method,
|
||||
'url.full': url,
|
||||
'server.address': host,
|
||||
'server.port': port,
|
||||
},
|
||||
});
|
||||
spans.set(request, span);
|
||||
});
|
||||
|
||||
const unsubscribeResponseFinish = deps.subscribe(HTTP_CLIENT_RESPONSE_FINISH, (message: unknown) => {
|
||||
const { request, response } = message as ResponseFinishMessage;
|
||||
const span = spans.get(request);
|
||||
if (span == null) return;
|
||||
|
||||
const statusCode = response.statusCode;
|
||||
if (statusCode != null) {
|
||||
span.setAttribute('http.response.status_code', statusCode);
|
||||
}
|
||||
if (response.httpVersion != null) {
|
||||
span.setAttribute('network.protocol.version', response.httpVersion);
|
||||
}
|
||||
if (statusCode != null && statusCode >= 400) {
|
||||
span.setAttribute('error.type', String(statusCode));
|
||||
span.setStatus({ code: deps.spanStatusCodeError });
|
||||
}
|
||||
span.end();
|
||||
spans.delete(request);
|
||||
});
|
||||
|
||||
const unsubscribeRequestError = deps.subscribe(HTTP_CLIENT_REQUEST_ERROR, (message: unknown) => {
|
||||
const { request, error } = message as RequestErrorMessage;
|
||||
const span = spans.get(request);
|
||||
if (span == null) return;
|
||||
|
||||
span.recordException(error);
|
||||
span.setAttribute('error.type', getErrorType(error));
|
||||
span.setStatus({ code: deps.spanStatusCodeError });
|
||||
span.end();
|
||||
spans.delete(request);
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribeCreated();
|
||||
unsubscribeResponseFinish();
|
||||
unsubscribeRequestError();
|
||||
};
|
||||
}
|
||||
|
||||
export function installHttpClientInstrumentation(deps: Omit<HttpClientInstrumentationDeps, 'subscribe'>): () => void {
|
||||
return createHttpClientInstrumentation({
|
||||
...deps,
|
||||
subscribe: (name, listener) => {
|
||||
const diagnosticChannel = channel(name);
|
||||
diagnosticChannel.subscribe(listener);
|
||||
return () => diagnosticChannel.unsubscribe(listener);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getRequestDetails(request: ClientRequest): { url: string; host: string; port: number } {
|
||||
const protocol = request.protocol ?? 'http:';
|
||||
const host = request.getHeader('host')?.toString() ?? request.host ?? 'localhost';
|
||||
const url = new URL(request.path || '/', `${protocol}//${host}`);
|
||||
// URL 属性には認証情報やクエリ文字列を含めない。
|
||||
url.username = '';
|
||||
url.password = '';
|
||||
url.search = '';
|
||||
url.hash = '';
|
||||
|
||||
return {
|
||||
url: url.toString(),
|
||||
host: url.hostname,
|
||||
// URL.port は既定ポートでは空文字列になるため、スキームから補う。
|
||||
port: url.port === '' ? (url.protocol === 'https:' ? 443 : 80) : Number(url.port),
|
||||
};
|
||||
}
|
||||
|
||||
function getErrorType(error: Error): string {
|
||||
// Node.js の system error code は安定した低カーディナリティの識別子になる。
|
||||
const code = (error as NodeJS.ErrnoException).code;
|
||||
return code ?? error.name;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { injectTraceContext } from './telemetry-registry.js';
|
||||
import { injectQueueTraceContext } from './queue-trace-context.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
|
||||
/**
|
||||
* Queue の add/addBulk をラップし、全ての BullMQ enqueue 経路を一箇所で捕捉する。
|
||||
* QueueService を通さず直接 add/addBulk する呼び出し元もあるため、それぞれで注入すると漏れやすい。
|
||||
*/
|
||||
export function instrumentQueue<T extends object>(queue: Bull.Queue<T>): Bull.Queue<T> {
|
||||
// BullMQ のメソッドは Queue インスタンスを this として使うため、差し替え前に bind して保持する。
|
||||
const add = queue.add.bind(queue);
|
||||
queue.add = ((name, data, opts) => {
|
||||
// BullMQ が data を Redis 用にシリアライズする前に、enqueue 元の context を内部フィールドへ追加する。
|
||||
injectQueueTraceContext(data, injectTraceContext);
|
||||
return add(name, data, opts);
|
||||
}) as typeof queue.add;
|
||||
|
||||
// addBulk は複数ジョブを一度にシリアライズするので、各 data へ同じ context を注入する。
|
||||
const addBulk = queue.addBulk.bind(queue);
|
||||
queue.addBulk = ((jobs) => {
|
||||
for (const job of jobs) {
|
||||
injectQueueTraceContext(job.data, injectTraceContext);
|
||||
}
|
||||
return addBulk(jobs);
|
||||
}) as typeof queue.addBulk;
|
||||
|
||||
return queue;
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Context, PropagationAPI, Span, SpanContext, SpanOptions, SpanStatusCode, Tracer } from '@opentelemetry/api';
|
||||
|
||||
/*
|
||||
* enqueue (push) から worker による取得・処理 (pop) までをテレメトリ上で関連付け、
|
||||
* Queue を挟む非同期処理を一連の流れとして追跡できるようにする。
|
||||
* そのため、trace context を次の流れで伝播する:
|
||||
*
|
||||
* 1. producer 側で active context を W3C Trace Context 形式の carrier へ注入する。
|
||||
* 2. carrier をジョブデータの内部フィールドに保存し、BullMQ/Redis 経由で worker へ渡す。
|
||||
* 3. worker 側で carrier を context へ戻し、設定に応じて Link または parent に使う。
|
||||
*
|
||||
* OTel API への依存を引数にしているのは、OTel 単体構成と Sentry + OTLP 構成で
|
||||
* 同じ伝播処理を使うため。
|
||||
*/
|
||||
/** Redis 上のジョブデータにだけ保存する、OpenTelemetry propagator 用の carrier。 */
|
||||
export type QueueTraceContextCarrier = Record<string, string>;
|
||||
export type QueueTraceContextMode = 'link' | 'parent';
|
||||
|
||||
// 通常のジョブプロセッサが参照しない Misskey 内部フィールドとして、ユーザー定義の data と区別する。
|
||||
const QUEUE_TRACE_CONTEXT_KEY = '__misskeyTraceContext';
|
||||
|
||||
export type QueueTraceContextDeps = {
|
||||
tracer: Pick<Tracer, 'startActiveSpan'>;
|
||||
propagation: Pick<PropagationAPI, 'extract' | 'inject'>;
|
||||
trace: {
|
||||
getSpanContext(context: Context): SpanContext | undefined;
|
||||
};
|
||||
getActiveContext: () => Context;
|
||||
rootContext: Context;
|
||||
mode: QueueTraceContextMode;
|
||||
spanStatusCodeError: SpanStatusCode;
|
||||
};
|
||||
|
||||
export type QueueSpanContext = {
|
||||
options: SpanOptions;
|
||||
parentContext: Context;
|
||||
};
|
||||
|
||||
type QueueSpanContextDeps = Pick<QueueTraceContextDeps, 'propagation' | 'trace' | 'rootContext' | 'mode'>;
|
||||
|
||||
/**
|
||||
* enqueue 元の active context を、ジョブ本来のデータを壊さない内部フィールドとして保持する。
|
||||
* propagator が何も注入しなかった場合は、Redis に不要な空オブジェクトを残さない。
|
||||
*/
|
||||
export function injectQueueTraceContext(data: unknown, inject: (carrier: QueueTraceContextCarrier) => void): void {
|
||||
// BullMQ の型定義外から渡される値も考慮し、書き込めない値は無視する。
|
||||
if (data == null || typeof data !== 'object') return;
|
||||
|
||||
const carrier: QueueTraceContextCarrier = {};
|
||||
inject(carrier);
|
||||
|
||||
// active span が無い場合、propagator は何も注入しない。空の内部フィールドは Redis に保存しない。
|
||||
if (Object.keys(carrier).length === 0) return;
|
||||
Object.assign(data, { [QUEUE_TRACE_CONTEXT_KEY]: carrier });
|
||||
}
|
||||
|
||||
/** 現在実行中の span を propagator の標準形式で carrier へ書き出す。 */
|
||||
export function injectActiveTraceContext(deps: QueueTraceContextDeps, carrier: QueueTraceContextCarrier): void {
|
||||
deps.propagation.inject(deps.getActiveContext(), carrier);
|
||||
}
|
||||
|
||||
/**
|
||||
* ジョブに保存された carrier から、worker span の開始に必要な context と options を組み立てる。
|
||||
*
|
||||
* - parent: enqueue span の子として同じ trace を継続する。
|
||||
* - link: worker span を別の root trace にし、enqueue span への関連だけを Link に残す。
|
||||
*
|
||||
* link モードで trace を分けることで、worker 側の sampling 判定を enqueue 側から独立させられる。
|
||||
*/
|
||||
export function getQueueSpanContext(data: unknown, deps: QueueSpanContextDeps): QueueSpanContext | undefined {
|
||||
const carrier = getQueueTraceContextCarrier(data);
|
||||
if (carrier == null) return undefined;
|
||||
|
||||
// Redis から復元した carrier は別プロセス由来なので、現在の context ではなく ROOT_CONTEXT から展開する。
|
||||
const extractedContext = deps.propagation.extract(deps.rootContext, carrier);
|
||||
if (deps.mode === 'parent') {
|
||||
return {
|
||||
options: {},
|
||||
parentContext: extractedContext,
|
||||
};
|
||||
}
|
||||
|
||||
// Link が受け取るのは Context ではなく SpanContext なので、extract 後に取り出す。
|
||||
const spanContext = deps.trace.getSpanContext(extractedContext);
|
||||
return {
|
||||
options: {
|
||||
root: true,
|
||||
...(spanContext != null ? { links: [{ context: spanContext }] } : {}),
|
||||
},
|
||||
parentContext: deps.rootContext,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* context を持つジョブは Link/parent の規則で span を開始する。
|
||||
* デプロイ前に enqueue されたジョブなど、context を持たない場合は既存の adapter 固有実装へ委ねる。
|
||||
*/
|
||||
export function startSpanWithQueueTraceContext<T>(
|
||||
deps: QueueTraceContextDeps,
|
||||
name: string,
|
||||
jobData: object,
|
||||
fn: () => T,
|
||||
fallback: () => T,
|
||||
): T {
|
||||
const spanContext = getQueueSpanContext(jobData, deps);
|
||||
if (spanContext == null) return fallback();
|
||||
|
||||
return deps.tracer.startActiveSpan(name, spanContext.options, spanContext.parentContext, span => executeSpan(span, fn, deps.spanStatusCodeError));
|
||||
}
|
||||
|
||||
/**
|
||||
* 既存の TelemetryAdapter 契約に合わせ、同期値と Promise のどちらを返す処理も span で包む。
|
||||
* 成功・失敗のどちらでも処理完了まで span を開き、必ず一度だけ閉じる。
|
||||
*/
|
||||
export function executeSpan<T>(span: Span, fn: () => T, spanStatusCodeError: SpanStatusCode): T {
|
||||
try {
|
||||
const result = fn();
|
||||
if (isPromiseLike(result)) {
|
||||
// fn() の戻り値は T のまま保ちつつ、Promise の settle 時に span を閉じる。
|
||||
return result.then(
|
||||
value => {
|
||||
span.end();
|
||||
return value;
|
||||
},
|
||||
error => {
|
||||
recordSpanError(span, error, spanStatusCodeError);
|
||||
span.end();
|
||||
throw error;
|
||||
},
|
||||
) as T;
|
||||
}
|
||||
|
||||
span.end();
|
||||
return result;
|
||||
} catch (error) {
|
||||
// fn() が同期的に throw した場合も、Promise の reject と同じ形で記録して呼び出し元へ戻す。
|
||||
recordSpanError(span, error, spanStatusCodeError);
|
||||
span.end();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/** Error 以外の throw 値も OTel exporter が扱える例外に正規化し、span をエラー状態にする。 */
|
||||
export function recordSpanError(span: Span, error: unknown, spanStatusCodeError: SpanStatusCode): void {
|
||||
const exception = error instanceof Error ? error : new Error(String(error));
|
||||
span.recordException(exception);
|
||||
span.setStatus({
|
||||
code: spanStatusCodeError,
|
||||
message: exception.message,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 未設定時は、enqueue と worker の sampling を分離できる link を使う。
|
||||
* 設定ミスを無言でフォールバックさせないため、未知の値は起動時にエラーにする。
|
||||
*/
|
||||
export function getQueueTraceContextMode(mode: unknown): QueueTraceContextMode {
|
||||
if (mode == null || mode === 'link') return 'link';
|
||||
if (mode === 'parent') return 'parent';
|
||||
throw new Error('otelForBackend.jobTraceContextMode must be either \'link\' or \'parent\'.');
|
||||
}
|
||||
|
||||
function getQueueTraceContextCarrier(data: unknown): QueueTraceContextCarrier | undefined {
|
||||
if (data == null || typeof data !== 'object') return undefined;
|
||||
const carrier = (data as Record<string, unknown>)[QUEUE_TRACE_CONTEXT_KEY];
|
||||
if (carrier == null || typeof carrier !== 'object' || Array.isArray(carrier)) return undefined;
|
||||
|
||||
// Redis 上の旧いジョブや壊れたデータで worker を落とさないよう、propagator に渡せる string map だけを受け入れる。
|
||||
const entries = Object.entries(carrier);
|
||||
if (entries.length === 0 || entries.some(([, value]) => typeof value !== 'string')) return undefined;
|
||||
return Object.fromEntries(entries) as QueueTraceContextCarrier;
|
||||
}
|
||||
|
||||
function isPromiseLike<T>(value: T): value is T & PromiseLike<Awaited<T>> {
|
||||
// native Promise に限らず thenable も span の完了を待てるよう、instanceof ではなく then の有無で判定する。
|
||||
return value != null && typeof (value as { then?: unknown }).then === 'function';
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { tracingChannel } from 'node:diagnostics_channel';
|
||||
import { context, trace } from '@opentelemetry/api';
|
||||
import type { Span, SpanKind, SpanStatusCode, Tracer } from '@opentelemetry/api';
|
||||
|
||||
type IORedisCommandContext = {
|
||||
command: string;
|
||||
args: string[];
|
||||
database: number;
|
||||
serverAddress: string;
|
||||
serverPort: number | undefined;
|
||||
};
|
||||
|
||||
type IORedisConnectContext = {
|
||||
serverAddress: string;
|
||||
serverPort: number | undefined;
|
||||
};
|
||||
|
||||
type TracingChannelSubscribers<T extends object> = {
|
||||
start(message: T): void;
|
||||
end(message: T & { error?: unknown }): void;
|
||||
asyncStart(message: T & { error?: unknown }): void;
|
||||
asyncEnd(message: T & { error?: unknown }): void;
|
||||
error(message: T & { error: unknown }): void;
|
||||
};
|
||||
|
||||
type TracingChannel<T extends object> = {
|
||||
subscribe(subscribers: TracingChannelSubscribers<T>): void;
|
||||
unsubscribe(subscribers: TracingChannelSubscribers<T>): void;
|
||||
};
|
||||
|
||||
type RedisInstrumentationDeps = {
|
||||
tracingChannel<T extends object>(name: string): TracingChannel<T>;
|
||||
tracer: Pick<Tracer, 'startSpan'>;
|
||||
getActiveSpan(): Span | undefined;
|
||||
spanKindClient: SpanKind;
|
||||
spanStatusCodeError: SpanStatusCode;
|
||||
};
|
||||
|
||||
type RedisInstrumentationOptions = {
|
||||
captureCommandSpans?: boolean;
|
||||
/** requireParentSpan is the official ioredis instrumentation's default. */
|
||||
requireParentSpan?: boolean;
|
||||
captureConnectionSpans?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* ioredis 5.11以降が公開する native diagnostics channel を購読する。
|
||||
* バンドル後もioredis自身が発行するイベントを使うため、require hook に
|
||||
* 依存せず、ESM import 経路でもコマンド span を取得できる。
|
||||
*/
|
||||
export function installRedisInstrumentation(
|
||||
tracer: Pick<Tracer, 'startSpan'>,
|
||||
spanKindClient: SpanKind,
|
||||
spanStatusCodeError: SpanStatusCode,
|
||||
options: RedisInstrumentationOptions = {},
|
||||
): () => void {
|
||||
return createRedisInstrumentation({
|
||||
tracingChannel,
|
||||
tracer,
|
||||
getActiveSpan: () => trace.getSpan(context.active()),
|
||||
spanKindClient,
|
||||
spanStatusCodeError,
|
||||
}, options);
|
||||
}
|
||||
|
||||
export function createRedisInstrumentation(deps: RedisInstrumentationDeps, options: RedisInstrumentationOptions = {}): () => void {
|
||||
const requireParentSpan = options.requireParentSpan ?? true;
|
||||
const cleanup: Array<() => void> = [];
|
||||
if (options.captureCommandSpans === true) {
|
||||
const commandChannel = deps.tracingChannel<IORedisCommandContext>('ioredis:command');
|
||||
const commandSubscribers = createTracingChannelSubscribers(commandChannel, deps, requireParentSpan, message => ({
|
||||
name: message.command,
|
||||
attributes: {
|
||||
'db.system.name': 'redis',
|
||||
'db.namespace': message.database.toString(10),
|
||||
'db.operation.name': message.command,
|
||||
'server.address': message.serverAddress,
|
||||
...(message.serverPort != null ? { 'server.port': message.serverPort } : {}),
|
||||
},
|
||||
}));
|
||||
cleanup.push(() => commandChannel.unsubscribe(commandSubscribers));
|
||||
}
|
||||
if (options.captureConnectionSpans === true) {
|
||||
const connectChannel = deps.tracingChannel<IORedisConnectContext>('ioredis:connect');
|
||||
// Connection spans are explicitly opt-in and should include startup and reconnect attempts.
|
||||
const connectSubscribers = createTracingChannelSubscribers(connectChannel, deps, false, message => ({
|
||||
name: 'connect',
|
||||
attributes: {
|
||||
'db.system.name': 'redis',
|
||||
'db.operation.name': 'connect',
|
||||
'server.address': message.serverAddress,
|
||||
...(message.serverPort != null ? { 'server.port': message.serverPort } : {}),
|
||||
},
|
||||
}));
|
||||
cleanup.push(() => connectChannel.unsubscribe(connectSubscribers));
|
||||
}
|
||||
|
||||
return () => {
|
||||
for (const unsubscribe of cleanup) {
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createTracingChannelSubscribers<T extends object>(
|
||||
channel: TracingChannel<T>,
|
||||
deps: RedisInstrumentationDeps,
|
||||
requireParentSpan: boolean,
|
||||
getSpanOptions: (message: T) => { name: string; attributes: Record<string, string | number> },
|
||||
): TracingChannelSubscribers<T> {
|
||||
const spans = new WeakMap<object, { span: Span; recordedError: boolean }>();
|
||||
|
||||
const recordError = (state: { span: Span; recordedError: boolean }, value: unknown): void => {
|
||||
if (state.recordedError) return;
|
||||
const error = toError(value);
|
||||
state.span.recordException(error);
|
||||
state.span.setStatus({ code: deps.spanStatusCodeError, message: error.message });
|
||||
state.span.setAttribute('error.type', getErrorType(error));
|
||||
const statusCode = getRedisErrorStatusCode(error.message);
|
||||
if (statusCode != null) state.span.setAttribute('db.response.status_code', statusCode);
|
||||
state.recordedError = true;
|
||||
};
|
||||
|
||||
const finish = (message: T & { error?: unknown }): void => {
|
||||
const state = spans.get(message);
|
||||
if (state == null) return;
|
||||
|
||||
if (message.error != null) {
|
||||
recordError(state, message.error);
|
||||
}
|
||||
state.span.end();
|
||||
spans.delete(message);
|
||||
};
|
||||
|
||||
const subscribers: TracingChannelSubscribers<T> = {
|
||||
start: (message) => {
|
||||
if (requireParentSpan && deps.getActiveSpan() == null) return;
|
||||
|
||||
const options = getSpanOptions(message);
|
||||
const span = deps.tracer.startSpan(options.name, {
|
||||
kind: deps.spanKindClient,
|
||||
attributes: options.attributes,
|
||||
});
|
||||
spans.set(message, { span, recordedError: false });
|
||||
},
|
||||
// Promiseを返すコマンドでは完了前にもendイベントが来るため、同期例外だけここで閉じる。
|
||||
end: (message) => {
|
||||
if (message.error != null) finish(message);
|
||||
},
|
||||
asyncStart: () => {},
|
||||
asyncEnd: finish,
|
||||
error: (message) => {
|
||||
const state = spans.get(message);
|
||||
if (state == null) return;
|
||||
recordError(state, message.error);
|
||||
},
|
||||
};
|
||||
|
||||
channel.subscribe(subscribers);
|
||||
return subscribers;
|
||||
}
|
||||
|
||||
function toError(value: unknown): Error {
|
||||
return value instanceof Error ? value : new Error(String(value));
|
||||
}
|
||||
|
||||
function getRedisErrorStatusCode(message: string): string | undefined {
|
||||
return message.match(/^([A-Z][A-Z0-9_]*)\b/)?.[1];
|
||||
}
|
||||
|
||||
function getErrorType(error: Error): string {
|
||||
return (error as NodeJS.ErrnoException).code ?? error.name;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import Logger from '@/logger.js';
|
||||
import type { DiagAPI, DiagLogger, DiagLogLevel } from '@opentelemetry/api';
|
||||
|
||||
export function registerDiagLogger(
|
||||
diagApi: DiagAPI,
|
||||
diagLogLevelWarn: DiagLogLevel,
|
||||
): void {
|
||||
// diagはプロセスグローバルなので、通常運用で必要なWARN以上だけをMisskeyのログに流す。
|
||||
const logger = new Logger('otel', 'green');
|
||||
const diagLogger: DiagLogger = {
|
||||
error: (message, ...args) => logger.error(formatDiagMessage(message, args)),
|
||||
warn: (message, ...args) => logger.warn(formatDiagMessage(message, args)),
|
||||
info: (message, ...args) => logger.info(formatDiagMessage(message, args)),
|
||||
debug: (message, ...args) => logger.debug(formatDiagMessage(message, args)),
|
||||
verbose: (message, ...args) => logger.debug(formatDiagMessage(message, args)),
|
||||
};
|
||||
|
||||
diagApi.setLogger(diagLogger, {
|
||||
logLevel: diagLogLevelWarn,
|
||||
suppressOverrideMessage: true,
|
||||
});
|
||||
}
|
||||
|
||||
function formatDiagMessage(message: string, args: unknown[]): string {
|
||||
if (args.length === 0) return message;
|
||||
return `${message} ${args.map(arg => {
|
||||
if (arg instanceof Error) return arg.stack ?? arg.message;
|
||||
if (typeof arg === 'string') return arg;
|
||||
try {
|
||||
return JSON.stringify(arg);
|
||||
} catch {
|
||||
return String(arg);
|
||||
}
|
||||
}).join(' ')}`;
|
||||
}
|
||||
@@ -5,10 +5,8 @@
|
||||
|
||||
import type { Config } from '@/config.js';
|
||||
import { setLogTraceContextProvider } from '@/logging/logging-runtime.js';
|
||||
import { OpenTelemetryAdapter } from './adapters/OpenTelemetryAdapter.js';
|
||||
import { SentryTelemetryAdapter } from './adapters/SentryTelemetryAdapter.js';
|
||||
import type { OtelBackendRuntimeConfig, TelemetryAdapter, TelemetryCaptureMessageOptions } from './adapters/TelemetryAdapter.js';
|
||||
import type { QueueTraceContextCarrier } from './queue-trace-context.js';
|
||||
import type { TelemetryAdapter, TelemetryCaptureMessageOptions } from './adapters/TelemetryAdapter.js';
|
||||
|
||||
/**
|
||||
* NestのDIコンテナが構築される前(boot処理内)で初期化する必要があるため、
|
||||
@@ -18,24 +16,8 @@ import type { QueueTraceContextCarrier } from './queue-trace-context.js';
|
||||
const adapters: TelemetryAdapter[] = [];
|
||||
|
||||
export async function initTelemetry(config: Config): Promise<void> {
|
||||
const otelForBackend: OtelBackendRuntimeConfig | undefined = config.otelForBackend == null ? undefined : {
|
||||
...config.otelForBackend,
|
||||
serviceVersion: config.version,
|
||||
};
|
||||
|
||||
// SentryとOTelを同時に使う場合はproviderを分けず、Sentry側へOTLP processorを追加する。
|
||||
let adapter: TelemetryAdapter | undefined;
|
||||
if (config.sentryForBackend && otelForBackend) {
|
||||
adapter = await SentryTelemetryAdapter.createWithOtlpExport(config.sentryForBackend, otelForBackend);
|
||||
} else if (config.sentryForBackend) {
|
||||
// Sentry単体時は既存のSentry adapterだけを登録する。
|
||||
adapter = await SentryTelemetryAdapter.create(config.sentryForBackend);
|
||||
} else if (otelForBackend) {
|
||||
// OTel単体時だけMisskey自身でNodeTracerProviderを立てる。
|
||||
adapter = await OpenTelemetryAdapter.create(otelForBackend);
|
||||
}
|
||||
|
||||
if (adapter != null) {
|
||||
if (config.sentryForBackend) {
|
||||
const adapter = await SentryTelemetryAdapter.create(config.sentryForBackend);
|
||||
adapters.push(adapter);
|
||||
// Telemetryの初期化後に登録し、初期化前のBootstrapログは従来どおり出力する。
|
||||
setLogTraceContextProvider(() => adapter.getActiveTraceContext?.());
|
||||
@@ -63,19 +45,6 @@ export function startSpan<T>(name: string, fn: () => T): T {
|
||||
return wrapped();
|
||||
}
|
||||
|
||||
export function injectTraceContext(carrier: QueueTraceContextCarrier): void {
|
||||
// Queue の carrier は共有データなので、通知と異なり全 adapter にブロードキャストしない。
|
||||
// OTel provider は現在 1 つだけなので、同じ header を上書きしないよう最初の対応 adapter だけを使う。
|
||||
adapters.find(adapter => adapter.injectTraceContext != null)?.injectTraceContext?.(carrier);
|
||||
}
|
||||
|
||||
export function startSpanWithTraceContext<T>(name: string, jobData: object, fn: () => T): T {
|
||||
// Queue context を解釈できる adapter に span 作成を任せる。
|
||||
// 対応 adapter が無い構成では通常の startSpan へフォールバックする。
|
||||
const adapter = adapters.find(adapter => adapter.startSpanWithTraceContext != null);
|
||||
return adapter?.startSpanWithTraceContext?.(name, jobData, fn) ?? startSpan(name, fn);
|
||||
}
|
||||
|
||||
export async function shutdownTelemetry(): Promise<void> {
|
||||
// 終了時は登録済みadapterを並列にflush/shutdownする。
|
||||
await Promise.allSettled(adapters.map(adapter => adapter.shutdown()));
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/**
|
||||
* Telemetry-specific shutdown is implemented by telemetry-registry.ts.
|
||||
* Signal coordination belongs to boot/shutdown-handler.ts so telemetry and
|
||||
* logging remain independent domains.
|
||||
*/
|
||||
export { shutdownTelemetry } from './telemetry-registry.js';
|
||||
@@ -20,6 +20,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public mentionedUserIds: MiUser['id'][];
|
||||
@@ -32,6 +33,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public mentionedLocalUserIds: MiUser['id'][];
|
||||
@@ -44,6 +46,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public mentionedRemoteUserIds: MiUser['id'][];
|
||||
@@ -56,6 +59,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public attachedUserIds: MiUser['id'][];
|
||||
@@ -68,6 +72,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public attachedLocalUserIds: MiUser['id'][];
|
||||
@@ -80,6 +85,7 @@ export class MiHashtag {
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
default: [],
|
||||
array: true,
|
||||
})
|
||||
public attachedRemoteUserIds: MiUser['id'][];
|
||||
|
||||
@@ -11,7 +11,7 @@ import type Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { TelemetryService } from '@/core/telemetry/TelemetryService.js';
|
||||
import { CheckModeratorsActivityProcessorService } from '@/queue/processors/CheckModeratorsActivityProcessorService.js';
|
||||
import { runQueueJobWithTraceContext } from './queue-job-runner.js';
|
||||
import { runQueueJob } from './queue-job-runner.js';
|
||||
import { UserWebhookDeliverProcessorService } from './processors/UserWebhookDeliverProcessorService.js';
|
||||
import { SystemWebhookDeliverProcessorService } from './processors/SystemWebhookDeliverProcessorService.js';
|
||||
import { EndedPollNotificationProcessorService } from './processors/EndedPollNotificationProcessorService.js';
|
||||
@@ -159,8 +159,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
};
|
||||
}
|
||||
|
||||
// 以下の各 Worker は job.data に保存された enqueue 元の trace context を復元し、
|
||||
// ジョブの実処理全体を Link または parent の worker span で囲む。
|
||||
// 以下の各 Worker はジョブの実処理全体を worker span で囲む。
|
||||
//#region system
|
||||
{
|
||||
const processer = (job: Bull.Job) => {
|
||||
@@ -180,10 +179,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('system');
|
||||
|
||||
this.systemQueueWorker = new Bull.Worker(QUEUE.SYSTEM, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: System: ' + job.name,
|
||||
job.data,
|
||||
() => processer(job) as Promise<void>,
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
@@ -235,10 +233,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('db');
|
||||
|
||||
this.dbQueueWorker = new Bull.Worker(QUEUE.DB, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: DB: ' + job.name,
|
||||
job.data,
|
||||
() => processer(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
@@ -266,10 +263,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('deliver');
|
||||
|
||||
this.deliverQueueWorker = new Bull.Worker(QUEUE.DELIVER, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: Deliver',
|
||||
job.data,
|
||||
() => this.deliverProcessorService.process(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) ${getJobInfo(job)} to=${job.data.to}`, { e: renderError(err) });
|
||||
@@ -305,10 +301,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('inbox');
|
||||
|
||||
this.inboxQueueWorker = new Bull.Worker(QUEUE.INBOX, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: Inbox',
|
||||
job.data,
|
||||
() => this.inboxProcessorService.process(job),
|
||||
err => {
|
||||
const activityId = job.data.activity ? job.data.activity.id : 'none';
|
||||
@@ -345,10 +340,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('user-webhook');
|
||||
|
||||
this.userWebhookDeliverQueueWorker = new Bull.Worker(QUEUE.USER_WEBHOOK_DELIVER, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: UserWebhookDeliver',
|
||||
job.data,
|
||||
() => this.userWebhookDeliverProcessorService.process(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) ${getJobInfo(job)} to=${job.data.to}`, { e: renderError(err) });
|
||||
@@ -384,10 +378,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('system-webhook');
|
||||
|
||||
this.systemWebhookDeliverQueueWorker = new Bull.Worker(QUEUE.SYSTEM_WEBHOOK_DELIVER, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: SystemWebhookDeliver',
|
||||
job.data,
|
||||
() => this.systemWebhookDeliverProcessorService.process(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) ${getJobInfo(job)} to=${job.data.to}`, { e: renderError(err) });
|
||||
@@ -432,10 +425,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('relationship');
|
||||
|
||||
this.relationshipQueueWorker = new Bull.Worker(QUEUE.RELATIONSHIP, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: Relationship: ' + job.name,
|
||||
job.data,
|
||||
() => processer(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
@@ -475,10 +467,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('objectStorage');
|
||||
|
||||
this.objectStorageQueueWorker = new Bull.Worker(QUEUE.OBJECT_STORAGE, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: ObjectStorage: ' + job.name,
|
||||
job.data,
|
||||
() => processer(job) as Promise<void>,
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
@@ -507,10 +498,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('ended-poll-notification');
|
||||
|
||||
this.endedPollNotificationQueueWorker = new Bull.Worker(QUEUE.ENDED_POLL_NOTIFICATION, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: EndedPollNotification',
|
||||
job.data,
|
||||
() => this.endedPollNotificationProcessorService.process(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
@@ -532,10 +522,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
||||
const logger = this.logger.createSubLogger('post-scheduled-note');
|
||||
|
||||
this.postScheduledNoteQueueWorker = new Bull.Worker(QUEUE.POST_SCHEDULED_NOTE, (job) => {
|
||||
return runQueueJobWithTraceContext(
|
||||
return runQueueJob(
|
||||
this.telemetryService,
|
||||
'Queue: PostScheduledNote',
|
||||
job.data,
|
||||
() => this.postScheduledNoteProcessorService.process(job),
|
||||
err => {
|
||||
logger.error(`failed(${err.name}: ${err.message}) id=${job.id}`, { job: renderJob(job), e: renderError(err) });
|
||||
|
||||
@@ -5,17 +5,16 @@
|
||||
|
||||
import type { TelemetryService } from '@/core/telemetry/TelemetryService.js';
|
||||
|
||||
type QueueTelemetryService = Pick<TelemetryService, 'startSpanWithTraceContext'>;
|
||||
type QueueTelemetryService = Pick<TelemetryService, 'startSpan'>;
|
||||
|
||||
/** QueueのprocessorをTrace Context付きで実行し、失敗処理をSpan内で行います。 */
|
||||
export function runQueueJobWithTraceContext<T>(
|
||||
/** Queueのprocessorを実行し、失敗処理をSpan内で行います。 */
|
||||
export function runQueueJob<T>(
|
||||
telemetryService: QueueTelemetryService,
|
||||
spanName: string,
|
||||
jobData: object,
|
||||
processJob: () => T | Promise<T>,
|
||||
onError: (error: Error) => void,
|
||||
): Promise<T> {
|
||||
return telemetryService.startSpanWithTraceContext(spanName, jobData, async (): Promise<T> => {
|
||||
return telemetryService.startSpan(spanName, async (): Promise<T> => {
|
||||
try {
|
||||
return await processJob();
|
||||
} catch (error) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import { HealthServerService } from './HealthServerService.js';
|
||||
import { ClientServerService } from './web/ClientServerService.js';
|
||||
import { OpenApiServerService } from './api/openapi/OpenApiServerService.js';
|
||||
import { OAuth2ProviderService } from './oauth/OAuth2ProviderService.js';
|
||||
import { registerHttpServerInstrumentation } from './http-server-instrumentation.js';
|
||||
import { registerHttpAccessLog } from './http-access-log.js';
|
||||
|
||||
const _dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
@@ -82,7 +81,6 @@ export class ServerService implements OnApplicationShutdown {
|
||||
logger: false,
|
||||
});
|
||||
this.#fastify = fastify;
|
||||
await registerHttpServerInstrumentation(fastify, this.config);
|
||||
registerHttpAccessLog(fastify);
|
||||
|
||||
// HSTS
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ApiError } from '@/server/api/error.js';
|
||||
import type { UsersRepository, UserProfilesRepository, MiMeta } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,10 +26,10 @@ export const meta = {
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'ccafc7fe-5074-4edd-9dc0-8ef9ef6a701d',
|
||||
},
|
||||
cannotResetPasswordOfRootUser: {
|
||||
message: 'Cannot reset password of the root user.',
|
||||
code: 'CANNOT_RESET_PASSWORD_OF_ROOT_USER',
|
||||
id: 'f28fc207-42ca-44c7-a577-44b4f0ec5999',
|
||||
accessDenied: {
|
||||
message: 'Access denied.',
|
||||
code: 'ACCESS_DENIED',
|
||||
id: 'cda8f8ce-89a6-4f92-8055-33bbe0c1464d',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -66,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
@Inject(DI.userProfilesRepository)
|
||||
private userProfilesRepository: UserProfilesRepository,
|
||||
|
||||
private roleService: RoleService,
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
@@ -75,8 +77,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
|
||||
if (this.serverSettings.rootUserId === user.id) {
|
||||
throw new ApiError(meta.errors.cannotResetPasswordOfRootUser);
|
||||
if (await this.roleService.isAdministrator(user) && me.id !== user.id) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
const passwd = secureRndstr(8);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { MiUserProfile } from '@/models/UserProfile.js';
|
||||
import { MiUserSecurityKey } from '@/models/UserSecurityKey.js';
|
||||
import type { UsersRepository } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
|
||||
export const meta = {
|
||||
@@ -26,6 +27,11 @@ export const meta = {
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'ccafc7fe-5074-4edd-9dc0-8ef9ef6a701d',
|
||||
},
|
||||
accessDenied: {
|
||||
message: 'Access denied.',
|
||||
code: 'ACCESS_DENIED',
|
||||
id: 'cda8f8ce-89a6-4f92-8055-33bbe0c1464d',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -46,6 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
||||
private roleService: RoleService,
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
@@ -55,6 +62,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
|
||||
if (await this.roleService.isAdministrator(user) && me.id !== user.id) {
|
||||
throw new ApiError(meta.errors.accessDenied);
|
||||
}
|
||||
|
||||
await this.db.transaction(async (transactionalEntityManager) => {
|
||||
// パスキーを全て削除
|
||||
await transactionalEntityManager.delete(MiUserSecurityKey, { userId: user.id });
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { ChannelsRepository } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { ChannelFollowingService } from '@/core/ChannelFollowingService.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
@@ -25,6 +26,11 @@ export const meta = {
|
||||
code: 'NO_SUCH_CHANNEL',
|
||||
id: 'c0031718-d573-4e85-928e-10039f1fbb68',
|
||||
},
|
||||
alreadyFollowing: {
|
||||
message: 'You are already following that channel.',
|
||||
code: 'ALREADY_FOLLOWING',
|
||||
id: '7db31665-651e-40c1-8e6e-28e9ad829a2d',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -52,7 +58,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
throw new ApiError(meta.errors.noSuchChannel);
|
||||
}
|
||||
|
||||
await this.channelFollowingService.follow(me, channel);
|
||||
try {
|
||||
await this.channelFollowingService.follow(me, channel);
|
||||
} catch (e) {
|
||||
if (e instanceof IdentifiableError) {
|
||||
if (e.id === '6e335e39-0203-4418-a936-b3f2dc987845') throw new ApiError(meta.errors.alreadyFollowing);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,11 @@ import Parser from 'rss-parser';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { HttpRequestService } from '@/core/HttpRequestService.js';
|
||||
import { ApiError } from '../error.js';
|
||||
|
||||
const rssParser = new Parser();
|
||||
const MAX_URL_LENGTH = 8192;
|
||||
const MAX_RESPONSE_SIZE = 1024 * 1024;
|
||||
const MAX_CONCURRENT_REQUESTS = 32;
|
||||
|
||||
export const meta = {
|
||||
tags: ['meta'],
|
||||
@@ -17,6 +20,34 @@ export const meta = {
|
||||
allowGet: true,
|
||||
cacheSec: 60 * 3,
|
||||
|
||||
limit: {
|
||||
duration: 60 * 1000,
|
||||
max: 300,
|
||||
},
|
||||
|
||||
errors: {
|
||||
invalidUrl: {
|
||||
message: 'Invalid URL.',
|
||||
code: 'INVALID_URL',
|
||||
id: '89b7ee05-ccfc-4bdd-9b13-61172fd1e06c',
|
||||
httpStatusCode: 400,
|
||||
},
|
||||
fetchRssFailed: {
|
||||
message: 'Failed to fetch RSS.',
|
||||
code: 'FETCH_RSS_FAILED',
|
||||
id: '8db5d3d8-31d7-452f-b0cc-ca3b8925de12',
|
||||
kind: 'server',
|
||||
httpStatusCode: 422,
|
||||
},
|
||||
fetchRssUnavailable: {
|
||||
message: 'RSS fetching is temporarily unavailable.',
|
||||
code: 'FETCH_RSS_UNAVAILABLE',
|
||||
id: '91e6ff44-c63f-4725-9ad0-b7a40d7f7655',
|
||||
kind: 'server',
|
||||
httpStatusCode: 503,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -215,21 +246,84 @@ export const paramDef = {
|
||||
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
private readonly inFlightRequests = new Map<string, Promise<Awaited<ReturnType<Parser['parseString']>>>>();
|
||||
private activeRequestCount = 0;
|
||||
|
||||
constructor(
|
||||
private httpRequestService: HttpRequestService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const res = await this.httpRequestService.send(ps.url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/rss+xml, */*',
|
||||
},
|
||||
timeout: 5000,
|
||||
});
|
||||
super(meta, paramDef, async (ps) => {
|
||||
const url = this.normalizeUrl(ps.url);
|
||||
const inFlightRequest = this.inFlightRequests.get(url);
|
||||
if (inFlightRequest != null) {
|
||||
return await inFlightRequest;
|
||||
}
|
||||
|
||||
const text = await res.text();
|
||||
if (this.activeRequestCount >= MAX_CONCURRENT_REQUESTS) {
|
||||
throw new ApiError(meta.errors.fetchRssUnavailable);
|
||||
}
|
||||
|
||||
return rssParser.parseString(text);
|
||||
this.activeRequestCount++;
|
||||
const request = this.fetchRss(url)
|
||||
.catch(() => {
|
||||
throw new ApiError(meta.errors.fetchRssFailed);
|
||||
})
|
||||
.finally(() => {
|
||||
this.inFlightRequests.delete(url);
|
||||
this.activeRequestCount--;
|
||||
});
|
||||
this.inFlightRequests.set(url, request);
|
||||
|
||||
return await request;
|
||||
});
|
||||
}
|
||||
|
||||
private normalizeUrl(input: string): string {
|
||||
if (input.length === 0 || input.length > MAX_URL_LENGTH) {
|
||||
throw new ApiError(meta.errors.invalidUrl);
|
||||
}
|
||||
|
||||
let url: URL;
|
||||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
throw new ApiError(meta.errors.invalidUrl);
|
||||
}
|
||||
|
||||
if (
|
||||
(url.protocol !== 'http:' && url.protocol !== 'https:') ||
|
||||
url.username !== '' ||
|
||||
url.password !== ''
|
||||
) {
|
||||
throw new ApiError(meta.errors.invalidUrl);
|
||||
}
|
||||
|
||||
url.hash = '';
|
||||
return url.href;
|
||||
}
|
||||
|
||||
private async fetchRss(url: string): Promise<Awaited<ReturnType<Parser['parseString']>>> {
|
||||
const res = await this.httpRequestService.send(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/rss+xml, */*',
|
||||
},
|
||||
timeout: 5000,
|
||||
size: MAX_RESPONSE_SIZE,
|
||||
});
|
||||
|
||||
const finalUrl = new URL(res.url);
|
||||
if (finalUrl.protocol !== 'http:' && finalUrl.protocol !== 'https:') {
|
||||
throw new Error('Invalid final URL protocol');
|
||||
}
|
||||
|
||||
const text = await res.text();
|
||||
const rssParser = new Parser({
|
||||
xml2js: {
|
||||
async: true,
|
||||
},
|
||||
});
|
||||
|
||||
return await rssParser.parseString(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ export function registerHttpAccessLog(fastify: FastifyInstance, manager: LogMana
|
||||
|
||||
const states = new WeakMap<object, AccessRequestState>();
|
||||
|
||||
// HTTP計装の後に登録し、リクエスト開始時のactiveなTrace Contextを保存します。
|
||||
// リクエスト開始時のactiveなTrace Contextを保存します。
|
||||
fastify.addHook('onRequest', (request, _reply, done) => {
|
||||
states.set(request, {
|
||||
traceContext: manager.getActiveTraceContext(),
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { Config } from '@/config.js';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
|
||||
type TelemetryConfig = Pick<Config, 'otelForBackend' | 'sentryForBackend'>;
|
||||
|
||||
export function shouldRegisterHttpServerInstrumentation(config: TelemetryConfig): boolean {
|
||||
// Sentryもリクエストspanを作成するため、両方を登録すると重複して出力される。
|
||||
return config.otelForBackend != null && config.sentryForBackend == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* すべてのルート・フックより前にリクエスト計装を登録し、ActivityPubや
|
||||
* well-knownを含む全HTTP受信経路を1つのroot spanとして計測する。
|
||||
*/
|
||||
export async function registerHttpServerInstrumentation(fastify: FastifyInstance, config: TelemetryConfig): Promise<void> {
|
||||
if (!shouldRegisterHttpServerInstrumentation(config)) return;
|
||||
|
||||
const { FastifyOtelInstrumentation } = await import('@fastify/otel');
|
||||
const instrumentation = new FastifyOtelInstrumentation({
|
||||
requestHook: (span, request) => {
|
||||
const route = request.routeOptions.url;
|
||||
if (route != null) {
|
||||
// デフォルトだとトレース名が「request」で固定されてしまうため、判別がつかなくなる。
|
||||
// ルート名をspan名に設定することで、トレースビューでルートごとの処理時間を確認できるようになる。
|
||||
span.updateName(`${request.method} ${route}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
await fastify.register(instrumentation.plugin());
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { describe, beforeAll, test } from 'vitest';
|
||||
import { api, castAsError, signup } from '../utils.js';
|
||||
import type * as misskey from 'misskey-js';
|
||||
|
||||
describe('Channel', () => {
|
||||
let alice: misskey.entities.SignupResponse;
|
||||
beforeAll(async () => {
|
||||
alice = await signup({ username: 'alice' });
|
||||
});
|
||||
|
||||
describe('Follow', () => {
|
||||
let channel: misskey.entities.ChannelsCreateResponse;
|
||||
|
||||
beforeAll(async () => {
|
||||
const res = await api('channels/create', { name: 'follow-test-channel' }, alice);
|
||||
channel = res.body;
|
||||
});
|
||||
|
||||
test('フォローしているチャンネルを再度フォローするとALREADY_FOLLOWINGエラーになる', async () => {
|
||||
const res1 = await api('channels/follow', { channelId: channel.id }, alice);
|
||||
assert.strictEqual(res1.status, 204);
|
||||
|
||||
const res2 = await api('channels/follow', { channelId: channel.id }, alice);
|
||||
assert.strictEqual(res2.status, 400);
|
||||
assert.strictEqual(castAsError(res2.body as any).error.code, 'ALREADY_FOLLOWING');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { Queue, Worker } from 'bullmq';
|
||||
import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
|
||||
import { InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
||||
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
||||
import { loadConfig } from '@/config.js';
|
||||
import { installRedisInstrumentation } from '@/core/telemetry/redis-instrumentation.js';
|
||||
|
||||
const config = loadConfig();
|
||||
|
||||
describe('Redis telemetry instrumentation', () => {
|
||||
test('records Redis spans below HTTP and BullMQ worker spans without Redis arguments', async () => {
|
||||
const exporter = new InMemorySpanExporter();
|
||||
const provider = new NodeTracerProvider({
|
||||
spanProcessors: [new SimpleSpanProcessor(exporter)],
|
||||
});
|
||||
provider.register();
|
||||
|
||||
const tracer = provider.getTracer('telemetry-redis-instrumentation-test');
|
||||
const uninstall = installRedisInstrumentation(tracer, SpanKind.CLIENT, SpanStatusCode.ERROR, {
|
||||
captureCommandSpans: true,
|
||||
});
|
||||
const queueName = `telemetry-${randomUUID()}`;
|
||||
const prefix = `telemetry-${randomUUID()}`;
|
||||
const connection = {
|
||||
host: config.redis.host,
|
||||
port: config.redis.port,
|
||||
...(config.redis.password != null ? { password: config.redis.password } : {}),
|
||||
};
|
||||
const queue = new Queue(queueName, { connection, prefix });
|
||||
let worker: Worker | undefined;
|
||||
let httpSpanId: string | undefined;
|
||||
let jobSpanId: string | undefined;
|
||||
const secret = `secret-${randomUUID()}`;
|
||||
|
||||
try {
|
||||
const processed = new Promise<void>((resolve, reject) => {
|
||||
worker = new Worker(queueName, async job => {
|
||||
return await tracer.startActiveSpan('Queue: telemetry test', async jobSpan => {
|
||||
jobSpanId = jobSpan.spanContext().spanId;
|
||||
try {
|
||||
// updateData uses BullMQ's worker-side ioredis client.
|
||||
await job.updateData({ secret });
|
||||
return 'ok';
|
||||
} finally {
|
||||
jobSpan.end();
|
||||
}
|
||||
});
|
||||
}, { connection, prefix });
|
||||
worker.once('completed', () => resolve());
|
||||
worker.once('failed', (_job, error) => reject(error));
|
||||
});
|
||||
|
||||
await tracer.startActiveSpan('HTTP POST /telemetry-test', async httpSpan => {
|
||||
httpSpanId = httpSpan.spanContext().spanId;
|
||||
try {
|
||||
// Queue#add uses BullMQ's producer-side ioredis client.
|
||||
await queue.add('probe', { secret });
|
||||
} finally {
|
||||
httpSpan.end();
|
||||
}
|
||||
});
|
||||
await processed;
|
||||
await provider.forceFlush();
|
||||
|
||||
const redisSpans = exporter.getFinishedSpans().filter(span => span.attributes['db.system.name'] === 'redis');
|
||||
expect(redisSpans.some(span => span.parentSpanContext?.spanId === httpSpanId)).toBe(true);
|
||||
expect(redisSpans.some(span => span.parentSpanContext?.spanId === jobSpanId)).toBe(true);
|
||||
for (const span of redisSpans) {
|
||||
expect(span.attributes).not.toHaveProperty('db.statement');
|
||||
expect(span.attributes).not.toHaveProperty('db.query.text');
|
||||
expect(Object.values(span.attributes)).not.toContain(secret);
|
||||
}
|
||||
} finally {
|
||||
await worker?.close();
|
||||
await queue.obliterate({ force: true });
|
||||
await queue.close();
|
||||
uninstall();
|
||||
await provider.shutdown();
|
||||
}
|
||||
}, 30000);
|
||||
});
|
||||
@@ -1,379 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { SpanStatusCode } from '@opentelemetry/api';
|
||||
import { defaultResource, detectResources, envDetector, resourceFromAttributes } from '@opentelemetry/resources';
|
||||
import { ParentBasedSampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
||||
import { ATTR_SERVICE_INSTANCE_ID, ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
|
||||
import type { Context, SpanContext } from '@opentelemetry/api';
|
||||
import { OpenTelemetryAdapter, createResource, createSampler, getMisskeyProcessRole } from '@/core/telemetry/adapters/OpenTelemetryAdapter.js';
|
||||
|
||||
const mocks = vi.hoisted(() => {
|
||||
return {
|
||||
envOption: {
|
||||
disableClustering: false,
|
||||
onlyServer: false,
|
||||
onlyQueue: false,
|
||||
},
|
||||
isPrimary: false,
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@/env.js', () => ({
|
||||
envOption: mocks.envOption,
|
||||
}));
|
||||
|
||||
vi.mock('node:cluster', () => ({
|
||||
default: {
|
||||
get isPrimary() {
|
||||
return mocks.isPrimary;
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
const samplerDeps = {
|
||||
ParentBasedSampler,
|
||||
TraceIdRatioBasedSampler,
|
||||
};
|
||||
|
||||
describe('OpenTelemetryAdapter', () => {
|
||||
test('wraps async work in an active span and ends it after success', async () => {
|
||||
const span = {
|
||||
end: vi.fn(),
|
||||
recordException: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const tracer = {
|
||||
startActiveSpan: vi.fn(async (_name: string, fn: (spanArg: any) => Promise<string>) => fn(span)),
|
||||
} as any;
|
||||
const provider = {
|
||||
shutdown: vi.fn(),
|
||||
};
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer,
|
||||
provider,
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
});
|
||||
|
||||
await expect(adapter.startSpan('API: test', async () => 'ok')).resolves.toBe('ok');
|
||||
|
||||
expect(tracer.startActiveSpan).toHaveBeenCalledWith('API: test', expect.any(Function));
|
||||
expect(span.recordException).not.toHaveBeenCalled();
|
||||
expect(span.setStatus).not.toHaveBeenCalled();
|
||||
expect(span.end).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('records thrown errors on the active span before rethrowing', async () => {
|
||||
const error = new Error('boom');
|
||||
const span = {
|
||||
end: vi.fn(),
|
||||
recordException: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const tracer = {
|
||||
startActiveSpan: vi.fn(async (_name: string, fn: (spanArg: any) => Promise<void>) => fn(span)),
|
||||
} as any;
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer,
|
||||
provider: { shutdown: vi.fn() },
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
});
|
||||
|
||||
await expect(adapter.startSpan('Queue: test', async () => {
|
||||
throw error;
|
||||
})).rejects.toThrow(error);
|
||||
|
||||
expect(span.recordException).toHaveBeenCalledWith(error);
|
||||
expect(span.setStatus).toHaveBeenCalledWith({
|
||||
code: SpanStatusCode.ERROR,
|
||||
message: error.message,
|
||||
});
|
||||
expect(span.end).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('creates a root worker span linked to the enqueue span by default', () => {
|
||||
const span = {
|
||||
end: vi.fn(),
|
||||
recordException: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const rootContext = {} as Context;
|
||||
const extractedContext = {} as Context;
|
||||
const sourceSpanContext = {
|
||||
traceId: '0123456789abcdef0123456789abcdef',
|
||||
spanId: '0123456789abcdef',
|
||||
traceFlags: 1,
|
||||
isRemote: true,
|
||||
} as SpanContext;
|
||||
const propagation = {
|
||||
isPropagationApi: true,
|
||||
inject: vi.fn(),
|
||||
extract(this: { isPropagationApi: boolean }) {
|
||||
if (!this.isPropagationApi) throw new Error('lost propagation API receiver');
|
||||
return extractedContext;
|
||||
},
|
||||
};
|
||||
const tracer = {
|
||||
startActiveSpan: vi.fn((_name: string, _options: unknown, _context: unknown, fn: (spanArg: typeof span) => string) => fn(span)),
|
||||
} as any;
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer,
|
||||
provider: { shutdown: vi.fn() },
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
queueTraceContext: {
|
||||
tracer,
|
||||
propagation: propagation as any,
|
||||
trace: { getSpanContext: () => sourceSpanContext },
|
||||
getActiveContext: () => rootContext,
|
||||
rootContext,
|
||||
mode: 'link',
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
},
|
||||
});
|
||||
|
||||
expect(adapter.startSpanWithTraceContext('Queue: Deliver', {
|
||||
__misskeyTraceContext: {
|
||||
traceparent: '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01',
|
||||
},
|
||||
}, () => 'ok')).toBe('ok');
|
||||
|
||||
expect(tracer.startActiveSpan).toHaveBeenCalledWith('Queue: Deliver', {
|
||||
root: true,
|
||||
links: [{ context: sourceSpanContext }],
|
||||
}, rootContext, expect.any(Function));
|
||||
expect(span.end).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('returns the active span context for log enrichment', () => {
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer: { startActiveSpan: vi.fn() },
|
||||
provider: { shutdown: vi.fn() },
|
||||
getActiveSpan: () => ({
|
||||
spanContext: () => ({
|
||||
traceId: '0123456789abcdef0123456789abcdef',
|
||||
spanId: '0123456789abcdef',
|
||||
traceFlags: 0,
|
||||
}),
|
||||
} as any),
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
});
|
||||
|
||||
expect(adapter.getActiveTraceContext()).toEqual({
|
||||
traceId: '0123456789abcdef0123456789abcdef',
|
||||
spanId: '0123456789abcdef',
|
||||
traceFlags: 0,
|
||||
});
|
||||
});
|
||||
|
||||
test('bridges captureMessage to the active span when one exists', () => {
|
||||
const activeSpan = {
|
||||
recordException: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer: { startActiveSpan: vi.fn() },
|
||||
provider: { shutdown: vi.fn() },
|
||||
getActiveSpan: () => activeSpan as any,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
});
|
||||
|
||||
adapter.captureMessage('Queue failed', {
|
||||
level: 'error',
|
||||
extra: { queue: 'deliver' },
|
||||
});
|
||||
|
||||
expect(activeSpan.recordException).toHaveBeenCalledWith(expect.objectContaining({
|
||||
message: 'Queue failed',
|
||||
}));
|
||||
expect(activeSpan.setStatus).toHaveBeenCalledWith({
|
||||
code: SpanStatusCode.ERROR,
|
||||
message: 'Queue failed',
|
||||
});
|
||||
});
|
||||
|
||||
test('times out shutdown instead of waiting forever', async () => {
|
||||
vi.useFakeTimers();
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer: { startActiveSpan: vi.fn() },
|
||||
provider: { shutdown: vi.fn(() => new Promise<void>(() => {})) },
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 50,
|
||||
});
|
||||
|
||||
const shutdown = adapter.shutdown();
|
||||
await vi.advanceTimersByTimeAsync(50);
|
||||
|
||||
await expect(shutdown).resolves.toBeUndefined();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('clears the shutdown timeout timer once provider.shutdown() resolves first', async () => {
|
||||
vi.useFakeTimers();
|
||||
const clearTimeoutSpy = vi.spyOn(global, 'clearTimeout');
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer: { startActiveSpan: vi.fn() },
|
||||
provider: { shutdown: vi.fn().mockResolvedValue(undefined) },
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 5000,
|
||||
});
|
||||
|
||||
await adapter.shutdown();
|
||||
|
||||
expect(clearTimeoutSpy).toHaveBeenCalled();
|
||||
clearTimeoutSpy.mockRestore();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('captureMessage starts a standalone span to report the error when there is no active span', () => {
|
||||
const reportSpan = {
|
||||
end: vi.fn(),
|
||||
recordException: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const tracer = {
|
||||
startActiveSpan: vi.fn((_name: string, fn: (spanArg: typeof reportSpan) => void) => fn(reportSpan)),
|
||||
};
|
||||
const adapter = new OpenTelemetryAdapter({
|
||||
tracer: tracer as any,
|
||||
provider: { shutdown: vi.fn() },
|
||||
getActiveSpan: () => undefined,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
shutdownTimeout: 10,
|
||||
});
|
||||
|
||||
adapter.captureMessage('Queue: Deliver failed', {
|
||||
level: 'error',
|
||||
extra: { queue: 'deliver' },
|
||||
});
|
||||
|
||||
expect(tracer.startActiveSpan).toHaveBeenCalledWith('captureMessage', expect.any(Function));
|
||||
expect(reportSpan.recordException).toHaveBeenCalledWith(expect.objectContaining({
|
||||
message: 'Queue: Deliver failed',
|
||||
}));
|
||||
expect(reportSpan.setStatus).toHaveBeenCalledWith({
|
||||
code: SpanStatusCode.ERROR,
|
||||
message: 'Queue: Deliver failed',
|
||||
});
|
||||
expect(reportSpan.end).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('createSampler', () => {
|
||||
test('accepts sample rates within [0, 1]', () => {
|
||||
expect(() => createSampler(0, samplerDeps)).not.toThrow();
|
||||
expect(() => createSampler(0.5, samplerDeps)).not.toThrow();
|
||||
expect(() => createSampler(1, samplerDeps)).not.toThrow();
|
||||
});
|
||||
|
||||
test('rejects sample rates outside [0, 1]', () => {
|
||||
expect(() => createSampler(-0.1, samplerDeps)).toThrow();
|
||||
expect(() => createSampler(1.1, samplerDeps)).toThrow();
|
||||
});
|
||||
|
||||
test('rejects NaN instead of silently disabling sampling', () => {
|
||||
expect(() => createSampler(Number.NaN, samplerDeps)).toThrow();
|
||||
});
|
||||
|
||||
test('rejects non-number values that pass through YAML as strings', () => {
|
||||
expect(() => createSampler('0.5' as unknown as number, samplerDeps)).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('createResource', () => {
|
||||
test('lets explicit config override OTEL resource env, and env override Misskey defaults', () => {
|
||||
const previousServiceName = process.env['OTEL_SERVICE_NAME'];
|
||||
const previousResourceAttributes = process.env['OTEL_RESOURCE_ATTRIBUTES'];
|
||||
process.env['OTEL_SERVICE_NAME'] = 'env-service';
|
||||
process.env['OTEL_RESOURCE_ATTRIBUTES'] = [
|
||||
'deployment.environment=staging',
|
||||
'misskey.process.role=env-role',
|
||||
'service.instance.id=env-instance',
|
||||
'env.only=value',
|
||||
].join(',');
|
||||
|
||||
try {
|
||||
const resource = createResource({
|
||||
serviceVersion: '2026.1.0',
|
||||
resourceAttributes: {
|
||||
[ATTR_SERVICE_NAME]: 'config-service',
|
||||
'deployment.environment': 'production',
|
||||
'config.only': 'value',
|
||||
},
|
||||
}, {
|
||||
defaultResource,
|
||||
resourceFromAttributes,
|
||||
detectResources,
|
||||
envDetector,
|
||||
serviceNameAttribute: ATTR_SERVICE_NAME,
|
||||
serviceInstanceIdAttribute: ATTR_SERVICE_INSTANCE_ID,
|
||||
serviceVersionAttribute: ATTR_SERVICE_VERSION,
|
||||
serviceVersion: '2026.1.0',
|
||||
});
|
||||
|
||||
expect(resource.attributes[ATTR_SERVICE_NAME]).toBe('config-service');
|
||||
expect(resource.attributes[ATTR_SERVICE_INSTANCE_ID]).toBe('env-instance');
|
||||
expect(resource.attributes[ATTR_SERVICE_VERSION]).toBe('2026.1.0');
|
||||
expect(resource.attributes['deployment.environment']).toBe('production');
|
||||
expect(resource.attributes['misskey.process.role']).toBe('env-role');
|
||||
expect(resource.attributes['env.only']).toBe('value');
|
||||
expect(resource.attributes['config.only']).toBe('value');
|
||||
} finally {
|
||||
if (previousServiceName == null) {
|
||||
delete process.env['OTEL_SERVICE_NAME'];
|
||||
} else {
|
||||
process.env['OTEL_SERVICE_NAME'] = previousServiceName;
|
||||
}
|
||||
if (previousResourceAttributes == null) {
|
||||
delete process.env['OTEL_RESOURCE_ATTRIBUTES'];
|
||||
} else {
|
||||
process.env['OTEL_RESOURCE_ATTRIBUTES'] = previousResourceAttributes;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('getMisskeyProcessRole', () => {
|
||||
beforeEach(() => {
|
||||
mocks.envOption.disableClustering = false;
|
||||
mocks.envOption.onlyServer = false;
|
||||
mocks.envOption.onlyQueue = false;
|
||||
mocks.isPrimary = false;
|
||||
});
|
||||
|
||||
test('labels non-clustered onlyServer as primary-server', () => {
|
||||
mocks.envOption.disableClustering = true;
|
||||
mocks.envOption.onlyServer = true;
|
||||
expect(getMisskeyProcessRole()).toBe('primary-server');
|
||||
});
|
||||
|
||||
test('labels clustered primary with onlyServer as fork-only', () => {
|
||||
mocks.isPrimary = true;
|
||||
mocks.envOption.onlyServer = true;
|
||||
expect(getMisskeyProcessRole()).toBe('fork-only');
|
||||
});
|
||||
|
||||
test('labels clustered worker running the HTTP server (onlyServer) as worker-server, not worker-queue', () => {
|
||||
mocks.isPrimary = false;
|
||||
mocks.envOption.onlyServer = true;
|
||||
expect(getMisskeyProcessRole()).toBe('worker-server');
|
||||
});
|
||||
|
||||
test('labels clustered worker without onlyServer as worker-queue', () => {
|
||||
mocks.isPrimary = false;
|
||||
mocks.envOption.onlyServer = false;
|
||||
expect(getMisskeyProcessRole()).toBe('worker-queue');
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { SentryTelemetryAdapter, buildSentryIntegrations, buildSentryNodeOptions, buildSentryOtlpInitOptions } from '@/core/telemetry/adapters/SentryTelemetryAdapter.js';
|
||||
import { SentryTelemetryAdapter, buildSentryIntegrations, buildSentryNodeOptions } from '@/core/telemetry/adapters/SentryTelemetryAdapter.js';
|
||||
|
||||
type TestIntegration = Parameters<ReturnType<typeof buildSentryIntegrations>>[0][number];
|
||||
|
||||
@@ -35,9 +35,7 @@ describe('SentryTelemetryAdapter', () => {
|
||||
nodeProfilingIntegration: () => testIntegration('ProfilingIntegration'),
|
||||
});
|
||||
|
||||
const result = integrations([
|
||||
testIntegration('Http'),
|
||||
]);
|
||||
const result = integrations([testIntegration('Http')]);
|
||||
|
||||
expect(result.map((integration: TestIntegration) => integration.name)).toEqual(['Http', 'ProfilingIntegration']);
|
||||
});
|
||||
@@ -50,9 +48,7 @@ describe('SentryTelemetryAdapter', () => {
|
||||
warn,
|
||||
});
|
||||
|
||||
const result = integrations([
|
||||
testIntegration('Http'),
|
||||
]);
|
||||
const result = integrations([testIntegration('Http')]);
|
||||
|
||||
expect(result.map((integration: TestIntegration) => integration.name)).toEqual(['Http']);
|
||||
expect(warn).toHaveBeenCalledWith('Unknown Sentry integration configured in sentryForBackend.disabledIntegrations: Unknown');
|
||||
@@ -77,88 +73,6 @@ describe('SentryTelemetryAdapter', () => {
|
||||
|
||||
expect(options.tracePropagationTargets).toEqual(['^https://internal\\.example/']);
|
||||
});
|
||||
|
||||
test('builds Sentry options that export spans to both Sentry and OTLP', () => {
|
||||
const existingProcessor = { name: 'existingProcessor' };
|
||||
const otlpProcessor = { name: 'otlpProcessor' };
|
||||
|
||||
const result = buildSentryOtlpInitOptions({
|
||||
sentryConfig: {
|
||||
enableNodeProfiling: false,
|
||||
disabledIntegrations: ['Redis'],
|
||||
options: {
|
||||
openTelemetrySpanProcessors: [existingProcessor as any],
|
||||
tracesSampleRate: 0.25,
|
||||
},
|
||||
},
|
||||
otelConfig: { serviceVersion: '2026.1.0' },
|
||||
otlpProcessor,
|
||||
});
|
||||
|
||||
expect(result.tracesSampleRate).toBe(0.25);
|
||||
expect(result.openTelemetrySpanProcessors).toEqual([existingProcessor, otlpProcessor]);
|
||||
// OTel併存時もremoteへtrace headerを漏らさないデフォルトはSentry単体時と揃える。
|
||||
expect(result.tracePropagationTargets).toEqual([]);
|
||||
expect((result.integrations as any)([
|
||||
testIntegration('Http'),
|
||||
testIntegration('Redis'),
|
||||
testIntegration('Postgres'),
|
||||
]).map((integration: TestIntegration) => integration.name)).toEqual(['Http', 'Postgres']);
|
||||
});
|
||||
|
||||
test('does not disable Sentry trace propagation when explicitly enabled for OTel coexistence', () => {
|
||||
const result = buildSentryOtlpInitOptions({
|
||||
sentryConfig: {
|
||||
enableNodeProfiling: false,
|
||||
options: {},
|
||||
},
|
||||
otelConfig: {
|
||||
serviceVersion: '2026.1.0',
|
||||
propagateTraceToRemote: true,
|
||||
},
|
||||
otlpProcessor: { name: 'otlpProcessor' },
|
||||
});
|
||||
|
||||
expect(result.tracePropagationTargets).toBeUndefined();
|
||||
});
|
||||
|
||||
test('honors explicit tracePropagationTargets for OTel coexistence even without propagateTraceToRemote', () => {
|
||||
const result = buildSentryOtlpInitOptions({
|
||||
sentryConfig: {
|
||||
enableNodeProfiling: false,
|
||||
options: {
|
||||
tracePropagationTargets: ['^https://internal\\.example/'],
|
||||
},
|
||||
},
|
||||
otelConfig: { serviceVersion: '2026.1.0' },
|
||||
otlpProcessor: { name: 'otlpProcessor' },
|
||||
});
|
||||
|
||||
expect(result.tracePropagationTargets).toEqual(['^https://internal\\.example/']);
|
||||
});
|
||||
|
||||
test('warns when OTel-only options are ignored in Sentry coexistence mode', () => {
|
||||
const warn = vi.fn();
|
||||
|
||||
buildSentryOtlpInitOptions({
|
||||
sentryConfig: {
|
||||
enableNodeProfiling: false,
|
||||
options: {},
|
||||
},
|
||||
otelConfig: {
|
||||
serviceVersion: '2026.1.0',
|
||||
sampleRate: 0.25,
|
||||
resourceAttributes: {
|
||||
'deployment.environment': 'production',
|
||||
},
|
||||
},
|
||||
otlpProcessor: { name: 'otlpProcessor' },
|
||||
warn,
|
||||
});
|
||||
|
||||
expect(warn).toHaveBeenCalledWith(expect.stringContaining('otelForBackend.sampleRate is ignored'));
|
||||
expect(warn).toHaveBeenCalledWith(expect.stringContaining('otelForBackend.resourceAttributes is ignored'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('SentryTelemetryAdapter trace context', () => {
|
||||
@@ -220,69 +134,3 @@ describe('SentryTelemetryAdapter.shutdown', () => {
|
||||
vi.doUnmock('@sentry/profiling-node');
|
||||
});
|
||||
});
|
||||
|
||||
describe('SentryTelemetryAdapter.createWithOtlpExport', () => {
|
||||
test('registers the OTel diag logger before creating the OTLP exporter', async () => {
|
||||
const init = vi.fn();
|
||||
const close = vi.fn();
|
||||
const setLogger = vi.fn();
|
||||
const nodeProfilingIntegration = vi.fn();
|
||||
const BatchSpanProcessor = vi.fn(function (this: { exporter: unknown }, exporter: unknown) {
|
||||
this.exporter = exporter;
|
||||
});
|
||||
const OTLPTraceExporter = vi.fn(function (this: { options: unknown }, options: unknown) {
|
||||
this.options = options;
|
||||
});
|
||||
|
||||
vi.doMock('@sentry/node', () => ({
|
||||
init,
|
||||
close,
|
||||
}));
|
||||
vi.doMock('@sentry/profiling-node', () => ({
|
||||
nodeProfilingIntegration,
|
||||
}));
|
||||
vi.doMock('@opentelemetry/api', () => ({
|
||||
context: { active: vi.fn() },
|
||||
diag: { setLogger },
|
||||
DiagLogLevel: { WARN: 50 },
|
||||
propagation: { inject: vi.fn(), extract: vi.fn() },
|
||||
ROOT_CONTEXT: {},
|
||||
SpanStatusCode: { ERROR: 2 },
|
||||
trace: { getTracer: vi.fn(), getSpanContext: vi.fn() },
|
||||
}));
|
||||
vi.doMock('@opentelemetry/sdk-trace-base', () => ({
|
||||
BatchSpanProcessor,
|
||||
}));
|
||||
vi.doMock('@opentelemetry/exporter-trace-otlp-proto', () => ({
|
||||
OTLPTraceExporter,
|
||||
}));
|
||||
|
||||
await SentryTelemetryAdapter.createWithOtlpExport({
|
||||
enableNodeProfiling: false,
|
||||
options: {},
|
||||
}, {
|
||||
serviceVersion: '2026.1.0',
|
||||
endpoint: 'http://collector:4318/v1/traces',
|
||||
});
|
||||
|
||||
expect(setLogger).toHaveBeenCalledWith(expect.objectContaining({
|
||||
error: expect.any(Function),
|
||||
warn: expect.any(Function),
|
||||
}), {
|
||||
logLevel: 50,
|
||||
suppressOverrideMessage: true,
|
||||
});
|
||||
expect(OTLPTraceExporter).toHaveBeenCalledWith({
|
||||
url: 'http://collector:4318/v1/traces',
|
||||
});
|
||||
expect(init).toHaveBeenCalledWith(expect.objectContaining({
|
||||
openTelemetrySpanProcessors: [expect.any(Object)],
|
||||
}));
|
||||
|
||||
vi.doUnmock('@sentry/node');
|
||||
vi.doUnmock('@sentry/profiling-node');
|
||||
vi.doUnmock('@opentelemetry/api');
|
||||
vi.doUnmock('@opentelemetry/sdk-trace-base');
|
||||
vi.doUnmock('@opentelemetry/exporter-trace-otlp-proto');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
|
||||
import { createHttpClientInstrumentation } from '@/core/telemetry/http-client-instrumentation.js';
|
||||
|
||||
function request() {
|
||||
return {
|
||||
method: 'POST',
|
||||
protocol: 'https:',
|
||||
path: '/inbox?token=secret',
|
||||
host: 'remote.example',
|
||||
getHeader: vi.fn((name: string) => name === 'host' ? 'user:password@remote.example:8443' : undefined),
|
||||
};
|
||||
}
|
||||
|
||||
describe('http-client-instrumentation', () => {
|
||||
test('creates and completes a sanitized CLIENT span from diagnostics channels', () => {
|
||||
const listeners = new Map<string, (message: unknown) => void>();
|
||||
const span = {
|
||||
end: vi.fn(),
|
||||
recordException: vi.fn(),
|
||||
setAttribute: vi.fn(),
|
||||
setStatus: vi.fn(),
|
||||
};
|
||||
const tracer = { startSpan: vi.fn(() => span) } as any;
|
||||
const unsubscribe = createHttpClientInstrumentation({
|
||||
tracer,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
subscribe: (name, listener) => {
|
||||
listeners.set(name, listener);
|
||||
return () => listeners.delete(name);
|
||||
},
|
||||
});
|
||||
const clientRequest = request();
|
||||
|
||||
listeners.get('http.client.request.created')!({ request: clientRequest });
|
||||
listeners.get('http.client.response.finish')!({
|
||||
request: clientRequest,
|
||||
response: { statusCode: 201, httpVersion: '1.1' },
|
||||
});
|
||||
|
||||
expect(tracer.startSpan).toHaveBeenCalledWith('POST', {
|
||||
kind: SpanKind.CLIENT,
|
||||
attributes: {
|
||||
'http.request.method': 'POST',
|
||||
'url.full': 'https://remote.example:8443/inbox',
|
||||
'server.address': 'remote.example',
|
||||
'server.port': 8443,
|
||||
},
|
||||
});
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('http.response.status_code', 201);
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('network.protocol.version', '1.1');
|
||||
expect(span.end).toHaveBeenCalledTimes(1);
|
||||
unsubscribe();
|
||||
expect(listeners).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('records a request error and ends the span once', () => {
|
||||
const listeners = new Map<string, (message: unknown) => void>();
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setAttribute: vi.fn(), setStatus: vi.fn() };
|
||||
const error = Object.assign(new Error('connection refused'), { code: 'ECONNREFUSED' });
|
||||
const clientRequest = request();
|
||||
createHttpClientInstrumentation({
|
||||
tracer: { startSpan: vi.fn(() => span) } as any,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
subscribe: (name, listener) => {
|
||||
listeners.set(name, listener);
|
||||
return () => listeners.delete(name);
|
||||
},
|
||||
});
|
||||
|
||||
listeners.get('http.client.request.created')!({ request: clientRequest });
|
||||
listeners.get('http.client.request.error')!({ request: clientRequest, error });
|
||||
listeners.get('http.client.response.finish')!({ request: clientRequest, response: { statusCode: 200 } });
|
||||
|
||||
expect(span.recordException).toHaveBeenCalledWith(error);
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('error.type', 'ECONNREFUSED');
|
||||
expect(span.setStatus).toHaveBeenCalledWith({ code: SpanStatusCode.ERROR });
|
||||
expect(span.end).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('records the response status code as error.type for an error response', () => {
|
||||
const listeners = new Map<string, (message: unknown) => void>();
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setAttribute: vi.fn(), setStatus: vi.fn() };
|
||||
const clientRequest = request();
|
||||
createHttpClientInstrumentation({
|
||||
tracer: { startSpan: vi.fn(() => span) } as any,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
subscribe: (name, listener) => {
|
||||
listeners.set(name, listener);
|
||||
return () => listeners.delete(name);
|
||||
},
|
||||
});
|
||||
|
||||
listeners.get('http.client.request.created')!({ request: clientRequest });
|
||||
listeners.get('http.client.response.finish')!({ request: clientRequest, response: { statusCode: 502 } });
|
||||
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('error.type', '502');
|
||||
expect(span.setStatus).toHaveBeenCalledWith({ code: SpanStatusCode.ERROR });
|
||||
});
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import type * as Bull from 'bullmq';
|
||||
import { instrumentQueue } from '@/core/telemetry/queue-instrumentation.js';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
injectTraceContext: vi.fn((carrier: Record<string, string>) => {
|
||||
carrier['traceparent'] = '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01';
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@/core/telemetry/telemetry-registry.js', () => ({
|
||||
injectTraceContext: mocks.injectTraceContext,
|
||||
}));
|
||||
|
||||
describe('queue-instrumentation', () => {
|
||||
beforeEach(() => {
|
||||
mocks.injectTraceContext.mockClear();
|
||||
});
|
||||
|
||||
test('injects the active trace context for add()', () => {
|
||||
const add = vi.fn();
|
||||
const queue = instrumentQueue({ add, addBulk: vi.fn() } as unknown as Bull.Queue<{ noteId: string }>);
|
||||
const data = { noteId: '9d6b9a65-46c9-4e1b-a640-9589693893c9' };
|
||||
|
||||
queue.add('endedPollNotification', data);
|
||||
|
||||
expect(mocks.injectTraceContext).toHaveBeenCalledTimes(1);
|
||||
expect(data).toMatchObject({
|
||||
__misskeyTraceContext: {
|
||||
traceparent: '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01',
|
||||
},
|
||||
});
|
||||
expect(add).toHaveBeenCalledWith('endedPollNotification', data, undefined);
|
||||
});
|
||||
|
||||
test('injects every job passed to addBulk()', () => {
|
||||
const addBulk = vi.fn();
|
||||
const queue = instrumentQueue({ add: vi.fn(), addBulk } as unknown as Bull.Queue<{ to: string }>);
|
||||
const jobs = [
|
||||
{ name: 'deliver', data: { to: 'https://remote.example/inbox' } },
|
||||
{ name: 'deliver', data: { to: 'https://remote2.example/inbox' } },
|
||||
];
|
||||
|
||||
queue.addBulk(jobs);
|
||||
|
||||
expect(mocks.injectTraceContext).toHaveBeenCalledTimes(2);
|
||||
expect(jobs).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ data: expect.objectContaining({ __misskeyTraceContext: expect.any(Object) }) }),
|
||||
]));
|
||||
expect(addBulk).toHaveBeenCalledWith(jobs);
|
||||
});
|
||||
});
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import type { Context, SpanContext } from '@opentelemetry/api';
|
||||
import { getQueueSpanContext, getQueueTraceContextMode, injectActiveTraceContext, injectQueueTraceContext } from '@/core/telemetry/queue-trace-context.js';
|
||||
|
||||
const rootContext = {} as Context;
|
||||
const extractedContext = {} as Context;
|
||||
const sourceSpanContext: SpanContext = {
|
||||
traceId: '0123456789abcdef0123456789abcdef',
|
||||
spanId: '0123456789abcdef',
|
||||
traceFlags: 1,
|
||||
isRemote: true,
|
||||
};
|
||||
|
||||
function jobData() {
|
||||
return {
|
||||
name: 'deliver',
|
||||
__misskeyTraceContext: {
|
||||
traceparent: '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe('queue-trace-context', () => {
|
||||
test('stores only a non-empty carrier in the job data', () => {
|
||||
const data = { noteId: '9d6b9a65-46c9-4e1b-a640-9589693893c9' };
|
||||
|
||||
injectQueueTraceContext(data, carrier => {
|
||||
carrier['traceparent'] = '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01';
|
||||
});
|
||||
|
||||
expect(data).toMatchObject({
|
||||
__misskeyTraceContext: {
|
||||
traceparent: '00-0123456789abcdef0123456789abcdef-0123456789abcdef-01',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('does not store an empty carrier when no active trace exists', () => {
|
||||
const data = { noteId: '9d6b9a65-46c9-4e1b-a640-9589693893c9' };
|
||||
|
||||
injectQueueTraceContext(data, () => {});
|
||||
|
||||
expect(data).not.toHaveProperty('__misskeyTraceContext');
|
||||
});
|
||||
|
||||
test('ignores non-object job data', () => {
|
||||
const inject = vi.fn();
|
||||
|
||||
injectQueueTraceContext(null, inject);
|
||||
injectQueueTraceContext('not a job object', inject);
|
||||
|
||||
expect(inject).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('injects the active context with the configured propagator', () => {
|
||||
const activeContext = {} as Context;
|
||||
const carrier = {};
|
||||
const inject = vi.fn();
|
||||
|
||||
injectActiveTraceContext({
|
||||
tracer: { startActiveSpan: vi.fn() } as any,
|
||||
propagation: { inject, extract: vi.fn() } as any,
|
||||
trace: { getSpanContext: vi.fn() },
|
||||
getActiveContext: () => activeContext,
|
||||
rootContext,
|
||||
mode: 'link',
|
||||
spanStatusCodeError: 2 as any,
|
||||
}, carrier);
|
||||
|
||||
expect(inject).toHaveBeenCalledWith(activeContext, carrier);
|
||||
});
|
||||
|
||||
test('starts a new root trace with a link by default', () => {
|
||||
const extract = vi.fn(() => extractedContext);
|
||||
const getSpanContext = vi.fn(() => sourceSpanContext);
|
||||
|
||||
const result = getQueueSpanContext(jobData(), {
|
||||
rootContext,
|
||||
propagation: { inject: vi.fn(), extract },
|
||||
trace: { getSpanContext },
|
||||
mode: 'link',
|
||||
});
|
||||
|
||||
expect(extract).toHaveBeenCalledWith(rootContext, jobData().__misskeyTraceContext);
|
||||
expect(result).toEqual({
|
||||
options: {
|
||||
root: true,
|
||||
links: [{ context: sourceSpanContext }],
|
||||
},
|
||||
parentContext: rootContext,
|
||||
});
|
||||
});
|
||||
|
||||
test('uses the extracted context as the parent when parent mode is selected', () => {
|
||||
const result = getQueueSpanContext(jobData(), {
|
||||
rootContext,
|
||||
propagation: { inject: vi.fn(), extract: () => extractedContext },
|
||||
trace: { getSpanContext: () => sourceSpanContext },
|
||||
mode: 'parent',
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
options: {},
|
||||
parentContext: extractedContext,
|
||||
});
|
||||
});
|
||||
|
||||
test('ignores malformed or missing carriers', () => {
|
||||
const extract = vi.fn(() => extractedContext);
|
||||
const deps = {
|
||||
rootContext,
|
||||
propagation: { inject: vi.fn(), extract },
|
||||
trace: { getSpanContext: () => sourceSpanContext },
|
||||
mode: 'link' as const,
|
||||
};
|
||||
|
||||
expect(getQueueSpanContext({}, deps)).toBeUndefined();
|
||||
expect(getQueueSpanContext({ __misskeyTraceContext: { traceparent: 1 } }, deps)).toBeUndefined();
|
||||
expect(extract).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('defaults to link mode and rejects invalid configuration', () => {
|
||||
expect(getQueueTraceContextMode(undefined)).toBe('link');
|
||||
expect(getQueueTraceContextMode('parent')).toBe('parent');
|
||||
expect(() => getQueueTraceContextMode('children')).toThrow('otelForBackend.jobTraceContextMode');
|
||||
});
|
||||
});
|
||||
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { runQueueJobWithTraceContext } from '@/queue/queue-job-runner.js';
|
||||
import { runQueueJob } from '@/queue/queue-job-runner.js';
|
||||
import { TelemetryService } from '@/core/telemetry/TelemetryService.js';
|
||||
|
||||
describe('runQueueJobWithTraceContext', () => {
|
||||
describe('runQueueJob', () => {
|
||||
test('returns the processor result without invoking the error handler', async () => {
|
||||
let spanActive = false;
|
||||
const startSpanWithTraceContext = vi.fn(<T>(_name: string, _jobData: object, fn: () => T): T => {
|
||||
const startSpan = vi.fn(<T>(_name: string, fn: () => T): T => {
|
||||
spanActive = true;
|
||||
const result = fn();
|
||||
if (result instanceof Promise) return result.finally(() => { spanActive = false; }) as T;
|
||||
@@ -18,11 +18,11 @@ describe('runQueueJobWithTraceContext', () => {
|
||||
return result;
|
||||
});
|
||||
const telemetryService = {
|
||||
startSpanWithTraceContext,
|
||||
startSpan,
|
||||
} as unknown as TelemetryService;
|
||||
const onError = vi.fn();
|
||||
|
||||
await expect(runQueueJobWithTraceContext(telemetryService, 'Queue: test', {}, () => 'ok', onError)).resolves.toBe('ok');
|
||||
await expect(runQueueJob(telemetryService, 'Queue: test', () => 'ok', onError)).resolves.toBe('ok');
|
||||
|
||||
expect(onError).not.toHaveBeenCalled();
|
||||
expect(spanActive).toBe(false);
|
||||
@@ -30,7 +30,7 @@ describe('runQueueJobWithTraceContext', () => {
|
||||
|
||||
test('handles failures while the processor span is active and rethrows the original error', async () => {
|
||||
let spanActive = false;
|
||||
const startSpanWithTraceContext = vi.fn(<T>(_name: string, _jobData: object, fn: () => T): T => {
|
||||
const startSpan = vi.fn(<T>(_name: string, fn: () => T): T => {
|
||||
spanActive = true;
|
||||
const result = fn();
|
||||
if (result instanceof Promise) return result.finally(() => { spanActive = false; }) as T;
|
||||
@@ -38,7 +38,7 @@ describe('runQueueJobWithTraceContext', () => {
|
||||
return result;
|
||||
});
|
||||
const telemetryService = {
|
||||
startSpanWithTraceContext,
|
||||
startSpan,
|
||||
} as unknown as TelemetryService;
|
||||
const onError = vi.fn((error: Error) => {
|
||||
expect(spanActive).toBe(true);
|
||||
@@ -46,7 +46,7 @@ describe('runQueueJobWithTraceContext', () => {
|
||||
});
|
||||
const originalError = new Error('failed');
|
||||
|
||||
await expect(runQueueJobWithTraceContext(telemetryService, 'Queue: test', {}, async () => {
|
||||
await expect(runQueueJob(telemetryService, 'Queue: test', async () => {
|
||||
throw originalError;
|
||||
}, onError)).rejects.toBe(originalError);
|
||||
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { HttpRequestService } from '@/core/HttpRequestService.js';
|
||||
import FetchRssEndpoint, { meta } from '@/server/api/endpoints/fetch-rss.js';
|
||||
import { ApiError } from '@/server/api/error.js';
|
||||
import type { Mocked } from 'vitest';
|
||||
import type { Response } from 'node-fetch';
|
||||
|
||||
const rssParserMocks = vi.hoisted(() => ({
|
||||
constructor: vi.fn(),
|
||||
parseString: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('rss-parser', () => ({
|
||||
default: class {
|
||||
constructor(options: unknown) {
|
||||
rssParserMocks.constructor(options);
|
||||
}
|
||||
|
||||
public parseString(input: string) {
|
||||
return rssParserMocks.parseString(input);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
const RSS = '<?xml version="1.0"?><rss version="2.0"><channel><title>Test</title></channel></rss>';
|
||||
|
||||
function deferred<T>() {
|
||||
let resolve!: (value: T) => void;
|
||||
let reject!: (reason?: unknown) => void;
|
||||
const promise = new Promise<T>((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
function response(url: string, text = RSS): Response {
|
||||
return {
|
||||
url,
|
||||
text: vi.fn().mockResolvedValue(text),
|
||||
} as unknown as Response;
|
||||
}
|
||||
|
||||
describe('fetch-rss endpoint', () => {
|
||||
let httpRequestService: Mocked<HttpRequestService>;
|
||||
let endpoint: FetchRssEndpoint;
|
||||
|
||||
beforeEach(() => {
|
||||
rssParserMocks.constructor.mockReset();
|
||||
rssParserMocks.parseString.mockReset();
|
||||
rssParserMocks.parseString.mockResolvedValue({ items: [] });
|
||||
httpRequestService = {
|
||||
send: vi.fn(),
|
||||
} as unknown as Mocked<HttpRequestService>;
|
||||
endpoint = new FetchRssEndpoint(httpRequestService);
|
||||
});
|
||||
|
||||
async function exec(url: string) {
|
||||
return await endpoint.exec({ url }, null, null);
|
||||
}
|
||||
|
||||
async function expectApiError(promise: Promise<unknown>, code: string, status: number) {
|
||||
await expect(promise).rejects.toMatchObject({
|
||||
code,
|
||||
httpStatusCode: status,
|
||||
info: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
test.each([
|
||||
'',
|
||||
'not a URL',
|
||||
'ftp://example.com/feed.xml',
|
||||
`https://example.com/${'a'.repeat(8192)}`,
|
||||
])('rejects invalid URL: %s', async (url) => {
|
||||
await expectApiError(exec(url), 'INVALID_URL', 400);
|
||||
expect(httpRequestService.send).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.each([
|
||||
'https://user@example.com/feed.xml',
|
||||
'https://user:password@example.com/feed.xml',
|
||||
])('rejects URL containing credentials: %s', async (url) => {
|
||||
await expectApiError(exec(url), 'INVALID_URL', 400);
|
||||
expect(httpRequestService.send).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('does not expose details from internal errors', async () => {
|
||||
httpRequestService.send.mockRejectedValue(new Error('secret upstream details'));
|
||||
|
||||
const promise = exec('https://example.com/feed.xml');
|
||||
await expectApiError(promise, 'FETCH_RSS_FAILED', 422);
|
||||
await expect(promise).rejects.not.toMatchObject({
|
||||
message: expect.stringContaining('secret upstream details'),
|
||||
});
|
||||
});
|
||||
|
||||
test('passes the 1 MiB response limit to HttpRequestService', async () => {
|
||||
httpRequestService.send.mockResolvedValue(response('https://example.com/feed.xml'));
|
||||
|
||||
await exec('https://example.com/feed.xml');
|
||||
|
||||
expect(httpRequestService.send).toHaveBeenCalledWith('https://example.com/feed.xml', expect.objectContaining({
|
||||
size: 1024 * 1024,
|
||||
}));
|
||||
});
|
||||
|
||||
test('creates an asynchronous RSS parser for every request', async () => {
|
||||
httpRequestService.send
|
||||
.mockResolvedValueOnce(response('https://example.com/first.xml'))
|
||||
.mockResolvedValueOnce(response('https://example.com/second.xml'));
|
||||
|
||||
await exec('https://example.com/first.xml');
|
||||
await exec('https://example.com/second.xml');
|
||||
|
||||
expect(rssParserMocks.constructor).toHaveBeenCalledTimes(2);
|
||||
expect(rssParserMocks.constructor).toHaveBeenNthCalledWith(1, { xml2js: { async: true } });
|
||||
expect(rssParserMocks.constructor).toHaveBeenNthCalledWith(2, { xml2js: { async: true } });
|
||||
});
|
||||
|
||||
test('rejects a non-HTTP final URL without exposing it', async () => {
|
||||
httpRequestService.send.mockResolvedValue(response('file:///secret/feed.xml'));
|
||||
|
||||
await expectApiError(exec('https://example.com/feed.xml'), 'FETCH_RSS_FAILED', 422);
|
||||
});
|
||||
|
||||
test('shares an in-flight request for the same normalized URL', async () => {
|
||||
const pending = deferred<Response>();
|
||||
httpRequestService.send.mockReturnValue(pending.promise);
|
||||
|
||||
const first = exec('HTTPS://EXAMPLE.COM:443/feed.xml#first');
|
||||
const second = exec('https://example.com/feed.xml#second');
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(1);
|
||||
|
||||
pending.resolve(response('https://example.com/feed.xml'));
|
||||
await expect(Promise.all([first, second])).resolves.toHaveLength(2);
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('limits concurrent requests for different URLs to 32', async () => {
|
||||
const pending = deferred<Response>();
|
||||
httpRequestService.send.mockReturnValue(pending.promise);
|
||||
|
||||
const requests = Array.from({ length: 32 }, (_, i) => exec(`https://example.com/${i}.xml`));
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(32);
|
||||
await expectApiError(exec('https://example.com/overflow.xml'), 'FETCH_RSS_UNAVAILABLE', 503);
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(32);
|
||||
|
||||
pending.resolve(response('https://example.com/feed.xml'));
|
||||
await Promise.all(requests);
|
||||
|
||||
httpRequestService.send.mockResolvedValue(response('https://example.com/after.xml'));
|
||||
await expect(exec('https://example.com/after.xml')).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
test('cleans up the in-flight request and concurrency slot after success', async () => {
|
||||
httpRequestService.send.mockResolvedValue(response('https://example.com/feed.xml'));
|
||||
|
||||
await exec('https://example.com/feed.xml');
|
||||
await exec('https://example.com/feed.xml');
|
||||
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
test('cleans up the in-flight request and concurrency slot after failure', async () => {
|
||||
httpRequestService.send.mockRejectedValue(new Error('upstream failed'));
|
||||
const requests = Array.from({ length: 32 }, (_, i) => exec(`https://example.com/${i}.xml`));
|
||||
await Promise.allSettled(requests);
|
||||
|
||||
httpRequestService.send.mockResolvedValue(response('https://example.com/0.xml'));
|
||||
await expect(exec('https://example.com/0.xml')).resolves.toBeDefined();
|
||||
expect(httpRequestService.send).toHaveBeenCalledTimes(33);
|
||||
});
|
||||
|
||||
test('has the expected rate limit metadata', () => {
|
||||
expect(meta.limit).toEqual({
|
||||
duration: 60 * 1000,
|
||||
max: 300,
|
||||
});
|
||||
});
|
||||
|
||||
test('uses only the declared structured API errors', () => {
|
||||
expect(new ApiError(meta.errors.invalidUrl)).toMatchObject({ code: 'INVALID_URL', httpStatusCode: 400 });
|
||||
expect(new ApiError(meta.errors.fetchRssFailed)).toMatchObject({ code: 'FETCH_RSS_FAILED', httpStatusCode: 422 });
|
||||
expect(new ApiError(meta.errors.fetchRssUnavailable)).toMatchObject({ code: 'FETCH_RSS_UNAVAILABLE', httpStatusCode: 503 });
|
||||
});
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { shouldRegisterHttpServerInstrumentation, registerHttpServerInstrumentation } from '@/server/http-server-instrumentation.js';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
plugin: vi.fn(),
|
||||
instrumentation: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@fastify/otel', () => ({
|
||||
FastifyOtelInstrumentation: class {
|
||||
public plugin = mocks.plugin;
|
||||
|
||||
public constructor(options: unknown) {
|
||||
mocks.instrumentation(options);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
describe('http-server-instrumentation', () => {
|
||||
test('registers Fastify instrumentation when only OpenTelemetry is configured', async () => {
|
||||
const plugin = vi.fn();
|
||||
const fastify = { register: vi.fn().mockResolvedValue(undefined) };
|
||||
mocks.plugin.mockReturnValue(plugin);
|
||||
|
||||
await registerHttpServerInstrumentation(fastify as any, { otelForBackend: {} } as any);
|
||||
|
||||
expect(mocks.instrumentation).toHaveBeenCalledTimes(1);
|
||||
expect(fastify.register).toHaveBeenCalledWith(plugin);
|
||||
|
||||
const requestHook = mocks.instrumentation.mock.calls[0][0].requestHook;
|
||||
const span = { updateName: vi.fn() };
|
||||
requestHook(span, { method: 'POST', routeOptions: { url: '/notes/create' } });
|
||||
expect(span.updateName).toHaveBeenCalledWith('POST /notes/create');
|
||||
});
|
||||
|
||||
test('does not register duplicate request instrumentation with Sentry', async () => {
|
||||
const fastify = { register: vi.fn() };
|
||||
|
||||
await registerHttpServerInstrumentation(fastify as any, { otelForBackend: {}, sentryForBackend: {} } as any);
|
||||
|
||||
expect(fastify.register).not.toHaveBeenCalled();
|
||||
expect(shouldRegisterHttpServerInstrumentation({ otelForBackend: {}, sentryForBackend: {} } as any)).toBe(false);
|
||||
});
|
||||
|
||||
test('does not register instrumentation without OpenTelemetry', () => {
|
||||
expect(shouldRegisterHttpServerInstrumentation({} as any)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { installDatabaseInstrumentation, installInstrumentation } from '@/core/telemetry/database-instrumentation.js';
|
||||
|
||||
describe('database-instrumentation', () => {
|
||||
test('does not install PostgreSQL instrumentation when disabled', async () => {
|
||||
const uninstall = await installDatabaseInstrumentation({} as any, {
|
||||
capturePgSpans: false,
|
||||
capturePgStatement: false,
|
||||
capturePgConnectionSpans: false,
|
||||
});
|
||||
|
||||
expect(uninstall).toBeTypeOf('function');
|
||||
expect(() => uninstall()).not.toThrow();
|
||||
});
|
||||
|
||||
test('registers pg instrumentation with the active provider', () => {
|
||||
const provider = {};
|
||||
const pg = { setTracerProvider: vi.fn(), enable: vi.fn(), disable: vi.fn() };
|
||||
const config = vi.fn();
|
||||
const PgInstrumentation = class {
|
||||
public constructor(options: unknown) {
|
||||
config(options);
|
||||
return pg as any;
|
||||
}
|
||||
};
|
||||
|
||||
const uninstall = installInstrumentation(provider as any, {
|
||||
PgInstrumentation: PgInstrumentation as any,
|
||||
}, {
|
||||
capturePgStatement: false,
|
||||
capturePgConnectionSpans: false,
|
||||
});
|
||||
|
||||
expect(pg.setTracerProvider).toHaveBeenCalledWith(provider);
|
||||
expect(pg.enable).toHaveBeenCalledOnce();
|
||||
expect(config).toHaveBeenCalledWith(expect.objectContaining({
|
||||
enhancedDatabaseReporting: false,
|
||||
requireParentSpan: true,
|
||||
ignoreConnectSpans: true,
|
||||
requestHook: expect.any(Function),
|
||||
}));
|
||||
|
||||
const span = { setAttribute: vi.fn() };
|
||||
(config.mock.calls[0][0] as { requestHook: (span: any) => void }).requestHook(span);
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('db.statement', '[REDACTED]');
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('db.query.text', '[REDACTED]');
|
||||
|
||||
uninstall();
|
||||
|
||||
expect(pg.disable).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test('keeps SQL statement attributes when explicitly enabled', () => {
|
||||
const pg = { setTracerProvider: vi.fn(), enable: vi.fn(), disable: vi.fn() };
|
||||
const config = vi.fn();
|
||||
|
||||
installInstrumentation({} as any, {
|
||||
PgInstrumentation: class {
|
||||
public constructor(options: unknown) {
|
||||
config(options);
|
||||
return pg as any;
|
||||
}
|
||||
} as any,
|
||||
}, {
|
||||
capturePgStatement: true,
|
||||
capturePgConnectionSpans: false,
|
||||
});
|
||||
|
||||
expect(config.mock.calls[0][0]).not.toHaveProperty('requestHook');
|
||||
});
|
||||
|
||||
test('enables connection spans when explicitly configured', () => {
|
||||
const pg = { setTracerProvider: vi.fn(), enable: vi.fn(), disable: vi.fn() };
|
||||
const config = vi.fn();
|
||||
|
||||
installInstrumentation({} as any, {
|
||||
PgInstrumentation: class {
|
||||
public constructor(options: unknown) {
|
||||
config(options);
|
||||
return pg as any;
|
||||
}
|
||||
} as any,
|
||||
}, {
|
||||
capturePgStatement: false,
|
||||
capturePgConnectionSpans: true,
|
||||
});
|
||||
|
||||
expect(config).toHaveBeenCalledWith(expect.objectContaining({
|
||||
ignoreConnectSpans: false,
|
||||
}));
|
||||
});
|
||||
|
||||
test('cleans up both instrumentations when initialization fails', () => {
|
||||
const pg = { setTracerProvider: vi.fn(), enable: vi.fn(), disable: vi.fn() };
|
||||
pg.enable.mockImplementation(() => { throw new Error('failed'); });
|
||||
|
||||
expect(() => installInstrumentation({} as any, {
|
||||
PgInstrumentation: class { public constructor() { return pg as any; } } as any,
|
||||
})).toThrow('failed');
|
||||
|
||||
expect(pg.disable).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
|
||||
import { createRedisInstrumentation } from '@/core/telemetry/redis-instrumentation.js';
|
||||
|
||||
describe('redis-instrumentation', () => {
|
||||
test('creates and completes a span for an ioredis command', () => {
|
||||
let subscribers: any;
|
||||
const unsubscribe = vi.fn();
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setStatus: vi.fn(), setAttribute: vi.fn() };
|
||||
const tracer = { startSpan: vi.fn(() => span) };
|
||||
const uninstall = createRedisInstrumentation({
|
||||
tracingChannel: () => ({ subscribe: (value) => { subscribers = value; }, unsubscribe }),
|
||||
tracer: tracer as any,
|
||||
getActiveSpan: () => ({}) as any,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}, { captureCommandSpans: true });
|
||||
const command = { command: 'get', args: ['key'], database: 0, serverAddress: 'redis', serverPort: 6379 };
|
||||
|
||||
subscribers.start(command);
|
||||
subscribers.asyncEnd(command);
|
||||
|
||||
expect(tracer.startSpan).toHaveBeenCalledWith('get', expect.objectContaining({
|
||||
kind: SpanKind.CLIENT,
|
||||
attributes: expect.objectContaining({
|
||||
'db.system.name': 'redis',
|
||||
'db.operation.name': 'get',
|
||||
'server.address': 'redis',
|
||||
'server.port': 6379,
|
||||
}),
|
||||
}));
|
||||
expect(span.end).toHaveBeenCalledOnce();
|
||||
|
||||
uninstall();
|
||||
expect(unsubscribe).toHaveBeenCalledWith(subscribers);
|
||||
});
|
||||
|
||||
test('records rejected Redis commands as errors', () => {
|
||||
let subscribers: any;
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setStatus: vi.fn(), setAttribute: vi.fn() };
|
||||
createRedisInstrumentation({
|
||||
tracingChannel: () => ({ subscribe: (value) => { subscribers = value; }, unsubscribe: vi.fn() }),
|
||||
tracer: { startSpan: vi.fn(() => span) } as any,
|
||||
getActiveSpan: () => ({}) as any,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}, { captureCommandSpans: true });
|
||||
const command = { command: 'get', args: ['key'], database: 0, serverAddress: 'redis', serverPort: undefined };
|
||||
const error = Object.assign(new Error('ERR Redis failed'), { code: 'ERR' });
|
||||
|
||||
subscribers.start(command);
|
||||
Object.assign(command, { error });
|
||||
subscribers.error(command);
|
||||
subscribers.asyncEnd(command);
|
||||
|
||||
expect(span.recordException).toHaveBeenCalledWith(error);
|
||||
expect(span.recordException).toHaveBeenCalledOnce();
|
||||
expect(span.setStatus).toHaveBeenCalledWith({ code: SpanStatusCode.ERROR, message: 'ERR Redis failed' });
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('error.type', 'ERR');
|
||||
expect(span.setAttribute).toHaveBeenCalledWith('db.response.status_code', 'ERR');
|
||||
expect(span.end).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test('does not create a root span when no parent span is active', () => {
|
||||
let subscribers: any;
|
||||
const tracer = { startSpan: vi.fn() };
|
||||
createRedisInstrumentation({
|
||||
tracingChannel: () => ({ subscribe: (value) => { subscribers = value; }, unsubscribe: vi.fn() }),
|
||||
tracer: tracer as any,
|
||||
getActiveSpan: () => undefined,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}, { captureCommandSpans: true });
|
||||
|
||||
subscribers.start({ command: 'get', args: ['key'], database: 0, serverAddress: 'redis', serverPort: 6379 });
|
||||
|
||||
expect(tracer.startSpan).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('creates a root span when explicitly enabled', () => {
|
||||
let subscribers: any;
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setStatus: vi.fn(), setAttribute: vi.fn() };
|
||||
const tracer = { startSpan: vi.fn(() => span) };
|
||||
createRedisInstrumentation({
|
||||
tracingChannel: () => ({ subscribe: (value) => { subscribers = value; }, unsubscribe: vi.fn() }),
|
||||
tracer: tracer as any,
|
||||
getActiveSpan: () => undefined,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}, { captureCommandSpans: true, requireParentSpan: false });
|
||||
|
||||
const command = { command: 'get', args: ['key'], database: 0, serverAddress: 'redis', serverPort: 6379 };
|
||||
subscribers.start(command);
|
||||
subscribers.asyncEnd(command);
|
||||
|
||||
expect(tracer.startSpan).toHaveBeenCalledOnce();
|
||||
expect(span.end).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test('records connection spans only when explicitly enabled', () => {
|
||||
const subscribers = new Map<string, any>();
|
||||
const unsubscribe = vi.fn();
|
||||
const span = { end: vi.fn(), recordException: vi.fn(), setStatus: vi.fn(), setAttribute: vi.fn() };
|
||||
const tracer = { startSpan: vi.fn(() => span) };
|
||||
const uninstall = createRedisInstrumentation({
|
||||
tracingChannel: (name) => ({ subscribe: (value) => { subscribers.set(name, value); }, unsubscribe }),
|
||||
tracer: tracer as any,
|
||||
getActiveSpan: () => undefined,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
}, { captureConnectionSpans: true });
|
||||
|
||||
const connection = { serverAddress: 'redis', serverPort: 6379 };
|
||||
subscribers.get('ioredis:connect').start(connection);
|
||||
subscribers.get('ioredis:connect').asyncEnd(connection);
|
||||
|
||||
expect(tracer.startSpan).toHaveBeenCalledWith('connect', expect.objectContaining({
|
||||
kind: SpanKind.CLIENT,
|
||||
attributes: expect.objectContaining({
|
||||
'db.operation.name': 'connect',
|
||||
'server.address': 'redis',
|
||||
'server.port': 6379,
|
||||
}),
|
||||
}));
|
||||
expect(span.end).toHaveBeenCalledOnce();
|
||||
|
||||
uninstall();
|
||||
expect(unsubscribe).toHaveBeenCalledWith(subscribers.get('ioredis:connect'));
|
||||
});
|
||||
|
||||
test('does not subscribe to Redis command diagnostics unless explicitly enabled', () => {
|
||||
const tracingChannel = vi.fn();
|
||||
createRedisInstrumentation({
|
||||
tracingChannel,
|
||||
tracer: { startSpan: vi.fn() } as any,
|
||||
getActiveSpan: () => undefined,
|
||||
spanKindClient: SpanKind.CLIENT,
|
||||
spanStatusCodeError: SpanStatusCode.ERROR,
|
||||
});
|
||||
|
||||
expect(tracingChannel).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -9,8 +9,6 @@ import type { Config } from '@/config.js';
|
||||
const mocks = vi.hoisted(() => {
|
||||
return {
|
||||
sentryCreate: vi.fn(),
|
||||
sentryCreateWithOtlpExport: vi.fn(),
|
||||
otelCreate: vi.fn(),
|
||||
setLogTraceContextProvider: vi.fn(),
|
||||
};
|
||||
});
|
||||
@@ -22,13 +20,6 @@ vi.mock('@/logging/logging-runtime.js', () => ({
|
||||
vi.mock('@/core/telemetry/adapters/SentryTelemetryAdapter.js', () => ({
|
||||
SentryTelemetryAdapter: {
|
||||
create: mocks.sentryCreate,
|
||||
createWithOtlpExport: mocks.sentryCreateWithOtlpExport,
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@/core/telemetry/adapters/OpenTelemetryAdapter.js', () => ({
|
||||
OpenTelemetryAdapter: {
|
||||
create: mocks.otelCreate,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -43,44 +34,37 @@ describe('telemetry-registry', () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
mocks.sentryCreate.mockReset();
|
||||
mocks.sentryCreateWithOtlpExport.mockReset();
|
||||
mocks.otelCreate.mockReset();
|
||||
mocks.setLogTraceContextProvider.mockReset();
|
||||
mocks.sentryCreate.mockResolvedValue({ shutdown: vi.fn(), captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
mocks.sentryCreateWithOtlpExport.mockResolvedValue({ shutdown: vi.fn(), captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
mocks.otelCreate.mockResolvedValue({ shutdown: vi.fn(), captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
});
|
||||
|
||||
test('uses OpenTelemetryAdapter when only otelForBackend is configured', async () => {
|
||||
test('does not initialize an adapter when Sentry is not configured', async () => {
|
||||
const { initTelemetry } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const otelForBackend = { endpoint: 'http://collector:4318/v1/traces' };
|
||||
|
||||
await initTelemetry(config({ otelForBackend }));
|
||||
await initTelemetry(config({}));
|
||||
|
||||
expect(mocks.otelCreate).toHaveBeenCalledWith({
|
||||
...otelForBackend,
|
||||
serviceVersion: '2026.1.0',
|
||||
});
|
||||
expect(mocks.sentryCreate).not.toHaveBeenCalled();
|
||||
expect(mocks.sentryCreateWithOtlpExport).not.toHaveBeenCalled();
|
||||
expect(mocks.setLogTraceContextProvider).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('registers the adapter trace context provider after telemetry initialization', async () => {
|
||||
test('initializes Sentry and registers its trace context provider', async () => {
|
||||
const { initTelemetry } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const sentryForBackend = { options: {}, enableNodeProfiling: false };
|
||||
const getActiveTraceContext = vi.fn(() => ({
|
||||
traceId: '0123456789abcdef0123456789abcdef',
|
||||
spanId: '0123456789abcdef',
|
||||
traceFlags: 0,
|
||||
}));
|
||||
mocks.otelCreate.mockResolvedValue({
|
||||
mocks.sentryCreate.mockResolvedValue({
|
||||
shutdown: vi.fn(),
|
||||
captureMessage: vi.fn(),
|
||||
startSpan: vi.fn(),
|
||||
getActiveTraceContext,
|
||||
});
|
||||
|
||||
await initTelemetry(config({ otelForBackend: { endpoint: 'http://collector:4318/v1/traces' } }));
|
||||
await initTelemetry(config({ sentryForBackend }));
|
||||
|
||||
expect(mocks.sentryCreate).toHaveBeenCalledWith(sentryForBackend);
|
||||
expect(mocks.setLogTraceContextProvider).toHaveBeenCalledWith(expect.any(Function));
|
||||
const provider = mocks.setLogTraceContextProvider.mock.calls[0][0] as () => unknown;
|
||||
expect(provider()).toEqual({
|
||||
@@ -91,21 +75,6 @@ describe('telemetry-registry', () => {
|
||||
expect(getActiveTraceContext).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test('adds OTLP export to the Sentry provider when both Sentry and OTel are configured', async () => {
|
||||
const { initTelemetry } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const sentryForBackend = { options: {}, enableNodeProfiling: false };
|
||||
const otelForBackend = { endpoint: 'http://collector:4318/v1/traces' };
|
||||
|
||||
await initTelemetry(config({ sentryForBackend, otelForBackend }));
|
||||
|
||||
expect(mocks.sentryCreateWithOtlpExport).toHaveBeenCalledWith(sentryForBackend, {
|
||||
...otelForBackend,
|
||||
serviceVersion: '2026.1.0',
|
||||
});
|
||||
expect(mocks.sentryCreate).not.toHaveBeenCalled();
|
||||
expect(mocks.otelCreate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('startSpan runs fn directly when no adapter is registered', async () => {
|
||||
const { startSpan } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
|
||||
@@ -114,67 +83,32 @@ describe('telemetry-registry', () => {
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('startSpan delegates directly to the single registered adapter without extra wrapping', async () => {
|
||||
test('startSpan delegates to the Sentry adapter', async () => {
|
||||
const { initTelemetry, startSpan } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const otelForBackend = { endpoint: 'http://collector:4318/v1/traces' };
|
||||
const adapterStartSpan = vi.fn((_name: string, fn: () => string) => fn());
|
||||
mocks.otelCreate.mockResolvedValue({ shutdown: vi.fn(), captureMessage: vi.fn(), startSpan: adapterStartSpan });
|
||||
mocks.sentryCreate.mockResolvedValue({ shutdown: vi.fn(), captureMessage: vi.fn(), startSpan: adapterStartSpan });
|
||||
|
||||
await initTelemetry(config({ otelForBackend }));
|
||||
await initTelemetry(config({ sentryForBackend: { options: {}, enableNodeProfiling: false } }));
|
||||
|
||||
const fn = vi.fn().mockReturnValue('result');
|
||||
expect(startSpan('test', fn)).toBe('result');
|
||||
expect(adapterStartSpan).toHaveBeenCalledWith('test', fn);
|
||||
});
|
||||
|
||||
test('startSpan wraps work through multiple registered adapters in order for future adapter combinations', async () => {
|
||||
const { initTelemetry, startSpan } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const calls: string[] = [];
|
||||
mocks.sentryCreate.mockResolvedValue({
|
||||
shutdown: vi.fn(),
|
||||
captureMessage: vi.fn(),
|
||||
startSpan: vi.fn((_name: string, fn: () => string) => {
|
||||
calls.push('sentry:start');
|
||||
const result = fn();
|
||||
calls.push('sentry:end');
|
||||
return result;
|
||||
}),
|
||||
});
|
||||
mocks.otelCreate.mockResolvedValue({
|
||||
shutdown: vi.fn(),
|
||||
captureMessage: vi.fn(),
|
||||
startSpan: vi.fn((_name: string, fn: () => string) => {
|
||||
calls.push('otel:start');
|
||||
const result = fn();
|
||||
calls.push('otel:end');
|
||||
return result;
|
||||
}),
|
||||
});
|
||||
|
||||
await initTelemetry(config({ sentryForBackend: { options: {}, enableNodeProfiling: false } }));
|
||||
await initTelemetry(config({ otelForBackend: { endpoint: 'http://collector:4318/v1/traces' } }));
|
||||
|
||||
const fn = vi.fn(() => {
|
||||
calls.push('work');
|
||||
return 'result';
|
||||
});
|
||||
|
||||
expect(startSpan('test', fn)).toBe('result');
|
||||
expect(calls).toEqual(['sentry:start', 'otel:start', 'work', 'otel:end', 'sentry:end']);
|
||||
});
|
||||
|
||||
test('shutdownTelemetry waits for every adapter even when one shutdown rejects', async () => {
|
||||
test('shutdownTelemetry waits for all registered adapters even when one rejects', async () => {
|
||||
const { initTelemetry, shutdownTelemetry } = await import('@/core/telemetry/telemetry-registry.js');
|
||||
const sentryShutdown = vi.fn().mockRejectedValue(new Error('sentry failed'));
|
||||
const otelShutdown = vi.fn().mockResolvedValue(undefined);
|
||||
mocks.sentryCreate.mockResolvedValue({ shutdown: sentryShutdown, captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
mocks.otelCreate.mockResolvedValue({ shutdown: otelShutdown, captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
const firstShutdown = vi.fn().mockRejectedValue(new Error('first failed'));
|
||||
const secondShutdown = vi.fn().mockResolvedValue(undefined);
|
||||
mocks.sentryCreate
|
||||
.mockResolvedValueOnce({ shutdown: firstShutdown, captureMessage: vi.fn(), startSpan: vi.fn() })
|
||||
.mockResolvedValueOnce({ shutdown: secondShutdown, captureMessage: vi.fn(), startSpan: vi.fn() });
|
||||
|
||||
await initTelemetry(config({ sentryForBackend: { options: {}, enableNodeProfiling: false } }));
|
||||
await initTelemetry(config({ otelForBackend: { endpoint: 'http://collector:4318/v1/traces' } }));
|
||||
const sentryForBackend = { options: {}, enableNodeProfiling: false };
|
||||
await initTelemetry(config({ sentryForBackend }));
|
||||
await initTelemetry(config({ sentryForBackend }));
|
||||
|
||||
await expect(shutdownTelemetry()).resolves.toBeUndefined();
|
||||
expect(sentryShutdown).toHaveBeenCalledTimes(1);
|
||||
expect(otelShutdown).toHaveBeenCalledTimes(1);
|
||||
expect(firstShutdown).toHaveBeenCalledTimes(1);
|
||||
expect(secondShutdown).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -458,7 +458,6 @@ function toStories(component: string): Promise<string> {
|
||||
globSync('src/components/MkSignupServerRules.vue'),
|
||||
globSync('src/components/MkUserSetupDialog.vue'),
|
||||
globSync('src/components/MkUserSetupDialog.*.vue'),
|
||||
globSync('src/components/MkImgPreviewDialog.vue'),
|
||||
globSync('src/components/MkInstanceCardMini.vue'),
|
||||
globSync('src/components/MkInviteCode.vue'),
|
||||
globSync('src/components/MkTagItem.vue'),
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { StoryObj } from '@storybook/vue3';
|
||||
import { file } from '../../.storybook/fakes.js';
|
||||
import MkImgPreviewDialog from './MkImgPreviewDialog.vue';
|
||||
export const Default = {
|
||||
render(args) {
|
||||
return {
|
||||
components: {
|
||||
MkImgPreviewDialog,
|
||||
},
|
||||
setup() {
|
||||
return {
|
||||
args,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
props() {
|
||||
return {
|
||||
...this.args,
|
||||
};
|
||||
},
|
||||
},
|
||||
template: '<MkImgPreviewDialog v-bind="props" />',
|
||||
};
|
||||
},
|
||||
args: {
|
||||
file: file(),
|
||||
},
|
||||
parameters: {
|
||||
chromatic: {
|
||||
// NOTE: ロードが終わるまで待つ
|
||||
delay: 3000,
|
||||
},
|
||||
layout: 'centered',
|
||||
},
|
||||
} satisfies StoryObj<typeof MkImgPreviewDialog>;
|
||||
@@ -1,63 +0,0 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<MkModalWindow
|
||||
ref="modal"
|
||||
:width="1800"
|
||||
:height="900"
|
||||
@close="close"
|
||||
@esc="close"
|
||||
@click="close"
|
||||
@closed="emit('closed')"
|
||||
>
|
||||
<template #header>{{ file.name }}</template>
|
||||
<div :class="$style.container">
|
||||
<img :src="file.url" :alt="file.comment || file.name" :class="$style.img"/>
|
||||
</div>
|
||||
</MkModalWindow>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import MkModalWindow from './MkModalWindow.vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
|
||||
defineProps<{
|
||||
file: Misskey.entities.DriveFile;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const modal = ref<typeof MkModalWindow | null>(null);
|
||||
|
||||
function close() {
|
||||
modal.value?.close();
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
|
||||
background-color: var(--MI_THEME-bg);
|
||||
background-size: auto auto;
|
||||
background-image: repeating-linear-gradient(135deg, transparent, transparent 6px, var(--MI_THEME-panel) 6px, var(--MI_THEME-panel) 12px);
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
</style>
|
||||
@@ -48,13 +48,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, nextTick, onBeforeUnmount, onMounted } from 'vue';
|
||||
import { ref, watch, nextTick, onBeforeUnmount, onMounted, useTemplateRef } from 'vue';
|
||||
import XItem from './MkLightbox.item.vue';
|
||||
import type { Content } from './MkLightbox.item.vue';
|
||||
import type { Keymap } from '@/utility/hotkey.js';
|
||||
import * as os from '@/os.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { isTouchUsing } from '@/utility/touch.js';
|
||||
import { focusTrap } from '@/utility/focus-trap.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
defaultIndex?: number;
|
||||
@@ -66,6 +67,7 @@ const emit = defineEmits<{
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
const activatedIndexes = ref(new Set<number>());
|
||||
const items = new Map<number, InstanceType<typeof XItem> | null>();
|
||||
const currentIndex = ref(props.defaultIndex ?? 0);
|
||||
@@ -192,7 +194,22 @@ function onPopState() {
|
||||
}
|
||||
}
|
||||
|
||||
let releaseFocusTrap: (() => void) | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
watch([showing], ([showing]) => {
|
||||
if (showing === true) {
|
||||
if (rootEl.value != null) {
|
||||
const { release } = focusTrap(rootEl.value);
|
||||
|
||||
releaseFocusTrap = release;
|
||||
rootEl.value.focus();
|
||||
}
|
||||
} else {
|
||||
releaseFocusTrap?.();
|
||||
}
|
||||
}, { immediate: true });
|
||||
|
||||
window.history.pushState(null, '', '#pswp');
|
||||
window.addEventListener('popstate', onPopState);
|
||||
});
|
||||
|
||||
@@ -137,8 +137,8 @@ async function openGallery(id?: string) {
|
||||
type: media.type.startsWith('video') ? 'video' : 'image',
|
||||
url: media.url,
|
||||
thumbnailUrl: media.thumbnailUrl,
|
||||
width: media.properties.width ?? 0,
|
||||
height: media.properties.height ?? 0,
|
||||
width: media.properties.width,
|
||||
height: media.properties.height,
|
||||
filename: media.name,
|
||||
file: media,
|
||||
sourceElement: getElementByMarker(`${markerId}:${media.id}`),
|
||||
|
||||
@@ -153,6 +153,7 @@ function showFileMenu(file: Misskey.entities.DriveFile, ev: PointerEvent | Keybo
|
||||
if (menuShowing) return;
|
||||
|
||||
const isImage = file.type.startsWith('image/');
|
||||
const isVideo = file.type.startsWith('video/');
|
||||
|
||||
const menuItems: MenuItem[] = [];
|
||||
|
||||
@@ -170,13 +171,25 @@ function showFileMenu(file: Misskey.entities.DriveFile, ev: PointerEvent | Keybo
|
||||
action: () => { describe(file); },
|
||||
});
|
||||
|
||||
if (isImage) {
|
||||
if (isImage || isVideo) {
|
||||
menuItems.push({
|
||||
text: i18n.ts.preview,
|
||||
icon: 'ti ti-photo-search',
|
||||
action: async () => {
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkImgPreviewDialog.vue').then(x => x.default), {
|
||||
file: file,
|
||||
const constents = props.modelValue.filter(item => item.type.startsWith('image') || item.type.startsWith('video')).map(item => ({
|
||||
id: item.id,
|
||||
type: item.type.startsWith('video') ? 'video' as const : 'image' as const,
|
||||
url: item.url,
|
||||
thumbnailUrl: item.thumbnailUrl,
|
||||
width: item.properties.width,
|
||||
height: item.properties.height,
|
||||
filename: item.name,
|
||||
file: item,
|
||||
//sourceElement: TODO
|
||||
}));
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkLightbox.vue').then(x => x.default), {
|
||||
defaultIndex: constents.findIndex(content => content.id === file.id),
|
||||
contents: constents,
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
|
||||
@@ -19,15 +19,18 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<div :class="$style.newBg2"></div>
|
||||
<button class="_button" :class="$style.newButton" @click="releaseQueue()"><i class="ti ti-circle-arrow-up"></i> {{ i18n.ts.newNote }}</button>
|
||||
</div>
|
||||
<div :class="$style.notes">
|
||||
<component
|
||||
:is="prefer.s.animation ? MkStreamingTimelineItem : 'div'"
|
||||
v-for="(note, i) in paginator.items.value"
|
||||
v-bind="prefer.s.animation ? { animatingIn: note._shouldAnimateIn_, animatingOut: note._shouldAnimateOut_ } : {}"
|
||||
:key="note.id"
|
||||
:data-scroll-anchor="note.id"
|
||||
>
|
||||
<div v-if="i > 0 && isSeparatorNeeded(paginator.items.value[i -1].createdAt, note.createdAt) && paginator.items.value[i -1]._shouldAnimateOut_ !== true">
|
||||
<component
|
||||
:is="prefer.s.animation ? TransitionGroup : 'div'"
|
||||
:class="$style.notes"
|
||||
:enterActiveClass="$style.transition_x_enterActive"
|
||||
:leaveActiveClass="$style.transition_x_leaveActive"
|
||||
:enterFromClass="$style.transition_x_enterFrom"
|
||||
:leaveToClass="$style.transition_x_leaveTo"
|
||||
:moveClass="$style.transition_x_move"
|
||||
tag="div"
|
||||
>
|
||||
<template v-for="(note, i) in paginator.items.value" :key="note.id">
|
||||
<div v-if="i > 0 && isSeparatorNeeded(paginator.items.value[i -1].createdAt, note.createdAt)" :data-scroll-anchor="note.id">
|
||||
<div :class="$style.date">
|
||||
<span><i class="ti ti-chevron-up"></i> {{ getSeparatorInfo(paginator.items.value[i -1].createdAt, note.createdAt)?.prevText }}</span>
|
||||
<span style="height: 1em; width: 1px; background: var(--MI_THEME-divider);"></span>
|
||||
@@ -35,15 +38,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
<MkNote :class="$style.note" :note="note" :withHardMute="true"/>
|
||||
</div>
|
||||
<div v-else-if="note._shouldInsertAd_">
|
||||
<div v-else-if="note._shouldInsertAd_" :data-scroll-anchor="note.id">
|
||||
<MkNote :class="$style.note" :note="note" :withHardMute="true"/>
|
||||
<div :class="$style.ad">
|
||||
<MkAd :preferForms="['horizontal', 'horizontal-big']"/>
|
||||
</div>
|
||||
</div>
|
||||
<MkNote v-else :class="$style.note" :note="note" :withHardMute="true"/>
|
||||
</component>
|
||||
</div>
|
||||
<MkNote v-else :class="$style.note" :note="note" :withHardMute="true" :data-scroll-anchor="note.id"/>
|
||||
</template>
|
||||
</component>
|
||||
<button v-show="paginator.canFetchOlder.value" key="_more_" v-appear="prefer.s.enableInfiniteScroll ? paginator.fetchOlder : null" :disabled="paginator.fetchingOlder.value" class="_button" :class="$style.more" @click="paginator.fetchOlder">
|
||||
<div v-if="!paginator.fetchingOlder.value">{{ i18n.ts.loadMore }}</div>
|
||||
<MkLoading v-else :inline="true"/>
|
||||
@@ -53,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, onUnmounted, provide, useTemplateRef, onMounted, markRaw } from 'vue';
|
||||
import { computed, watch, onUnmounted, provide, useTemplateRef, TransitionGroup, onMounted, shallowRef, ref, markRaw } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import { useDocumentVisibility } from '@@/js/use-document-visibility.js';
|
||||
@@ -69,10 +72,10 @@ import { instance } from '@/instance.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { store } from '@/store.js';
|
||||
import MkNote from '@/components/MkNote.vue';
|
||||
import MkStreamingTimelineItem, { ITEM_REMOVAL_MS } from '@/components/MkStreamingTimelineItem.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { DI } from '@/di.js';
|
||||
import { useGlobalEvent } from '@/events.js';
|
||||
import { globalEvents, useGlobalEvent } from '@/events.js';
|
||||
import { isSeparatorNeeded, getSeparatorInfo } from '@/utility/timeline-date-separate.js';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
@@ -101,8 +104,6 @@ provide('inTimeline', true);
|
||||
provide('tl_withSensitive', computed(() => props.withSensitive));
|
||||
provide(DI.inChannel, computed(() => props.src === 'channel' ? props.channel ?? null : null));
|
||||
|
||||
const itemRemovalDelay = prefer.s.animation ? ITEM_REMOVAL_MS : false;
|
||||
|
||||
let paginator: IPaginator<Misskey.entities.Note>;
|
||||
|
||||
if (props.src === 'antenna') {
|
||||
@@ -111,7 +112,6 @@ if (props.src === 'antenna') {
|
||||
antennaId: props.antenna!,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'home') {
|
||||
paginator = markRaw(new Paginator('notes/timeline', {
|
||||
@@ -120,7 +120,6 @@ if (props.src === 'antenna') {
|
||||
withFiles: props.onlyFiles ? true : undefined,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'local') {
|
||||
paginator = markRaw(new Paginator('notes/local-timeline', {
|
||||
@@ -130,7 +129,6 @@ if (props.src === 'antenna') {
|
||||
withFiles: props.onlyFiles ? true : undefined,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'social') {
|
||||
paginator = markRaw(new Paginator('notes/hybrid-timeline', {
|
||||
@@ -140,7 +138,6 @@ if (props.src === 'antenna') {
|
||||
withFiles: props.onlyFiles ? true : undefined,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'global') {
|
||||
paginator = markRaw(new Paginator('notes/global-timeline', {
|
||||
@@ -149,12 +146,10 @@ if (props.src === 'antenna') {
|
||||
withFiles: props.onlyFiles ? true : undefined,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'mentions') {
|
||||
paginator = markRaw(new Paginator('notes/mentions', {
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'directs') {
|
||||
paginator = markRaw(new Paginator('notes/mentions', {
|
||||
@@ -162,7 +157,6 @@ if (props.src === 'antenna') {
|
||||
visibility: 'specified',
|
||||
},
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'list') {
|
||||
paginator = markRaw(new Paginator('notes/user-list-timeline', {
|
||||
@@ -172,7 +166,6 @@ if (props.src === 'antenna') {
|
||||
listId: props.list!,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'channel') {
|
||||
paginator = markRaw(new Paginator('channels/timeline', {
|
||||
@@ -180,7 +173,6 @@ if (props.src === 'antenna') {
|
||||
channelId: props.channel!,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else if (props.src === 'role') {
|
||||
paginator = markRaw(new Paginator('roles/notes', {
|
||||
@@ -188,7 +180,6 @@ if (props.src === 'antenna') {
|
||||
roleId: props.role!,
|
||||
})),
|
||||
useShallowRef: true,
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
} else {
|
||||
throw new Error('Unrecognized timeline type: ' + props.src);
|
||||
@@ -437,16 +428,45 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.transition_x_move {
|
||||
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
|
||||
}
|
||||
|
||||
.transition_x_enterActive {
|
||||
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1);
|
||||
|
||||
&.note,
|
||||
.note {
|
||||
/* Skip Note Rendering有効時、TransitionGroupでnoteを追加するときに一瞬がくっとなる問題を抑制する */
|
||||
content-visibility: visible !important;
|
||||
}
|
||||
}
|
||||
|
||||
.transition_x_leaveActive {
|
||||
transition: height 0.2s cubic-bezier(0,.5,.5,1), opacity 0.2s cubic-bezier(0,.5,.5,1);
|
||||
}
|
||||
|
||||
.transition_x_enterFrom {
|
||||
opacity: 0;
|
||||
transform: translateY(max(-64px, -100%));
|
||||
}
|
||||
|
||||
@supports (interpolate-size: allow-keywords) {
|
||||
.transition_x_leaveTo {
|
||||
interpolate-size: allow-keywords; // heightのtransitionを動作させるために必要
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.transition_x_leaveTo {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.notes {
|
||||
container-type: inline-size;
|
||||
background: var(--MI_THEME-panel);
|
||||
}
|
||||
|
||||
.date,
|
||||
.note {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.note:not(:empty) {
|
||||
border-bottom: solid 0.5px var(--MI_THEME-divider);
|
||||
}
|
||||
|
||||
@@ -14,15 +14,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
|
||||
<div v-else ref="rootEl">
|
||||
<div :class="$style.notifications">
|
||||
<component
|
||||
:is="prefer.s.animation ? MkStreamingTimelineItem : 'div'"
|
||||
v-for="(notification, i) in paginator.items.value"
|
||||
v-bind="prefer.s.animation ? { animatingIn: notification._shouldAnimateIn_, animatingOut: notification._shouldAnimateOut_ } : {}"
|
||||
:key="notification.id"
|
||||
:data-scroll-anchor="notification.id"
|
||||
:class="$style.item"
|
||||
>
|
||||
<component
|
||||
:is="prefer.s.animation ? TransitionGroup : 'div'" :class="[$style.notifications]"
|
||||
:enterActiveClass="$style.transition_x_enterActive"
|
||||
:leaveActiveClass="$style.transition_x_leaveActive"
|
||||
:enterFromClass="$style.transition_x_enterFrom"
|
||||
:leaveToClass="$style.transition_x_leaveTo"
|
||||
:moveClass="$style.transition_x_move"
|
||||
tag="div"
|
||||
>
|
||||
<div v-for="(notification, i) in paginator.items.value" :key="notification.id" :data-scroll-anchor="notification.id" :class="$style.item">
|
||||
<div v-if="i > 0 && isSeparatorNeeded(paginator.items.value[i -1].createdAt, notification.createdAt)" :class="$style.date">
|
||||
<span><i class="ti ti-chevron-up"></i> {{ getSeparatorInfo(paginator.items.value[i -1].createdAt, notification.createdAt)?.prevText }}</span>
|
||||
<span style="height: 1em; width: 1px; background: var(--MI_THEME-divider);"></span>
|
||||
@@ -30,8 +31,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</div>
|
||||
<MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type) && 'note' in notification" :class="$style.content" :note="notification.note" :withHardMute="true"/>
|
||||
<XNotification v-else :class="$style.content" :notification="notification" :withTime="true" :full="true"/>
|
||||
</component>
|
||||
</div>
|
||||
</div>
|
||||
</component>
|
||||
<button v-show="paginator.canFetchOlder.value" key="_more_" v-appear="prefer.s.enableInfiniteScroll ? paginator.fetchOlder : null" :disabled="paginator.fetchingOlder.value" class="_button" :class="$style.more" @click="paginator.fetchOlder">
|
||||
<div v-if="!paginator.fetchingOlder.value">{{ i18n.ts.loadMore }}</div>
|
||||
<MkLoading v-else/>
|
||||
@@ -41,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onUnmounted, onMounted, computed, useTemplateRef, markRaw, watch } from 'vue';
|
||||
import { onUnmounted, onMounted, computed, useTemplateRef, TransitionGroup, markRaw, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { notificationTypes } from 'misskey-js';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
@@ -52,7 +53,6 @@ import MkNote from '@/components/MkNote.vue';
|
||||
import { useStream } from '@/stream.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
|
||||
import MkStreamingTimelineItem, { ITEM_REMOVAL_MS } from '@/components/MkStreamingTimelineItem.vue';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { store } from '@/store.js';
|
||||
import { isSeparatorNeeded, getSeparatorInfo } from '@/utility/timeline-date-separate.js';
|
||||
@@ -64,20 +64,16 @@ const props = defineProps<{
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
|
||||
const itemRemovalDelay = prefer.s.animation ? ITEM_REMOVAL_MS : false;
|
||||
|
||||
const paginator = prefer.s.useGroupedNotifications ? markRaw(new Paginator('i/notifications-grouped', {
|
||||
limit: 20,
|
||||
computedParams: computed(() => ({
|
||||
excludeTypes: props.excludeTypes ?? undefined,
|
||||
})),
|
||||
itemRemovalDelay,
|
||||
})) : markRaw(new Paginator('i/notifications', {
|
||||
limit: 20,
|
||||
computedParams: computed(() => ({
|
||||
excludeTypes: props.excludeTypes ?? undefined,
|
||||
})),
|
||||
itemRemovalDelay,
|
||||
}));
|
||||
|
||||
const MIN_POLLING_INTERVAL = 1000 * 10;
|
||||
@@ -193,8 +189,38 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.item {
|
||||
border-bottom: solid 0.5px var(--MI_THEME-divider);
|
||||
.transition_x_move {
|
||||
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
|
||||
}
|
||||
|
||||
.transition_x_enterActive {
|
||||
transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1);
|
||||
|
||||
&.content,
|
||||
.content {
|
||||
/* Skip Note Rendering有効時、TransitionGroupで通知を追加するときに一瞬がくっとなる問題を抑制する */
|
||||
content-visibility: visible !important;
|
||||
}
|
||||
}
|
||||
|
||||
.transition_x_leaveActive {
|
||||
transition: height 0.2s cubic-bezier(0,.5,.5,1), opacity 0.2s cubic-bezier(0,.5,.5,1);
|
||||
}
|
||||
|
||||
.transition_x_enterFrom {
|
||||
opacity: 0;
|
||||
transform: translateY(max(-64px, -100%));
|
||||
}
|
||||
|
||||
@supports (interpolate-size: allow-keywords) {
|
||||
.transition_x_enterFrom {
|
||||
interpolate-size: allow-keywords; // heightのtransitionを動作させるために必要
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.transition_x_leaveTo {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.notifications {
|
||||
@@ -202,6 +228,10 @@ defineExpose({
|
||||
background: var(--MI_THEME-panel);
|
||||
}
|
||||
|
||||
.item {
|
||||
border-bottom: solid 0.5px var(--MI_THEME-divider);
|
||||
}
|
||||
|
||||
.date {
|
||||
display: flex;
|
||||
font-size: 85%;
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div
|
||||
ref="rootEl"
|
||||
:class="[$style.root, {
|
||||
[$style.enter]: animatingIn && animating && !animatingOut,
|
||||
[$style.leave]: animatingOut,
|
||||
[$style.animating]: animating,
|
||||
}]"
|
||||
@animationend.self="onAnimationEnd"
|
||||
@animationcancel.self="onAnimationEnd"
|
||||
>
|
||||
<div ref="innerEl">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export const ITEM_REMOVAL_MS = 200;
|
||||
|
||||
const supportsInterpolateSize = CSS.supports('interpolate-size: allow-keywords');
|
||||
let resizeObserver: ResizeObserver | null = null;
|
||||
|
||||
if (!supportsInterpolateSize) {
|
||||
resizeObserver = new ResizeObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
const target = entry.target as HTMLElement;
|
||||
const root = target.parentElement;
|
||||
if (root != null) {
|
||||
root.style.setProperty('--child-height', `${entry.contentRect.height}px`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useTemplateRef, onMounted, onBeforeUnmount, ref, watch } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
animatingIn?: boolean;
|
||||
animatingOut?: boolean;
|
||||
}>();
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
const innerEl = useTemplateRef('innerEl');
|
||||
|
||||
const animating = ref(false);
|
||||
|
||||
watch([() => props.animatingIn, () => props.animatingOut], ([animatingIn, animatingOut]) => {
|
||||
if (animatingIn === true || animatingOut === true) animating.value = true;
|
||||
}, { immediate: true });
|
||||
|
||||
function onAnimationEnd() {
|
||||
// 削除アニメーション中(enterから差し替わった場合を含む)は、要素が消えるまで再生中扱いのままにする
|
||||
if (props.animatingOut === true) return;
|
||||
animating.value = false;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (resizeObserver != null && rootEl.value != null && innerEl.value != null) {
|
||||
resizeObserver.observe(innerEl.value);
|
||||
rootEl.value.style.setProperty('--child-height', `${innerEl.value.getBoundingClientRect().height}px`);
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (resizeObserver != null && innerEl.value != null) {
|
||||
resizeObserver.unobserve(innerEl.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style module lang="scss">
|
||||
.animating {
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.inner {
|
||||
display: flow-root;
|
||||
}
|
||||
|
||||
.enter {
|
||||
animation: enterAnim 0.7s cubic-bezier(0.23, 1, 0.32, 1) both;
|
||||
}
|
||||
|
||||
.leave {
|
||||
animation: leaveAnim 0.2s cubic-bezier(0,.5,.5,1) both;
|
||||
}
|
||||
|
||||
@supports (interpolate-size: allow-keywords) {
|
||||
.root {
|
||||
interpolate-size: allow-keywords;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes enterAnim {
|
||||
from {
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
transform: translateY(max(-64px, -100%));
|
||||
}
|
||||
|
||||
to {
|
||||
height: var(--child-height, auto);
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes leaveAnim {
|
||||
from {
|
||||
height: var(--child-height, auto);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -51,11 +51,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { isLink } from '@@/js/is-link.js';
|
||||
import { getUploadName } from '@/composables/use-uploader.js';
|
||||
import type { UploaderItem } from '@/composables/use-uploader.js';
|
||||
import { getUploadName } from '@/composables/use-uploader.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import bytes from '@/filters/bytes.js';
|
||||
import * as os from '@/os.js';
|
||||
import type { Content } from '@/components/MkLightbox.item.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
items: UploaderItem[];
|
||||
@@ -98,8 +100,25 @@ function onContextmenu(item: UploaderItem, ev: PointerEvent) {
|
||||
emit('showMenuViaContextmenu', item, ev);
|
||||
}
|
||||
|
||||
function onThumbnailClick(item: UploaderItem, ev: PointerEvent) {
|
||||
// TODO: preview when item is image
|
||||
async function onThumbnailClick(item: UploaderItem, ev: PointerEvent) {
|
||||
if (item.file.type.startsWith('image') || item.file.type.startsWith('video')) {
|
||||
const contents = props.items
|
||||
.filter(item => item.file.type.startsWith('image') || item.file.type.startsWith('video'))
|
||||
.map<Content>(item => ({
|
||||
id: item.id,
|
||||
type: (item.file.type.startsWith('video') ? 'video' : 'image'),
|
||||
url: item.objectUrl,
|
||||
thumbnailUrl: item.thumbnail,
|
||||
filename: getUploadName(item),
|
||||
}));
|
||||
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkLightbox.vue').then(x => x.default), {
|
||||
defaultIndex: contents.findIndex(content => content.id === item.id),
|
||||
contents: contents,
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import { i18n } from '@/i18n.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import { isWebpSupported } from '@/utility/isWebpSupported.js';
|
||||
import { uploadFile, UploadAbortedError } from '@/utility/drive.js';
|
||||
import type { Content } from '@/components/MkLightbox.item.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { ensureSignin } from '@/i.js';
|
||||
|
||||
@@ -74,6 +75,7 @@ export type UploaderItem = {
|
||||
compressedSize?: number | null;
|
||||
preprocessedFile?: Blob | null;
|
||||
file: File;
|
||||
objectUrl: string;
|
||||
watermarkPreset: WatermarkPreset | null;
|
||||
watermarkLayers: WatermarkLayers | null;
|
||||
imageFrameParams: ImageFrameParams | null;
|
||||
@@ -133,12 +135,13 @@ export function useUploader(options: {
|
||||
const filename = file.name ?? 'untitled';
|
||||
const extension = filename.split('.').length > 1 ? '.' + filename.split('.').pop() : '';
|
||||
const watermarkPreset = uploaderFeatures.value.watermark && $i.policies.watermarkAvailable ? (prefer.s.watermarkPresets.find(p => p.id === prefer.s.defaultWatermarkPresetId) ?? null) : null;
|
||||
const objectUrl = window.URL.createObjectURL(file);
|
||||
items.value.push({
|
||||
id,
|
||||
name: prefer.s.keepOriginalFilename ? filename : id + extension,
|
||||
suffix: '',
|
||||
progress: null,
|
||||
thumbnail: THUMBNAIL_SUPPORTED_TYPES.includes(file.type) ? window.URL.createObjectURL(file) : null,
|
||||
thumbnail: THUMBNAIL_SUPPORTED_TYPES.includes(file.type) ? objectUrl : null,
|
||||
preprocessing: false,
|
||||
preprocessProgress: null,
|
||||
uploading: false,
|
||||
@@ -150,6 +153,7 @@ export function useUploader(options: {
|
||||
watermarkLayers: watermarkPreset?.layers ?? null,
|
||||
imageFrameParams: null,
|
||||
file: markRaw(file),
|
||||
objectUrl,
|
||||
});
|
||||
const reactiveItem = items.value.at(-1)!;
|
||||
preprocess(reactiveItem).then(() => {
|
||||
@@ -163,8 +167,24 @@ export function useUploader(options: {
|
||||
}
|
||||
}
|
||||
|
||||
function removeItem(item: UploaderItem) {
|
||||
function revokeItemObjectUrls(item: UploaderItem) {
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
URL.revokeObjectURL(item.objectUrl);
|
||||
}
|
||||
|
||||
function createItemObjectUrl(item: UploaderItem, file: Blob | File): string {
|
||||
revokeItemObjectUrls(item);
|
||||
return window.URL.createObjectURL(file);
|
||||
}
|
||||
|
||||
function updateItemObjectUrls(item: UploaderItem, file: Blob | File) {
|
||||
const newObjectUrl = createItemObjectUrl(item, file);
|
||||
item.objectUrl = newObjectUrl;
|
||||
item.thumbnail = THUMBNAIL_SUPPORTED_TYPES.includes(file.type) ? newObjectUrl : null;
|
||||
}
|
||||
|
||||
function removeItem(item: UploaderItem) {
|
||||
revokeItemObjectUrls(item);
|
||||
items.value.splice(items.value.indexOf(item), 1);
|
||||
}
|
||||
|
||||
@@ -214,7 +234,35 @@ export function useUploader(options: {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
},
|
||||
}, {
|
||||
});
|
||||
|
||||
if (item.file.type.startsWith('image/') || item.file.type.startsWith('video/')) {
|
||||
menu.push({
|
||||
text: i18n.ts.preview,
|
||||
icon: 'ti ti-photo-search',
|
||||
action: async () => {
|
||||
const contents = items.value
|
||||
.filter(item => item.file.type.startsWith('image/') || item.file.type.startsWith('video/'))
|
||||
.map<Content>(item => ({
|
||||
id: item.id,
|
||||
type: item.file.type.startsWith('video/') ? 'video' : 'image',
|
||||
url: item.objectUrl,
|
||||
thumbnail: item.thumbnail,
|
||||
filename: getUploadName(item),
|
||||
caption: item.caption ?? null,
|
||||
}));
|
||||
|
||||
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkLightbox.vue').then(x => x.default), {
|
||||
defaultIndex: contents.findIndex(x => x.id === item.id),
|
||||
contents,
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
menu.push({
|
||||
type: 'divider',
|
||||
});
|
||||
}
|
||||
@@ -235,11 +283,12 @@ export function useUploader(options: {
|
||||
text: i18n.ts.cropImage,
|
||||
action: async () => {
|
||||
const cropped = await os.cropImageFile(item.file, { aspectRatio: null });
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
const newObjectUrl = createItemObjectUrl(item, cropped);
|
||||
items.value.splice(items.value.indexOf(item), 1, {
|
||||
...item,
|
||||
file: markRaw(cropped),
|
||||
thumbnail: window.URL.createObjectURL(cropped),
|
||||
thumbnail: THUMBNAIL_SUPPORTED_TYPES.includes(cropped.type) ? newObjectUrl : null,
|
||||
objectUrl: newObjectUrl,
|
||||
});
|
||||
const reactiveItem = items.value.find(x => x.id === item.id)!;
|
||||
preprocess(reactiveItem).then(() => {
|
||||
@@ -260,11 +309,12 @@ export function useUploader(options: {
|
||||
image: item.file,
|
||||
}, {
|
||||
ok: (file) => {
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
const newObjectUrl = createItemObjectUrl(item, file);
|
||||
items.value.splice(items.value.indexOf(item), 1, {
|
||||
...item,
|
||||
file: markRaw(file),
|
||||
thumbnail: window.URL.createObjectURL(file),
|
||||
thumbnail: THUMBNAIL_SUPPORTED_TYPES.includes(file.type) ? newObjectUrl : null,
|
||||
objectUrl: newObjectUrl,
|
||||
});
|
||||
const reactiveItem = items.value.find(x => x.id === item.id)!;
|
||||
preprocess(reactiveItem).then(() => {
|
||||
@@ -694,8 +744,7 @@ export function useUploader(options: {
|
||||
|
||||
imageBitmap.close();
|
||||
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
item.thumbnail = THUMBNAIL_SUPPORTED_TYPES.includes(preprocessedFile.type) ? window.URL.createObjectURL(preprocessedFile) : null;
|
||||
updateItemObjectUrls(item, preprocessedFile);
|
||||
item.preprocessedFile = markRaw(preprocessedFile);
|
||||
}
|
||||
|
||||
@@ -754,14 +803,13 @@ export function useUploader(options: {
|
||||
item.suffix = '';
|
||||
}
|
||||
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
item.thumbnail = THUMBNAIL_SUPPORTED_TYPES.includes(preprocessedFile.type) ? window.URL.createObjectURL(preprocessedFile) : null;
|
||||
updateItemObjectUrls(item, preprocessedFile);
|
||||
item.preprocessedFile = markRaw(preprocessedFile);
|
||||
}
|
||||
|
||||
function reset() {
|
||||
for (const item of items.value) {
|
||||
if (item.thumbnail != null) URL.revokeObjectURL(item.thumbnail);
|
||||
revokeItemObjectUrls(item);
|
||||
}
|
||||
|
||||
abortAll();
|
||||
|
||||
@@ -548,6 +548,8 @@ export class PreferencesManager extends EventEmitter<PreferencesManagerEvents> {
|
||||
|
||||
public renameProfile(name: string) {
|
||||
this.profile.name = name;
|
||||
// TODO: バックアップのキーが名前ベースであることを考えると名前=IDであるから、idも再生成する方が自然かもしれない
|
||||
// (将来名前ではなくIDをキーにするようになったとした場合、名前を変えたのにバックアップのキーが変わらないことになってしまう)
|
||||
this.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import { url as baseUrl } from '@@/js/config.js';
|
||||
import MkMarqueeText from '@/components/MkMarqueeText.vue';
|
||||
import { shuffle } from '@/utility/shuffle.js';
|
||||
|
||||
@@ -53,7 +54,11 @@ const tick = () => {
|
||||
if (props.shuffle) {
|
||||
shuffle(feed.items);
|
||||
}
|
||||
items.value = feed.items;
|
||||
items.value = feed.items.filter((item) => {
|
||||
if (!item.link) return false;
|
||||
const itemUrl = new URL(item.link, baseUrl);
|
||||
return ['http:', 'https:'].includes(itemUrl.protocol);
|
||||
});
|
||||
fetching.value = false;
|
||||
key.value++;
|
||||
});
|
||||
|
||||
@@ -17,8 +17,6 @@ export type MisskeyEntity = {
|
||||
id: string;
|
||||
createdAt: string;
|
||||
_shouldInsertAd_?: boolean;
|
||||
_shouldAnimateIn_?: boolean;
|
||||
_shouldAnimateOut_?: boolean;
|
||||
};
|
||||
|
||||
type AbsEndpointType = {
|
||||
@@ -109,8 +107,6 @@ export class Paginator<
|
||||
private canFetchDetection: 'safe' | 'limit' | null = null;
|
||||
private aheadQueue: T[] = [];
|
||||
private useShallowRef: SRef;
|
||||
private itemRemovalDelay: number | false;
|
||||
private removalTimers = new Map<string, number>();
|
||||
|
||||
// 配列内の要素をどのような順序で並べるか
|
||||
// newest: 新しいものが先頭 (default)
|
||||
@@ -142,9 +138,6 @@ export class Paginator<
|
||||
|
||||
useShallowRef?: SRef;
|
||||
|
||||
// アイテム削除時にアニメーションを待つ時間 (ms)
|
||||
itemRemovalDelay?: number | false;
|
||||
|
||||
canSearch?: boolean;
|
||||
searchParamName?: keyof E['req'];
|
||||
}) {
|
||||
@@ -167,7 +160,6 @@ export class Paginator<
|
||||
this.noPaging = props.noPaging ?? false;
|
||||
this.offsetMode = props.offsetMode ?? false;
|
||||
this.canSearch = props.canSearch ?? false;
|
||||
this.itemRemovalDelay = props.itemRemovalDelay ?? false;
|
||||
this.searchParamName = props.searchParamName ?? 'search';
|
||||
|
||||
this.getNewestId = this.getNewestId.bind(this);
|
||||
@@ -199,7 +191,6 @@ export class Paginator<
|
||||
}
|
||||
|
||||
public async init(): Promise<void> {
|
||||
this.clearRemovalTimers();
|
||||
this.items.value = [];
|
||||
this.aheadQueue = [];
|
||||
this.queuedAheadItemsCount.value = 0;
|
||||
@@ -393,8 +384,6 @@ export class Paginator<
|
||||
|
||||
public prepend(item: T): void {
|
||||
if (this.items.value.some(x => x.id === item.id)) return;
|
||||
item._shouldAnimateIn_ = true;
|
||||
item._shouldAnimateOut_ = false;
|
||||
this.items.value.unshift(item);
|
||||
this.trim(false);
|
||||
if (this.useShallowRef) triggerRef(this.items);
|
||||
@@ -410,10 +399,6 @@ export class Paginator<
|
||||
|
||||
public releaseQueue(): void {
|
||||
if (this.aheadQueue.length === 0) return; // これやらないと余計なre-renderが走る
|
||||
for (const item of this.aheadQueue) {
|
||||
item._shouldAnimateIn_ = false; // 一気に入るときは挿入アニメーションさせない
|
||||
item._shouldAnimateOut_ = false;
|
||||
}
|
||||
this.unshiftItems(this.aheadQueue);
|
||||
this.aheadQueue = [];
|
||||
this.queuedAheadItemsCount.value = 0;
|
||||
@@ -422,43 +407,13 @@ export class Paginator<
|
||||
public removeItem(id: string): void {
|
||||
// TODO: queueからも消す
|
||||
|
||||
if (this.itemRemovalDelay === false) {
|
||||
const index = this.items.value.findIndex(x => x.id === id);
|
||||
if (index !== -1) {
|
||||
this.items.value.splice(index, 1);
|
||||
if (this.useShallowRef) triggerRef(this.items);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const index = this.items.value.findIndex(x => x.id === id);
|
||||
if (index !== -1) {
|
||||
this.items.value.splice(index, 1);
|
||||
if (this.useShallowRef) triggerRef(this.items);
|
||||
|
||||
const item = this.items.value[index]!;
|
||||
item._shouldAnimateOut_ = true;
|
||||
if (this.useShallowRef) triggerRef(this.items);
|
||||
|
||||
if (this.removalTimers.has(id)) return;
|
||||
|
||||
this.removalTimers.set(id, window.setTimeout(() => {
|
||||
this.removalTimers.delete(id);
|
||||
const currentIndex = this.items.value.findIndex(x => x.id === id);
|
||||
if (currentIndex !== -1) {
|
||||
this.items.value.splice(currentIndex, 1);
|
||||
if (this.useShallowRef) triggerRef(this.items);
|
||||
}
|
||||
}, this.itemRemovalDelay + 20)); // アニメーション終了からやや余裕をもたせる
|
||||
}
|
||||
}
|
||||
|
||||
private clearRemovalTimers(): void {
|
||||
for (const timer of this.removalTimers.values()) {
|
||||
window.clearTimeout(timer);
|
||||
}
|
||||
this.removalTimers.clear();
|
||||
}
|
||||
|
||||
public updateItem(id: string, updater: (item: T) => T): void {
|
||||
// TODO: queueのも更新
|
||||
|
||||
|
||||
@@ -81,7 +81,11 @@ const tick = () => {
|
||||
window.fetch(fetchEndpoint.value, {})
|
||||
.then(res => res.json())
|
||||
.then((feed: Misskey.entities.FetchRssResponse) => {
|
||||
rawItems.value = feed.items;
|
||||
rawItems.value = feed.items.filter((item) => {
|
||||
if (!item.link) return false;
|
||||
const itemUrl = new URL(item.link, base);
|
||||
return ['http:', 'https:'].includes(itemUrl.protocol);
|
||||
});
|
||||
fetching.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -121,7 +121,11 @@ const tick = () => {
|
||||
window.fetch(fetchEndpoint.value, {})
|
||||
.then(res => res.json())
|
||||
.then((feed: Misskey.entities.FetchRssResponse) => {
|
||||
rawItems.value = feed.items;
|
||||
rawItems.value = feed.items.filter((item) => {
|
||||
if (!item.link) return false;
|
||||
const itemUrl = new URL(item.link, base);
|
||||
return ['http:', 'https:'].includes(itemUrl.protocol);
|
||||
});
|
||||
fetching.value = false;
|
||||
key.value++;
|
||||
});
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"tsx": "4.23.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-yaml": "5.2.1"
|
||||
"js-yaml": "5.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": "module",
|
||||
"name": "misskey-js",
|
||||
"version": "2026.7.0-beta.5",
|
||||
"version": "2026.7.0-rc.0",
|
||||
"description": "Misskey SDK for JavaScript",
|
||||
"license": "MIT",
|
||||
"main": "./built/index.js",
|
||||
|
||||
@@ -21879,6 +21879,15 @@ export interface operations {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Too many requests */
|
||||
429: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Internal server error */
|
||||
500: {
|
||||
headers: {
|
||||
|
||||
Generated
+20
-225
@@ -24,11 +24,11 @@ importers:
|
||||
specifier: 9.0.0
|
||||
version: 9.0.0
|
||||
js-yaml:
|
||||
specifier: 5.2.1
|
||||
version: 5.2.1
|
||||
specifier: 5.2.2
|
||||
version: 5.2.2
|
||||
tar:
|
||||
specifier: 7.5.20
|
||||
version: 7.5.20
|
||||
specifier: 7.5.21
|
||||
version: 7.5.21
|
||||
devDependencies:
|
||||
'@eslint/js':
|
||||
specifier: 9.39.5
|
||||
@@ -188,12 +188,9 @@ importers:
|
||||
'@fastify/multipart':
|
||||
specifier: 10.1.0
|
||||
version: 10.1.0
|
||||
'@fastify/otel':
|
||||
specifier: 0.20.1
|
||||
version: 0.20.1(@opentelemetry/api@1.9.1)
|
||||
'@fastify/static':
|
||||
specifier: 10.1.0
|
||||
version: 10.1.0
|
||||
specifier: 10.1.2
|
||||
version: 10.1.2
|
||||
'@kitajs/html':
|
||||
specifier: 4.2.13
|
||||
version: 4.2.13
|
||||
@@ -221,33 +218,6 @@ importers:
|
||||
'@nestjs/testing':
|
||||
specifier: 11.1.28
|
||||
version: 11.1.28(@nestjs/common@11.1.28(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.28)(@nestjs/platform-express@11.1.28)
|
||||
'@opentelemetry/api':
|
||||
specifier: 1.9.1
|
||||
version: 1.9.1
|
||||
'@opentelemetry/core':
|
||||
specifier: 2.9.0
|
||||
version: 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/exporter-trace-otlp-proto':
|
||||
specifier: 0.220.0
|
||||
version: 0.220.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/instrumentation':
|
||||
specifier: 0.219.0
|
||||
version: 0.219.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/instrumentation-pg':
|
||||
specifier: 0.72.0
|
||||
version: 0.72.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/resources':
|
||||
specifier: 2.9.0
|
||||
version: 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-trace-base':
|
||||
specifier: 2.9.0
|
||||
version: 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-trace-node':
|
||||
specifier: 2.9.0
|
||||
version: 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions':
|
||||
specifier: 1.43.0
|
||||
version: 1.43.0
|
||||
'@oxc-project/runtime':
|
||||
specifier: 0.139.0
|
||||
version: 0.139.0
|
||||
@@ -592,8 +562,8 @@ importers:
|
||||
specifier: 10.0.3
|
||||
version: 10.0.3
|
||||
js-yaml:
|
||||
specifier: 5.2.1
|
||||
version: 5.2.1
|
||||
specifier: 5.2.2
|
||||
version: 5.2.2
|
||||
pid-port:
|
||||
specifier: 2.1.1
|
||||
version: 2.1.1
|
||||
@@ -1230,8 +1200,8 @@ importers:
|
||||
packages/i18n:
|
||||
dependencies:
|
||||
js-yaml:
|
||||
specifier: 5.2.1
|
||||
version: 5.2.1
|
||||
specifier: 5.2.2
|
||||
version: 5.2.2
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: 26.1.1
|
||||
@@ -1941,11 +1911,6 @@ packages:
|
||||
'@fastify/multipart@10.1.0':
|
||||
resolution: {integrity: sha512-b2r6CovmLQvLFJ5HJDtxVigZjcO9TwkRGslhiNQxsGJwilm5B3eqvXPOVLudC44zXMXJITpQ/iEATIE7zoXqcQ==}
|
||||
|
||||
'@fastify/otel@0.20.1':
|
||||
resolution: {integrity: sha512-UG9gQUbqfBWcJNeO0bxj03xkoEE8NGJkIedN/red11elHFeZuVgoHKAx0x+wO4kGedyyQv8NWC62AdpGEvyM6g==}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.9.0
|
||||
|
||||
'@fastify/proxy-addr@5.1.0':
|
||||
resolution: {integrity: sha512-INS+6gh91cLUjB+PVHfu1UqcB76Sqtpyp7bnL+FYojhjygvOPA9ctiD/JDKsyD9Xgu4hUhCSJBPig/w7duNajw==}
|
||||
|
||||
@@ -1955,8 +1920,8 @@ packages:
|
||||
'@fastify/send@4.1.0':
|
||||
resolution: {integrity: sha512-TMYeQLCBSy2TOFmV95hQWkiTYgC/SEx7vMdV+wnZVX4tt8VBLKzmH8vV9OzJehV0+XBfg+WxPMt5wp+JBUKsVw==}
|
||||
|
||||
'@fastify/static@10.1.0':
|
||||
resolution: {integrity: sha512-iK/8TvRM/EgNOyQL+EpWu+x3aR6o4GWt+UI+27zmE7w6t/6d80mXqOtWLdEKQ13vL/g1Jry0ae2icj6GP7tGzA==}
|
||||
'@fastify/static@10.1.2':
|
||||
resolution: {integrity: sha512-G/g18cG9tLutT/OVyN1AIsHIl9L1UwmJ+S3dkyhVpplIx0nEMicd7RGQ+uJLyhKKF4a3tTcQydccn3Mop1fX+Q==}
|
||||
|
||||
'@file-type/xml@0.4.4':
|
||||
resolution: {integrity: sha512-NhCyXoHlVZ8TqM476hyzwGJ24+D5IPSaZhmrPj7qXnEVb3q6jrFzA3mM9TBpknKSI9EuQeGTKRg2DXGUwvBBoQ==}
|
||||
@@ -2649,10 +2614,6 @@ packages:
|
||||
'@open-draft/until@2.1.0':
|
||||
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
|
||||
|
||||
'@opentelemetry/api-logs@0.219.0':
|
||||
resolution: {integrity: sha512-FFx7YnaYJlIjqWW/AG/yAZ0L/NEY724PipXXXQLdtZPbLwBGbUMTGL1i/esI56TWfTUXxhLfpgrnWJCG8aUJyg==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
|
||||
'@opentelemetry/api-logs@0.220.0':
|
||||
resolution: {integrity: sha512-CmVa4ImJ+ynfrPMNaAXHET6Bhb44SwzmfyVJFq9ni2jgXJR/l7C6gfVFddNmHP+ZOkP9cf4f9DBe68qVLTHc9w==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
@@ -2661,84 +2622,30 @@ packages:
|
||||
resolution: {integrity: sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
|
||||
'@opentelemetry/context-async-hooks@2.9.0':
|
||||
resolution: {integrity: sha512-OQ0vzvbZBiUhjqLnUaoNfYmP8553Crr3aggB4y0ZUi815mZ7idpdJXQmoKdeBKJelYttoBlLSSHubmyw3wvX4w==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.0.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/core@2.9.0':
|
||||
resolution: {integrity: sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.0.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/exporter-trace-otlp-proto@0.220.0':
|
||||
resolution: {integrity: sha512-voTAD8XgJxlK7zLkXh8EzMB09zrQr3tyY/BsnDTlDiQU/UdK58MZ63A3mUjdEDrxMjCVmBHU3WQJhRmQe+Dvzg==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/instrumentation-pg@0.72.0':
|
||||
resolution: {integrity: sha512-p9xrFc/6R8t6Y293sTYLZ83LnzZo/qY0bBPA4xabdQt0Qjt8i1SlYFsIeGY2Jmf5WcESNUdjQB3NxWnt5Ox7zw==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/instrumentation@0.219.0':
|
||||
resolution: {integrity: sha512-X5t7I8GyIO9rmGHwoedZLREpQqrF1WW2nxzNNym6HOKpFiE+rvqV3ngC0xcZVO2YwIGf3KKmRdWrYwdwz3H9RQ==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/instrumentation@0.220.0':
|
||||
resolution: {integrity: sha512-xQx3E2WxP1mDvKzxLxX+CTCtNLa560YJZ3087qYHerl2YmiKpv7AH+dAy7vmx+eVrZ5BwhfWUAVoKOoxCNHcpw==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/otlp-exporter-base@0.220.0':
|
||||
resolution: {integrity: sha512-CXYo8UD5Mn9YbgebO2EL4wejtA+gxLmLiu6HCk2KH2BR7XhFN6/6p1UlCb23DYCjeYkndevLHuejCCN1yx4+OQ==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/otlp-transformer@0.220.0':
|
||||
resolution: {integrity: sha512-lXGrv7KXZ0gNH9SVNUaa6vv6phVYGvJxfXAlMbzbakiXru75f5MZl8Z7oqiMMQD77riVHJCFlQvbZs/VVN2/4A==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.3.0
|
||||
|
||||
'@opentelemetry/resources@2.9.0':
|
||||
resolution: {integrity: sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.3.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/sdk-logs@0.220.0':
|
||||
resolution: {integrity: sha512-WywcTkQtv2iNmt+6y5Kcd4rzvx9bLVsBa2Nwcmg01IUaBTkTow3W4d9KE5vNBpEDtb9tp21WcRBY/lANRrApYA==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.4.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/sdk-metrics@2.9.0':
|
||||
resolution: {integrity: sha512-Xx8RGS4H5XEBl01WuCreMIpiah9cCXMbSkeuIePPdD2cUpq/vUzYmj8E/MK1OsbOc93FuAD4jfn2WOacKwLn7Q==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.9.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/sdk-trace-base@2.9.0':
|
||||
resolution: {integrity: sha512-cp9zmTl62R8PJrpvFcmc8N2JQU/xfa0S+61q511Nji+QxCfZ8Ifvg7H27G8cANe4crg4RTrWsVvanHiXjSp6ag==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.3.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/sdk-trace-node@2.9.0':
|
||||
resolution: {integrity: sha512-ec9a7ps37huy5itYk0MalaZdSLlM6AXWp/FhtEjgMpp5leEGojBDvAl/UWttQnkMZOvFHKzRESn8TD3yKTF5nQ==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': '>=1.0.0 <1.10.0'
|
||||
|
||||
'@opentelemetry/sdk-trace@2.9.0':
|
||||
resolution: {integrity: sha512-sGA19HvtrrSKYsseHphluH6j3p6Xa3fqc7c7y8f/7mYWejc1lyDFcpSdD1kYa50HCLUeEo4zA5bW0pniaPszuw==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
@@ -2749,12 +2656,6 @@ packages:
|
||||
resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@opentelemetry/sql-common@0.42.0':
|
||||
resolution: {integrity: sha512-nwUwUU+8O8a4bnLqk6CodWeegGMEANgC94KTAhXcpGWLrW/2/hek/0ajNbjXnSOoNuCX+nteUPs46HFHhou9Xw==}
|
||||
engines: {node: ^18.19.0 || >=20.6.0}
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.1.0
|
||||
|
||||
'@oxc-parser/binding-android-arm-eabi@0.127.0':
|
||||
resolution: {integrity: sha512-0LC7ye4hvqbIKxAzThzvswgHLFu2AURKzYLeSVvLdu2TBOYWQDmHnTqPLeA597BcUCxiLqLsS4CJ5uoI5WYWCQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
@@ -4036,12 +3937,6 @@ packages:
|
||||
'@types/offscreencanvas@2019.7.3':
|
||||
resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==}
|
||||
|
||||
'@types/pg-pool@2.0.7':
|
||||
resolution: {integrity: sha512-U4CwmGVQcbEuqpyju8/ptOKg6gEC+Tqsvj2xS9o1g71bUh8twxnC6ZL5rZKCsGN0iyH0CwgUyc9VR5owNQF9Ng==}
|
||||
|
||||
'@types/pg@8.15.6':
|
||||
resolution: {integrity: sha512-NoaMtzhxOrubeL/7UZuNTrejB4MPAJ0RpxZqXQf2qXuVlTPuG6Y8p4u9dKRaue4yjmC7ZhzVO2/Yyyn25znrPQ==}
|
||||
|
||||
'@types/pg@8.20.0':
|
||||
resolution: {integrity: sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==}
|
||||
|
||||
@@ -6500,8 +6395,8 @@ packages:
|
||||
resolution: {integrity: sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==}
|
||||
hasBin: true
|
||||
|
||||
js-yaml@5.2.1:
|
||||
resolution: {integrity: sha512-zfLtNfQqxVqq3uaTqSkh4x4hZw3KHobGUA0fJUj4wawW8bsQLTVqpHdXSIzidh7o+4lEW36tANuAGdaFx6Zgnw==}
|
||||
js-yaml@5.2.2:
|
||||
resolution: {integrity: sha512-dayzUzKkJ1MkuUtZglSebU43utNXH0OWQByK9rKOOuYIO8M5TV1y+n8ALMdG0rdzBnfNkOmZEqrURepb0ejqBw==}
|
||||
hasBin: true
|
||||
|
||||
jsbn@0.1.1:
|
||||
@@ -8613,8 +8508,8 @@ packages:
|
||||
tar-stream@3.2.0:
|
||||
resolution: {integrity: sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg==}
|
||||
|
||||
tar@7.5.20:
|
||||
resolution: {integrity: sha512-9FcyK4PA6+WbzlTM9WhQm6vB5W7cP7dUiPsv1g7YDwEQnQ1CGpK3MGlKk/ITVWMk05kHZuBhmVhiv8LZoy/PFQ==}
|
||||
tar@7.5.21:
|
||||
resolution: {integrity: sha512-XdhtCvlMywwxpCW8YEq3lOXBJpUPTR2OHHcwLPO3HwsJqOHa2Ok/oJ7ruGzp+JrKoRPVCzJwAdEjqLW/vNRPHA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
taskkill@5.0.0:
|
||||
@@ -10055,16 +9950,6 @@ snapshots:
|
||||
fastify-plugin: 6.0.0
|
||||
secure-json-parse: 4.1.0
|
||||
|
||||
'@fastify/otel@0.20.1(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/instrumentation': 0.219.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
minimatch: 10.2.5
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@fastify/proxy-addr@5.1.0':
|
||||
dependencies:
|
||||
'@fastify/forwarded': 3.0.1
|
||||
@@ -10088,7 +9973,7 @@ snapshots:
|
||||
http-errors: 2.0.1
|
||||
mime: 3.0.0
|
||||
|
||||
'@fastify/static@10.1.0':
|
||||
'@fastify/static@10.1.2':
|
||||
dependencies:
|
||||
'@fastify/accept-negotiator': 2.0.1
|
||||
'@fastify/error': 4.2.0
|
||||
@@ -10673,55 +10558,17 @@ snapshots:
|
||||
|
||||
'@open-draft/until@2.1.0': {}
|
||||
|
||||
'@opentelemetry/api-logs@0.219.0':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
|
||||
'@opentelemetry/api-logs@0.220.0':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
|
||||
'@opentelemetry/api@1.9.1': {}
|
||||
|
||||
'@opentelemetry/context-async-hooks@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
|
||||
'@opentelemetry/core@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
|
||||
'@opentelemetry/exporter-trace-otlp-proto@0.220.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/otlp-exporter-base': 0.220.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/otlp-transformer': 0.220.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/resources': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-trace': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@opentelemetry/instrumentation-pg@0.72.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/instrumentation': 0.220.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
'@opentelemetry/sql-common': 0.42.0(@opentelemetry/api@1.9.1)
|
||||
'@types/pg': 8.15.6
|
||||
'@types/pg-pool': 2.0.7
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@opentelemetry/instrumentation@0.219.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/api-logs': 0.219.0
|
||||
import-in-the-middle: 3.0.1
|
||||
require-in-the-middle: 8.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@opentelemetry/instrumentation@0.220.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
@@ -10731,42 +10578,12 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@opentelemetry/otlp-exporter-base@0.220.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/otlp-transformer': 0.220.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@opentelemetry/otlp-transformer@0.220.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/api-logs': 0.220.0
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/resources': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-logs': 0.220.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-metrics': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-trace': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@opentelemetry/resources@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
|
||||
'@opentelemetry/sdk-logs@0.220.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/api-logs': 0.220.0
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/resources': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
|
||||
'@opentelemetry/sdk-metrics@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/resources': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@opentelemetry/sdk-trace-base@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
@@ -10775,13 +10592,6 @@ snapshots:
|
||||
'@opentelemetry/sdk-trace': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
|
||||
'@opentelemetry/sdk-trace-node@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/context-async-hooks': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
'@opentelemetry/sdk-trace-base': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@opentelemetry/sdk-trace@2.9.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
@@ -10791,11 +10601,6 @@ snapshots:
|
||||
|
||||
'@opentelemetry/semantic-conventions@1.43.0': {}
|
||||
|
||||
'@opentelemetry/sql-common@0.42.0(@opentelemetry/api@1.9.1)':
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.1
|
||||
'@opentelemetry/core': 2.9.0(@opentelemetry/api@1.9.1)
|
||||
|
||||
'@oxc-parser/binding-android-arm-eabi@0.127.0':
|
||||
optional: true
|
||||
|
||||
@@ -12027,16 +11832,6 @@ snapshots:
|
||||
|
||||
'@types/offscreencanvas@2019.7.3': {}
|
||||
|
||||
'@types/pg-pool@2.0.7':
|
||||
dependencies:
|
||||
'@types/pg': 8.20.0
|
||||
|
||||
'@types/pg@8.15.6':
|
||||
dependencies:
|
||||
'@types/node': 26.1.1
|
||||
pg-protocol: 1.15.0
|
||||
pg-types: 2.2.0
|
||||
|
||||
'@types/pg@8.20.0':
|
||||
dependencies:
|
||||
'@types/node': 26.1.1
|
||||
@@ -15042,7 +14837,7 @@ snapshots:
|
||||
dependencies:
|
||||
argparse: 2.0.1
|
||||
|
||||
js-yaml@5.2.1:
|
||||
js-yaml@5.2.2:
|
||||
dependencies:
|
||||
argparse: 2.0.1
|
||||
|
||||
@@ -15928,7 +15723,7 @@ snapshots:
|
||||
nopt: 10.0.1
|
||||
proc-log: 7.0.0
|
||||
semver: 7.8.5
|
||||
tar: 7.5.20
|
||||
tar: 7.5.21
|
||||
tinyglobby: 0.2.17
|
||||
undici: 6.25.0
|
||||
which: 7.0.0
|
||||
@@ -17586,7 +17381,7 @@ snapshots:
|
||||
- bare-buffer
|
||||
- react-native-b4a
|
||||
|
||||
tar@7.5.20:
|
||||
tar@7.5.21:
|
||||
dependencies:
|
||||
'@isaacs/fs-minipass': 4.0.1
|
||||
chownr: 3.0.0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user