logdna / nodejs

Node.js library for logging to LogDNA
MIT License
74 stars 66 forks source link

Listener Leak #95

Closed jontonsoup closed 4 years ago

jontonsoup commented 4 years ago

Hi,

I'm getting a listener leak when I use the logger. I've attached a chrome performance monitor snapshot.

The "ingest" blocks stand for:

image image
import {ConstructorOptions, createLogger, Logger} from "logdna";
import {hostname} from "os";
import {logDNAKey} from "../settings";
import {env} from "./env";

class LogDNALogger {
    private logger: Logger;
    private user: string;
    constructor() {

        const options: ConstructorOptions = {
            app: "live-data-entry-desktop",
            env: env(),
            hostname: hostname(),
        };

        // @ts-ignore
        options.index_meta = true;
        this.logger = createLogger(logDNAKey, options);
    }

    public log(message: string) {
      this.logger.log(message);
    }
}

export const logger = new LogDNALogger();
darinspivey commented 4 years ago

Hi @jontonsoup, thanks for showing us your findings! We are about to release an update to this code that will improve efficiency and clean a few things up (it will be a major despite the changes being somewhat minor in nature). First, a patch release will be going out shortly with 100% test coverage, so that's a good place to start. After the major release, it'd be great if you could re-run your tests to see if the problem still exists. If so, we'll be happy to investigate. Stay tuned!

jontonsoup commented 4 years ago

thanks! Will do.

darinspivey commented 4 years ago

@jontonsoup , our new client has been released. Please refer to the README in our new package, @logdna/logger, and let us know if you still see leaks.

Feel free to open any issues under that new repository. Thanks!