Comments (3)
An alternative would be to make snappy
an optional dependency of this package, and if it is not available at runtime switch the transport protocol from protobuf to JSON.
from winston-loki.
I think this kind of fallback is problematic, since in Loki the default port used for protobuf is different from the JSON port (9095 vs 3100).
Lines 50 to 60 in a554797
If protobuf transport is configured and snappy not found you will enter the catch-block here and end up trying to send JSON to the grpc endpoint, which will silently fail. Better fail fast and throw an exception (or don't catch in the first place).
Having snappy as an optional dependency still makes perfectly sense for the case that JSON transport is configured explicitly.
from winston-loki.
True, good suggestion with the optionality.
Since it is a must-have when using protobuf transport, there's no real option when doing that. The protobuf implementation was meant to be a bit of a proof of concept at first, but then it became the default since it got so much love from me.
The JSON part of things needs to be better for sure.
from winston-loki.
Related Issues (20)
- Publish debug informations through the `debug` package
- Enable `replaceTimestamp` by default HOT 1
- Winston-loki not working with Grafana Cloud Loki HOT 3
- I cannot start project HOT 1
- use Symbol.for('level') when extracting label HOT 1
- useCustomFormat is broken
- Race condition in batching leading to lost logs HOT 1
- QUESTION: How many log levels are supported? HOT 2
- Feature Request: awaitable finishRequests method
- TypeError: winston_loki_1.default is not a constructor HOT 2
- Remote Loki HOT 1
- Possible to quit the batcher loop ASAP when closing? HOT 1
- [patch] A method to wait until all the logs are physically sent to winston HOT 3
- Docs: Add a section to explain how to make it work with nextjs and/or webpack HOT 5
- Snappy optionalDependency upgrade breaks build HOT 2
- CVE-2023-36665 protobufjs Dependency HOT 3
- Childlogger with additional labels
- NodeJS crash when batching is enabled
- Segmentation fault with swc & vitest in github action ubuntu-latest when using version 6.0.7
- Documentation improvement ideas
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winston-loki.