Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(mockotlpserver): some light doc improvements now that we have a Docker image #495

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions packages/mockotlpserver/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
A mock OTLP server/receiver for development.
# @elastic/mockotlpserver

`mockotlpserver` starts HTTP and gRPC servers (on the default ports) for
A mock OTLP (OpenTelemetry Protocol) server/receiver for development and testing.

`mockotlpserver` starts HTTP and gRPC servers (on the default OTLP ports) for
receiving OTLP requests. The data in those requests are printed to the
console. Various output formats are supported.

Expand All @@ -12,22 +14,26 @@ It also supports being run from Node.js code. This is used in the
3. get the received OTLP data from the mock server and make assertions on that data.


# Install
# CLI Usage

To use the mock server, first **start the server**. You can start it via `npx`,
if you use that:

```
npm install @elastic/mockotlpserver
npx @elastic/mockotlpserver
```

# CLI Usage

To use the mock server, (a) start the server then (b) send OTLP data to it.
The package installs a `mockotlpserver` CLI tool.
or via the published `ghcr.io/elastic/elastic-otel-node/mockotlpserver` Docker image:

```
npx mockotlpserver
docker run --rm -it -p 4317:4317 -p 4318:4318 --name mockotlpserver \
ghcr.io/elastic/elastic-otel-node/mockotlpserver:latest
```

By default it will output received OTLP data in two forms:
Then, **send OTLP data to it**.


By default, mockotlpserver will output received OTLP data in two forms:

1. `inspect` format: Uses Node.js's `util.inspect()` (used under the hood for
`console.log`). This shows the complete object structure of the received
Expand Down Expand Up @@ -57,7 +63,6 @@ node -r @elastic/opentelemetry-node simple-http-request.js
% node lib/cli.js
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://[::1]:4318/","time":"2024-01-11T22:18:49.017Z"}
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://localhost:4317/","time":"2024-01-11T22:18:49.025Z"}
{"name":"mockotlpserver","level":30,"msg":"UI listening at http://[::1]:8080/","time":"2024-01-11T22:18:49.026Z"}
ExportTraceServiceRequest {
resourceSpans: [
ResourceSpans {
Expand Down
Loading