Skip to content

Commit

Permalink
chore: inject newlines to improve readability of just otel-stream o…
Browse files Browse the repository at this point in the history
…utput (#2078)

Part 3 of #2020 

This PR injects newlines between blocks in `just otel-stream`'s docker
container output. We should ideally add
[color](https://www.unix.com/unix-for-dummies-questions-and-answers/134824-using-sed-change-specific-words-color.html)
+ bolding to this as well, which can be done by piping to a very similar
`sed` command, but moving forward without that for now to save time.

Example snippet of the output:
```
Metric #2
Descriptor:
     -> Name: rpc.server.response.size
     -> Description: Measures size of RPC response messages (uncompressed).
     -> Unit: By
     -> DataType: Histogram
     -> AggregationTemporality: Cumulative

HistogramDataPoints #0
Data point attributes:
     -> rpc.grpc.status_code: Int(0)
     -> rpc.method: Str(Ping)
     -> rpc.service: Str(xyz.block.ftl.v1.VerbService)
     -> rpc.system: Str(grpc)
StartTimestamp: 2024-07-16 00:02:17.426033 +0000 UTC
Timestamp: 2024-07-16 00:02:37.427409 +0000 UTC
Count: 1
Sum: 0.000000
Min: 0.000000
Max: 0.000000

ExplicitBounds #0: 0.000000

ExplicitBounds #1: 5.000000

ExplicitBounds #2: 10.000000
```
  • Loading branch information
deniseli authored Jul 16, 2024
1 parent 6d72743 commit 2938311
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,13 @@ otel-ui:
# `just otel-dev` with any args you would pass to `ftl dev`. To stop the otel stream, run
# `just otel-stop` in a third terminal tab.
otel-stream:
#!/bin/bash

docker run \
-p {{otelGrpcPort}}:{{otelGrpcPort}} \
-p 55679:55679 \
otel/opentelemetry-collector:0.104.0
otel/opentelemetry-collector:0.104.0 2>&1 | sed 's/\([A-Z].* #\)/\
\1/g'

# Stop the docker container running otel.
otelContainerID := `docker ps -f ancestor=otel/opentelemetry-collector:0.104.0 | tail -1 | cut -d " " -f1`
Expand All @@ -218,6 +221,6 @@ otel-stop:
otel-dev *args:
#!/bin/bash

gprcPort=$(cat docker-compose.yml | grep "OTLP gRPC" | sed 's/:.*//' | sed -r 's/ +- //')
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:${gprcPort}"
grpcPort=$(cat docker-compose.yml | grep "OTLP gRPC" | sed 's/:.*//' | sed -r 's/ +- //')
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:${grpcPort}"
ftl dev {{args}}

0 comments on commit 2938311

Please sign in to comment.