Skip to content

Commit

Permalink
configurable telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaamani committed Jul 19, 2023
1 parent 48a37b4 commit d03a689
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ APP_PRIVATE_KEY=this-is-not-so-secret-change-it
TRUSTED_REVERSE_PROXIES=1
# =====================================================================================

## Telemetry
# yes/no
TELEMETRY_ENABLED=no
# TELEMETRY_ENDPOINT=http://apm-server:8200
TELEMETRY_ENDPOINT=http://collector:4318

# joystream/node docker image tag
# We do not provide a default value - scripts that startup a joystream-node service
# Should be explicit about what version to use.
Expand Down
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ services:
environment:
# ACCOUNT_URI overrides command line arg --accountUri
- ACCOUNT_URI=${COLOSSUS_1_TRANSACTOR_URI}
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://apm-server:8200
# - OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production
entrypoint: ['yarn']
- OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT}
- OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production
entrypoint: ['/joystream/entrypoints/storage.sh']
command: [
'start', '--worker=${COLOSSUS_1_WORKER_ID}', '--port=3333', '--uploads=/data',
'server', '--worker=${COLOSSUS_1_WORKER_ID}', '--port=3333', '--uploads=/data',
'--sync', '--syncInterval=1',
'--queryNodeEndpoint=${COLOSSUS_QUERY_NODE_URL}',
'--apiUrl=${JOYSTREAM_NODE_WS}',
Expand Down Expand Up @@ -74,14 +74,14 @@ services:
JOYSTREAM_DISTRIBUTOR__DIRECTORIES__ASSETS: /data
JOYSTREAM_DISTRIBUTOR__DIRECTORIES__CACHE_STATE: /cache
JOYSTREAM_DISTRIBUTOR__LOGS__FILE__PATH: /logs
# OTEL_EXPORTER_OTLP_ENDPOINT: http://apm-server:8200
# OTEL_RESOURCE_ATTRIBUTES: service.name=distributor-1,deployment.environment=production
OTEL_EXPORTER_OTLP_ENDPOINT: ${TELEMETRY_ENDPOINT}
OTEL_RESOURCE_ATTRIBUTES: service.name=distributor-1,deployment.environment=production
# JOYSTREAM_DISTRIBUTOR__LOGS__CONSOLE: "off"
# JOYSTREAM_DISTRIBUTOR__LOGS__FILE: "off"
# JOYSTREAM_DISTRIBUTOR__LOGS__ELASTIC: "{\"level\":\"debug\",\"endpoint\":\"http://elasticsearch:9200\"}"
# JOYSTREAM_DISTRIBUTOR__LIMITS__STORAGE: 50G
# JOYSTREAM_DISTRIBUTOR__BUCKETS: "[\"1:0\",\"1:1\"]"
entrypoint: ['yarn']
entrypoint: ['/joystream/entrypoints/distributor.sh']
command: ['start']

colossus-2:
Expand Down Expand Up @@ -200,8 +200,8 @@ services:
- GRAPHQL_PLAYGROUND_ENDPOINT=${GRAPHQL_PLAYGROUND_ENDPOINT}
- GRAPHQL_PLAYGROUND_SUBSCRIPTION_ENDPOINT=${GRAPHQL_PLAYGROUND_SUBSCRIPTION_ENDPOINT}
- GRAPHQL_PLAYGROUND_CDN_URL=${GRAPHQL_PLAYGROUND_CDN_URL}
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://apm-server:8200
# - OTEL_RESOURCE_ATTRIBUTES=service.name=query-node,deployment.environment=production
- OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT}
- OTEL_RESOURCE_ATTRIBUTES=service.name=query-node,deployment.environment=production
ports:
- "${GRAPHQL_SERVER_PORT}:${GRAPHQL_SERVER_PORT}"
- "127.0.0.1:${PROCESSOR_STATE_APP_PORT}:${PROCESSOR_STATE_APP_PORT}"
Expand All @@ -212,7 +212,7 @@ services:
source: .
target: /joystream
working_dir: /joystream
command: ['yarn', 'workspace', 'query-node-root', 'query-node:start:prod']
entrypoint: ['/joystream/entrypoints/graphql-server.sh']

processor:
image: node:14
Expand Down
8 changes: 8 additions & 0 deletions entrypoints/distributor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# docker entrypoint fot distributor node, to allow running with telemetry
if [[ "$TELEMETRY_ENABLED" = "yes" ]] && [[ $1 = "start" ]]; then
node --require @joystream/opentelemetry /joystream/distributor-node/bin/run $*
else
/joystream/distributor-node/bin/run $*
fi
8 changes: 8 additions & 0 deletions entrypoints/graphql-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# docker entrypoint fot graphql-server, to allow running with telemetry
if [[ "$TELEMETRY_ENABLED" = "yes" ]]; then
yarn workspace query-node-root query-node:start:prod:with-instrumentation $*
else
yarn workspace query-node-root query-node:start:prod $*
fi
8 changes: 8 additions & 0 deletions entrypoints/storage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# docker entrypoint fot storage node, to allow running with telemetry
if [[ "$TELEMETRY_ENABLED" = "yes" ]] && [[ $1 = "server" ]]; then
node --require @joystream/opentelemetry /joystream/storage-node/bin/run $*
else
/joystream/storage-node/bin/run $*
fi

0 comments on commit d03a689

Please sign in to comment.