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

Technical/gh 297 update metrics #569

Merged
merged 49 commits into from
Jan 20, 2020
Merged

Conversation

adidanes
Copy link
Contributor

@adidanes adidanes commented Dec 6, 2019

Pull Request description

Description of the change

What I did

Upgrade armon/go-metrics to v0.30.
Redefine Yorc metrics names. Also use labels.
Update Yorc Telemetry chapter in Yorc documentation.

How I did it

In case of metrics that are identified by a name + some labels, I replaced the previousely called go-metrics function calls by the their variant that supports labels.
For example :
metrics.IncrCounter([]string{"name-part1", "name-part2", "status"}), 1)
replaces by
metrics.IncrCounterWithLabels(([]string{"name-part1", "name-part2"}), 1, lablels)
where
labels contain a label with Name = "status" and Value = getStatus()

How to verify it

Yorc telemetry config:
"telemetry": { "service_name": "myyorc", "disable_hostname": true, "disable_go_runtime_metrics": true, "expose_prometheus_endpoint": true }

Deploy an application.

Check for metrcis on Yorc endpoint:

$ curl --noproxy '*' -v -H "Content-Type: application/json" "http://localhost:8800/metrics
Example of metrics:
myyorc_http_duration_sum{method="GET",path="metrics"} 222.54512375593185
myyorc_http_duration_count{method="GET",path="metrics"} 68
myyorc_http_total{method="GET",path="deployments",status="0"} 1

Install and start Prometheus with scrape config:
scrape_configs section in prometheus.yml config file:

  • job_name: 'yorc'
    static_configs:
    • targets: ['localhost:8800']

Check for metrcis on endpoint exposed for Prometheus:

$ curl --noproxy '*' -v -H "Content-Type: application/json" "http://localhost:9090/metrics

or execute a query in Prometheus console, for example:
myyorc_http_total

Description for the changelog

Applicable Issues

#297

#507

@adidanes adidanes self-assigned this Dec 17, 2019
@@ -33,15 +33,17 @@ type pool struct {
mu sync.Mutex
}

// Open starts a new SSH session on the given server, reusing
const SSH_CONNECTION_POOL = "ssh-connections-pool"
Copy link

Choose a reason for hiding this comment

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

don't use ALL_CAPS in Go names; use CamelCase

helper/sshutil/session_pool.go Outdated Show resolved Hide resolved
@codeclimate
Copy link

codeclimate bot commented Jan 16, 2020

Code Climate has analyzed commit a93fa42 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Contributor

@laurentganne laurentganne left a comment

Choose a reason for hiding this comment

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

Looks good !

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

60.9% 60.9% Coverage
0.0% 0.0% Duplication

@adidanes adidanes merged commit 3e651d4 into develop Jan 20, 2020
@laurentganne laurentganne deleted the technical/GH-297-update-metrics branch October 14, 2020 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants