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

Adding opencensus metrics #1061

Merged
merged 1 commit into from
May 6, 2021

Conversation

jmcshane
Copy link
Contributor

@jmcshane jmcshane commented Apr 17, 2021

Changes

Adding metrics for eventlisteners

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

Eventlistener OpenCensus metrics

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Apr 17, 2021
@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 17, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.5% -0.0
pkg/sink/metrics.go Do not exist 0.0%

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch 2 times, most recently from 7d4fc69 to b279a23 Compare April 20, 2021 14:09
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 38.1%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane marked this pull request as ready for review April 20, 2021 14:09
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 20, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 38.1%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from b279a23 to af98ff7 Compare April 20, 2021 14:18
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from af98ff7 to b4ac1e2 Compare April 20, 2021 14:29
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from b4ac1e2 to e8a710f Compare April 20, 2021 21:05
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane
Copy link
Contributor Author

jmcshane commented Apr 22, 2021

TODO:

  • Remove metrics port from service due to >1 replicas
  • Ensure metrics container port is set on deployment

docs/eventlistener-metrics.md Outdated Show resolved Hide resolved
ObjectMeta: metav1.ObjectMeta{Name: metrics.ConfigMapName()},
Data: map[string]string{
//TODO: Better nonempty config
"_example": "See tekton-pipelines namespace for valid values",
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we should probably have a more sensible default here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, one thing here is that this is a sensible default in that it will automatically select a prometheus exporter on 9090. It just needs to have one key so that the configmap watcher things the configmap is valid. See what we do for this in the install: https://github.com/tektoncd/triggers/blob/main/config/config-observability.yaml#L24

I could just copy the example value whole hog, but I didn't want to duplicate code too much.

Copy link
Member

Choose a reason for hiding this comment

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

ok, I'd change the message to say See config-observability in tekton-pipelines (or a link to the docs) for valid values

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch 2 times, most recently from 946b475 to 24a60db Compare April 25, 2021 00:15
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from 24a60db to e93bc49 Compare April 25, 2021 00:21
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

}

func (s *Sink) recordResourceCreation(resources []json.RawMessage) {
for _, rt := range resources {
Copy link
Member

Choose a reason for hiding this comment

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

how hard would it be to add some unit tests for the functions in this file? esp. this one to verify that we are adding the right metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely possible, ill take a look

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from e93bc49 to 354c3db Compare May 4, 2021 18:40
@tekton-robot tekton-robot removed the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 4, 2021
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 4, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from 354c3db to b1cef01 Compare May 4, 2021 19:31
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@wlynch wlynch linked an issue May 5, 2021 that may be closed by this pull request
@dibyom
Copy link
Member

dibyom commented May 5, 2021

It looks like this PR now includes a couple of other commits? Could you rebase/squash from main? Otherwise, looks good

This PR creates an initial structure where the eventlistener sink is able
to record metrics about its operation to a recorder that operates based off
the same config structure that the triggers controller uses.

The metrics recorded in this PR are the histogram of HTTP request duration
and the count of resources created by this eventlistener, categorized
by resource kind.
@jmcshane jmcshane force-pushed the feature/eventlistener-metrics branch from b1cef01 to 860b287 Compare May 6, 2021 02:11
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/eventlistener/eventlistener.go 79.5% 79.0% -0.5
pkg/sink/metrics.go Do not exist 78.6%
pkg/sink/sink.go 79.0% 79.2% 0.1

@dibyom
Copy link
Member

dibyom commented May 6, 2021

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2021
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2021
@tekton-robot tekton-robot merged commit 50293ad into tektoncd:main May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Metrics for EventListener
3 participants