Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added publisher and logger package #28

Merged
merged 4 commits into from
Dec 1, 2022

Conversation

Nikhil-Kumar-ML
Copy link
Contributor

Checklist:

  • I have read contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • I have tested these changes locally on my machine.
SUMMARY
  1. Added logger package which provides logging functionality.
  2. Added publisher package which sends data to targets.
COMPONENT NAME

Publisher

ADDITIONAL INFORMATION

Current implementation is not based on original design as Tasks are already running in goroutines so publisher instances need
not run in multiple goroutines.

logger/logger.go Outdated

// default config log timestamp
const (
TimestampFormat = "15:04:05.999 02/01/2006 (MST)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why MST timezone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing it to UTC

Password string `yaml:"password,omitempty" json:"password,omitempty"`

// ES_7x to know if target is elastic version 7.x
ES_7x bool `yaml:"es_7x" json:"es_7x"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this as input? check if you can query to ES to get version and set this flag. sf-trace-server is likely getting the version on the fly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add logic to get version in code itself

ES_7x bool `yaml:"es_7x" json:"es_7x"`
}

// BulkResponse ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add proper comments in all structs

return fmt.Errorf("status code: %d, error: %s", esError.Status, esError.Error.Reason)
}

// getURL returns url to elasticendpoint for writing data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the elastic beats code
https://github.com/elastic/beats/tree/main/libbeat/outputs

There may be some cases like index does not exist or generating index name based on some fields on doc.
Same for Kafkarest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@upendrasahu created an issue #30 for improvement in publisher

@upendra-sahu-ML upendra-sahu-ML merged commit b66aa6d into maplelabs:master Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code Publisher interface
2 participants