Skip to content

Commit

Permalink
Fixed logger
Browse files Browse the repository at this point in the history
  • Loading branch information
chamorin committed Jun 5, 2023
1 parent 88ae034 commit 9edb8f0
Show file tree
Hide file tree
Showing 3 changed files with 437 additions and 287 deletions.
10 changes: 5 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pkg from "./package.json";
import { handleImport } from "./src/victoria_metrics";
import { collectDefaultMetrics, handleClock, handleManifest, handleOperations, setDefaultLabels } from "substreams-sink-prometheus";

logger.defaultMeta = { service: pkg.name };
logger.setName(pkg.name);
export { logger };

// default user options
Expand All @@ -26,17 +26,17 @@ export interface ActionOptions extends RunOptions {

export async function action(manifest: string, moduleName: string, options: ActionOptions) {
// Get command options
const { address, port, scrape_interval} = options;
const { address, port, scrape_interval } = options;
const url = `http://${address}:${port}/api/v1/import/prometheus`

// Set default labels
if ( options.collectDefaultMetrics ) collectDefaultMetrics(options.labels);
if ( options.labels ) setDefaultLabels(options.labels);
if (options.collectDefaultMetrics) collectDefaultMetrics(options.labels);
if (options.labels) setDefaultLabels(options.labels);

// Download substreams
const spkg = await download(manifest);
const hash = createHash(spkg);
logger.info("download", {manifest, hash});
logger.info("download", { manifest, hash });

// Run substreams
const substreams = run(spkg, moduleName, options);
Expand Down
Loading

0 comments on commit 9edb8f0

Please sign in to comment.