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

Homogenize logs #1168

Merged
merged 16 commits into from
Jul 8, 2019
Merged

Homogenize logs #1168

merged 16 commits into from
Jul 8, 2019

Conversation

anyasabo
Copy link
Contributor

Part of resolving #305

  • Moves all logs to either Info or Debug (V(1)).

  • Standardizes on using namespace and name fields where appropriate for easy searching of logs

  • Removes any use of Info(fmt.Sprintf())

  • Small refactor: removes unnecessary resource parameter in reconcileFinalizers()

@thbkrkr
Copy link
Contributor

thbkrkr commented Jul 1, 2019

Nice work! I like the standardization on using namespace and name. I have a small fear that this leads to confusion in some cases. For example it can be the name of an Elasticsearch cluster, a pod or a secret and sometimes for me it will be not clear. I'm wondering if we should add a kind field or be explicit by adding a prefix to the name field (pod_name, secret_name, es_name)?

@anyasabo
Copy link
Contributor Author

anyasabo commented Jul 1, 2019

I can see the prefix making sense since some things might have more than one relevant item (e.g. you might want to log the ES cluster name and the pod name in the same message), so a separate kind item might not be clear

@thbkrkr thbkrkr mentioned this pull request Jul 1, 2019
5 tasks
opts.MetricsBindAddress = fmt.Sprintf(":%d", metricsPort)
log.Info(fmt.Sprintf("Exposing Prometheus metrics on /metrics%s", opts.MetricsBindAddress))
}
log.Info("Exposing Prometheus metrics on /metrics", "port", metricsPort)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is changing the behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah you're right, this was sloppy. That said I wonder if we do just want to set a default port (probably 80?) and always expose prometheus metrics

@@ -101,6 +101,8 @@ func (p *Process) updateState(action string, signal syscall.Signal, lastErr erro

err := p.state.Write()
if err != nil {
// TODO (sabo): is this necessary? seems helpful since it will be structured and easier to parse than an exit message
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, I think we can keep it

@@ -201,7 +201,7 @@ func buildCAFromSecret(caInternalSecret corev1.Secret) *CA {
}
privateKey, err := ParsePEMPrivateKey(privateKeyBytes)
if err != nil {
log.Info("Cannot parse PEM private key from CA secret, will create a new one", "err", err)
log.Error(err, "Cannot parse PEM private key from CA secret]")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the ] a typo here?
Also, I liked the "will create a new one" part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had removed the "will create a new one" because this function isn't doing that. This is just returning a CA if it can, or returning nil if it can't.

@anyasabo anyasabo changed the title Homogenize logs [WIP] Homogenize logs Jul 4, 2019
Jon Sabo added 2 commits July 4, 2019 12:39
@anyasabo anyasabo changed the title [WIP] Homogenize logs Homogenize logs Jul 4, 2019
@anyasabo
Copy link
Contributor Author

anyasabo commented Jul 4, 2019

This is ready for re-review, I think I addressed your all's comments and added prefixes where necessary.

@thbkrkr
Copy link
Contributor

thbkrkr commented Jul 4, 2019

More than 3 and it's perfect. Thank you for doing this job a bit ungrateful.

@@ -67,7 +67,7 @@ func (b Builder) InitTestSteps(k *test.K8sClient) test.StepList {
return err
}
if err == nil {
return fmt.Errorf("elasticsearch %s is still there", b.Elasticsearch.Name)
return fmt.Errorf("elasticsearch %s is still there", k8s.ExtractNamespacedName(&stack.Elasticsearch))
Copy link
Contributor

@thbkrkr thbkrkr Jul 8, 2019

Choose a reason for hiding this comment

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

CI reported:

test/e2e/test/elasticsearch/steps_init.go:70:87: undefined: stack

PR #1170 did a massive refactoring of E2E tests, in particular to remove the stack concept. So the stack Stack became a b Builder.

Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

LGTM!
It remains one small bit to change related to the #1170 refactoring.

@anyasabo anyasabo merged commit 11b8614 into elastic:master Jul 8, 2019
@anyasabo anyasabo deleted the debuglogs branch July 8, 2019 18:57
sebgl added a commit that referenced this pull request Jul 12, 2019
* Support for APM server configuration (#1181)

* Add a config section to the APM server configuration

* APM: Add support for keystore

* Factorize ElasticsearchAuthSettings

* Update dev setup doc + fix GKE bootstrap script (#1203)

* Update dev setup doc + fix GKE bootstrap script

* Update wording of container registry authentication

* Ensure disks removal after removing cluster in GKE (#1163)

* Update gke-cluster.sh

* Implement cleanup for unused disks in GCP

* Update Makefile

* Update CI jobs to do proper cleanup

* Normalize the raw config when creating canonical configs (#1208)

This aims at counteracting the difference between JSON centric serialization and the use of YAML as the serialization format in canonical config. If not normalizing numeric values
like 1 will differ when comparing configs as JSON deserializes integer numbers to float64 and YAML to uint64.

* Homogenize logs (#1168)

* Don't run tests if only docs are changed (#1216)

* Update Jenkinsfile

* Simplify notOnlyDocs()

* Update Jenkinsfile

* Push snapshot ECK release on successful PR build (#1184)

* Update makefile's to support snapshots

* Add snapshot releases to Jenkins pipelines

* Cleanup

* Rename RELEASE to USE_ELASTIC_DOCKER_REGISTRY

* Update Jenkinsfile

* Add a note on EKS inbound traffic & validating webhook (#1211)

EKS users must explicitly enable communication from the k8s control
plane and nodes port 443 in order for the control plane to reach the
validating webhook.

Should help with #896.

* Update PodSpec with Hostname from PVC when re-using (#1204)

* Bind the Debug HTTP server to localhost by default (#1220)

* Run e2e tests against custom Docker image (#1135)

* Add implementation

* Update makefile's

* Update Makefile

* Rename Jenkisnfile

* Fix review comments

* Update e2e-custom.yml

* Update e2e-custom.yml

* Return deploy-all-in-one to normal

* Delete GKE cluster only if changes not in docs (#1223)

* Add operator version to resources (#1224)

* Warn if unsupported distribution (#1228)

The operator only works with the official ES distributions to enable the security
available with the basic (free), gold and platinum licenses in order to ensure that
all clusters launched are secured by default.

A check is done in the prepare-fs script by looking at the existence of the
Elastic License. If not present, the script exit with a custom exit code.

Then the ES reconcilation loop sends an event of type warning if it detects that
a prepare-fs init container terminated with this exit code.

* Document Elasticsearch update strategy change budget & groups (#1210)

Add documentation for the `updateStrategy` section of the Elasticsearch
spec.

It documents how (and why) `changeBudget` and `groups` are used by ECK,
and how both settings can be specified by the user.
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.

4 participants