Conversation
andrewplummer
left a comment
There was a problem hiding this comment.
I think maybe your prettier settings got weird? (all the double quotes)
| }); | ||
| const options = {}; | ||
| if (options.getSpanContext) { | ||
| options.getTracePayload = function getTracePayload() { |
There was a problem hiding this comment.
So what does this look like on the app side to set up? I'm all for the idea of separating it but I think we want to make sure that it's easy and doesn't add too much boilerplate...
There was a problem hiding this comment.
Just to provide additional context: For wqet, we have been using opentelemetry for handling metrics. This is nice because it allows us to not only export to google cloud but also if we want to enable it in other environment like AWS, Azure, Grafana, and more we can, without too much trouble.
Opentelemetry metrics requires a number of packages and also share some packages/config with the tracing. Also there is an intersection with the google export packages (https://github.com/GoogleCloudPlatform/opentelemetry-operations-js). Attempting to encapsulate specific opentelemetry packages within a logging library seems like a bad idea now. As its larger than just logging.
I have done a very early attempt on how this would look like in bedrock.
You can find the draft here: bedrockio/bedrock-core#243.
There was a problem hiding this comment.
Ok so basically we're taking the wiring out of this package which removes the opentelemetry deps and puts it back into bedrock-core. I get the concept and I like it as there's only a light coupling between logger <-> tracing but what I don't like is putting all these dependencies back into bedrock core. What if we create another package like @bedrockio/tracing instead and wire them up in the actual app something like this:
const logger = require('@bedrockio/logger');
const tracing = require('@bedrockio/tracing');
logger.useGoogleCloud({
// This part is totally made up... whatever is the minimal
// amount of wiring to get these 2 packages hooked together
getSpan: tracing.getSpan,
});One thing I forgot to mention (and part of the reason I didn't want to move tracing out of this package to begin with) is that you'll have to do this in a lot of different places, not just the main app entrypoint. For each and every job you'll need to have the above code in each one. For jobs tracing can always be enabled as you're never expected to run them outside GCP context, however other scripts may or may not require it as well... it's a lot of boilerplate.
|
Re the formatting, i think we are missing a prettierrc file ... trying to add the file and I get this lovely error I suspect you hit the same issue and left it ... this esm is causing so much fiction. |
This removes open-telemetry from the package but offers an api to get the tracing.
This allows us more freedom in how a given project is configured around opentelementry.