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

inject session UUID into root context #435

Closed
2 tasks
btc opened this issue Dec 9, 2014 · 3 comments
Closed
2 tasks

inject session UUID into root context #435

btc opened this issue Dec 9, 2014 · 3 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@btc
Copy link
Contributor

btc commented Dec 9, 2014

There's a context.Context created at the top of main.go.

ctx := context.Background()

What would we gain if we were to inject a UUID into it using the eventlog library?

ctx := eventlog.ContextWithLoggable(context.Background(), eventlog.UUID("session"))

With this in place, perhaps...

  1. it would be possible to tie together all events that occur during program execution.
  2. contexts created midway through execution would be revealed (The session UUID will be missing when events are logged)

To make this a reality, it would be necessary to...

  • remove all extraneous context.TODOs and context.Backgrounds
  • pass contexts through all function calls

Eventlog output would look like this...

{"event":"updatePeer","remotePeer":{"id":"QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","latency":89949944},"session":"893c8d83-dfdf-400c-bf9f-b0541fd2597b","system":"dht","time":"2014-12-09T14:50:29.920815354Z"}
@btc btc added the kind/enhancement A net-new feature or improvement to an existing feature label Dec 9, 2014
@jbenet
Copy link
Member

jbenet commented Dec 9, 2014

@maybebtc sgtm. may also be good to make a session object, which could include our metrics object

# yml for easy typing
id: <uuid>
timeStart: <ISO datetime>   # gives us uptime
metrics:
  bandwidth: { "in": <num>, "out": <num bytes> }
  protocolMessages: # per-protocol msg counts
    total: { "in": <num>, "out": <num bytes> }
    handshakes: { "in": <num>, "out": <num bytes> }
    bitswap: { "in": <num>, "out": <num bytes> }
    dht: { "in": <num>, "out": <num bytes> }
    ...
  clientRequests: # per-command counts
    total: <num>
    add: <num>
    ls: <num>
    ...

and so on.

@jbenet
Copy link
Member

jbenet commented Dec 9, 2014

hm, that might be too much data to dump out on every request... maybe these are two separate things.:

# the session (logged with everything)
<uuid>

# the metrics, logged periodically (minute?)
uptime:
  timeStart: <ISO datetime>
  timeOnline: <now - uptime.timeStart>
bandwidth: { "in": <num>, "out": <num bytes> }
protocolMessages: # per-protocol msg counts
  total: { "in": <num>, "out": <num bytes> }
  handshakes: { "in": <num>, "out": <num bytes> }
  bitswap: { "in": <num>, "out": <num bytes> }
  dht: { "in": <num>, "out": <num bytes> }
  ...
clientRequests: # per-command counts
  total: <num>
  add: <num>
  ls: <num>
  ...

@btc btc self-assigned this Dec 9, 2014
@btc btc added the status/in-progress In progress label Dec 9, 2014
@btc
Copy link
Contributor Author

btc commented Dec 14, 2014

added in #436

further work:

  • more metadata
  • remove all extraneous context.TODOs and context.Backgrounds
  • pass contexts through all function calls

@btc btc closed this as completed Dec 14, 2014
@btc btc removed the status/in-progress In progress label Dec 14, 2014
@btc btc removed their assignment Mar 30, 2015
@aschmahmann aschmahmann mentioned this issue Aug 23, 2021
62 tasks
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this issue Oct 23, 2021
…com/hashicorp/golang-lru-0.5.4

build(deps): bump github.com/hashicorp/golang-lru from 0.5.3 to 0.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants