Structured logs with genkit and firebase #412
Replies: 2 comments 3 replies
-
@pascalbe-dev thanks for writing in! Could you post what your Genkit config (if you feel comfortable, if not, just the telemetry {} section of it would be helpful) looks like? |
Beta Was this translation helpful? Give feedback.
-
@pascalbe-dev Thanks for posting your config. When you deploy your flow to Cloud, all console logs get automatically exported (in this case, not in the most optimal format). In order to get structured logs, you'd need to include the import { googleCloud } from '@genkit-ai/google-cloud';
import { AlwaysOnSampler } from '@opentelemetry/sdk-trace-base';
...
configureGenkit({
plugins: [
firebase(),
googleAI(),
dotprompt(),
googleCloud({
telemetryConfig: {
sampler: new AlwaysOnSampler(),
autoInstrumentation: true,
}
}),
],
logLevel: 'debug',
enableTracingAndMetrics: true,
telemetry: {
instrumentation: 'googleCloud',
logger: 'googleCloud',
}
}); You can learn more about the Let me know if this fixes your issue! |
Beta Was this translation helpful? Give feedback.
-
Hey genkit team,
genkit is great. I'm just wondering, if it's possible to receive logs in GCloud Logs in a nicer format when running genkit in a firebase function. Right now, it seems, that all single log lines create a log entry in google cloud. Instead, it would be great to have structured logs, where genkit each log (even if multiline) is reflected as a log entry in GCloud logs. Also the log level is currently not reflected in a meaningful manner (all is "default" log level).
This image demonstrates better what I mean:
Is there a way to achieve structured logs already? That would be great. Looking forward to every hint :)
Beta Was this translation helpful? Give feedback.
All reactions