Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Decide on the specification for key names for log correlation #195

Closed
sebright opened this issue Oct 8, 2018 · 17 comments
Closed

Decide on the specification for key names for log correlation #195

sebright opened this issue Oct 8, 2018 · 17 comments
Labels

Comments

@sebright
Copy link
Contributor

sebright commented Oct 8, 2018

This issue is for continuing the discussion about key names used in log correlation from #181 (comment) .

/cc @rakyll @Ramonza @adriancole @bogdandrutu

@codefromthecrypt
Copy link

maybe add to the description the current state and the proposed one?

@sebright
Copy link
Contributor Author

sebright commented Oct 9, 2018

I was planning to add the current state after I merge #181, since the key specification could still change. I didn't want to forget to open an issue, though.

sebright added a commit to sebright/opencensus-specs that referenced this issue Oct 9, 2018
@sebright
Copy link
Contributor Author

sebright commented Oct 9, 2018

Here is the specification for key names after #181 was merged, though the whole specification for log correlation is currently labeled as a draft:

Key names for tracing data

Some logging frameworks allow the insertion of arbitrary key-value pairs into log entries. When
a log correlation implementation inserts tracing data by that method, the key names should be
"opencensusTraceId", "opencensusSpanId", and "opencensusTraceSampled" by default. The log
correlation implementation may allow the user to override the tracing data key names.

@sebright
Copy link
Contributor Author

sebright commented Oct 9, 2018

There were two main suggested changes in #181 (comment):

  • Use shorter key names.
  • Allow each implementation to use a format that is consistent with the language/logging framework that it supports.

@yurishkuro
Copy link

What information is the opencensus prefix trying to add? If you call them just traceId/spanId, would it not cover the needs of most people?

@sebright
Copy link
Contributor Author

sebright commented Oct 9, 2018

I thought that it might be better to add "opencensus" to avoid conflicting with key-value pairs that other libraries insert into the log entry or logging context. However, conflicts probably won't be an issue if all log correlation implementations also provide a way to override the key names when necessary.

@yurishkuro
Copy link

It seems there's little chance of having another tracing lib and OpenCensus in the same application, so chance of clashes in one service are negligible. Across services - sure, but then if they interoperate on tracing then you'd still expect trace id to be the same (otherwise what's the point).

Better to allow overriding the fields for rare scenarios and default them to most intuitive names for everyone else.

@codefromthecrypt
Copy link

codefromthecrypt commented Oct 9, 2018 via email

sebright added a commit to sebright/opencensus-specs that referenced this issue Oct 11, 2018
…on#195).

This commit removes the "openCensus" prefix from all key names in the log
correlation spec.  The shorter key names are simpler and could improve
performance when the keys are included in the logs.
@sebright
Copy link
Contributor Author

I made a PR for shorter key names: #199

sebright added a commit that referenced this issue Oct 16, 2018
This commit removes the "openCensus" prefix from all key names in the log
correlation spec.  The shorter key names are simpler and could improve
performance when the keys are included in the logs.
@sebright
Copy link
Contributor Author

I merged #199, so the current key names are "traceId", "spanId", and "traceSampled".

@sebright
Copy link
Contributor Author

Does anyone object to removing "draft" from the log correlation spec now that it uses the short key names? I would prefer to continue specifying the exact key names, since I think it is simpler than allowing multiple key formats or specifying different keys for different languages.

There are still several TODOs for features such as parent span ID but I think those could be added later without any backwards compatibility issues.

@codefromthecrypt
Copy link

in general do we have a gate for removing draft? like a few libraries supporting it?

@sebright
Copy link
Contributor Author

Step 3 in https://github.com/census-instrumentation/opencensus-specs/blob/master/Process.md#step-3-specs-pull-request recommends creating a pull request implementing the change in at least one language, though I don't see any guidelines on testing the feature in a released library.

/cc @bogdandrutu

@codefromthecrypt
Copy link

codefromthecrypt commented Oct 16, 2018 via email

@c24t
Copy link
Member

c24t commented Oct 17, 2018

For the moment we have only Java and Go here. Can we get some input from other languages?

FWIW I don't see any problem using these names in python since they don't overlap with the built in LogRecord attributes. This is assuming we'll pass the context info to the logger with the extra kwarg.

And camelCase may be unconventional in python, but not so unconventional that the logging library doesn't use it itself!

@sebright
Copy link
Contributor Author

I opened an issue for requiring each new feature to be implemented in a few libraries: #202. So far, log correlation has been implemented in two libraries, https://github.com/census-instrumentation/opencensus-java/tree/master/contrib/log_correlation/log4j2 and https://github.com/census-instrumentation/opencensus-java/tree/master/contrib/log_correlation/stackdriver.

@sebright
Copy link
Contributor Author

Closing, since I updated the key names in #199 and finalized the spec in #203.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants