couchdb
couchdb copied to clipboard
Distinguish updates
Overview
This PR allow us to distinguish between new doc and update of the existent doc for tracing.
Testing recommendations
- update rel/overlay/etc/default.ini as follows
rel/overlay/etc/default.ini
[tracing]
enabled = true ; true | false
app_name = couchdb ; value to use for the `location.application` tag
protocol = http ; udp | http - which reporter to use
endpoint = http://127.0.0.1:14268
[tracing.filters]
all = (#{}) -> true
- start jaeger in docker container
docker run -d -p 6831:6831/udp -p 16686:16686 -p 14268:14268 jaegertracing/all-in-one:1.14
- Start couchdb
dev/run --admin=adm:pass --no-join
- Create database curl -X PUT -u adm:pass http://127.0.0.1:15984/test
- Create document
curl -X PUT -u adm:pass http://127.0.0.1:15984/test -H Content-Type:application/json -d '{"_id":"doc1"}'
- Update document
curl -X PUT -u adm:pass "http://127.0.0.1:15984/test/doc1?rev=8-4f98b201f7a6f147a952fe70651f0a95" -H Content-Type:application/json -d '{"_id":"doc1","val": 4}'
- Update document
curl -X PUT -u adm:pass "http://127.0.0.1:15984/test/doc1" -H Content-Type:application/json -d '{"_id":"doc1","dfd": 4, "_rev": "11-fdcab8b70c87eb64255f504a5d983ab0"}'
- Open http://localhost:16686/ in the browser and search for spans (you should find some traces)
- the first event should have action equal to
db.doc.write
- the second event should have action equal to
db.doc.update
- the third event should have action equal to
db.doc.update
- the first event should have action equal to
Related Issues or Pull Requests
N/A
Checklist
- [x] Code is written and works correctly
- [ ] Changes are covered by tests
- [ ] Any new configurable parameters are documented in
rel/overlay/etc/default.ini
- [ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation