Skip to content

Conversation

@dprotaso
Copy link
Member

  • include observability package
  • go mod changes
  • commit vendor

@knative-prow knative-prow bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 25, 2025
@dprotaso
Copy link
Member Author

/hold for review

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 25, 2025
@dprotaso dprotaso requested a review from skonto June 25, 2025 12:58
@knative-prow knative-prow bot requested review from aslom and creydr June 25, 2025 12:58
@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2025
@dprotaso
Copy link
Member Author

/assign @Cali0707 @evankanderson @skonto

@dprotaso
Copy link
Member Author

Follow up PRs are split up for review

webhook - #3189
sharedmain - #3190

@dprotaso
Copy link
Member Author

new OTel libs were cut today - I just bumped them

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 84.98099% with 79 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@fe85a65). Learn more about missing BASE report.
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
observability/metrics/provider.go 67.90% 20 Missing and 6 partials ⚠️
observability/tracing/provider.go 76.66% 16 Missing and 5 partials ⚠️
observability/metrics/metricstest/assert.go 82.35% 12 Missing ⚠️
observability/config.go 67.85% 6 Missing and 3 partials ⚠️
observability/metrics/prometheus/server.go 92.85% 4 Missing ⚠️
observability/attributekey/key.go 88.88% 3 Missing ⚠️
observability/metrics/prometheus_enabled.go 88.00% 2 Missing and 1 partial ⚠️
observability/metrics/config.go 97.14% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3188   +/-   ##
=======================================
  Coverage        ?   75.96%           
=======================================
  Files           ?      205           
  Lines           ?    11690           
  Branches        ?        0           
=======================================
  Hits            ?     8880           
  Misses          ?     2539           
  Partials        ?      271           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +65 to +67
return Config{
Protocol: ProtocolNone,
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we default the export interval?

Copy link
Member

Choose a reason for hiding this comment

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

I think 0 for "do the right thing" makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we should allow "" to mean either "prometheus" or "none" (i.e. make empty string an acceptable value)...

Copy link
Member Author

Choose a reason for hiding this comment

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

either "prometheus" or "none"

I think that would cause confusion since it's not explicit

Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

I'm assuming there's a future PR that adds interfaces for recording metrics, traces, etc, along with examples of usage.

Copy link
Member

Choose a reason for hiding this comment

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

Why not put this in the observability package directly (what users are going to use that package, but not configmap.Parse())?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to keep k8s api deps out of this since it includes a lot of types.

We'll be able to reduce queue proxy binary size: knative/serving#9957 (comment)

return &ProfilingServer{
ProfilingHandler: h,
Server: &http.Server{
Addr: ":" + port,
Copy link
Member

Choose a reason for hiding this comment

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

For metrics / prometheus, you allow setting the listen address, but you don't here. Intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not intentional - just moving the existing profile server from metrics package into a separate one here.

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
ctx := context.Background()
_, err := NewMeterProvider(ctx, tc.c)
Copy link
Member

Choose a reason for hiding this comment

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

If you set Endpoint for Prometheus (at least), you'll get a bit of extra code coverage. (You may also want to .validate() your configs.)

Copy link
Member Author

@dprotaso dprotaso Jun 26, 2025

Choose a reason for hiding this comment

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

let me add a test for prometheus endpoint. (done)

You may also want to .validate() your configs.)

Can you clarify? Are you asking I call Validate on the cfg that's passed to NewMeterProvider?

@dprotaso
Copy link
Member Author

flake - metrics: TestMetricsExport/OpenCensus

/retest

@dprotaso
Copy link
Member Author

I'm assuming there's a future PR that adds interfaces for recording metrics, traces, etc, along with examples of usage.

Actually I don't think we need this - we can just use OTel libraries - see this diff on how I added a custom metric to the webhook. 8b5f38b

Copy link
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/approve


var globalViews map[string][]metric.View = make(map[string][]metric.View)

// Register should be called during package init
Copy link
Member

Choose a reason for hiding this comment

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

Is go package init order guaranteed to be single-threaded?

If not, you may need to lock this map or use an atomic map.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah the spec has

https://go.dev/ref/spec#Package_initialization

followed by calling all init functions in the order they appear in the source, possibly in multiple files, as presented to the compiler.

Then in https://go.dev/ref/spec#Program_initialization

Package initialization—variable initialization and the invocation of init functions—happens in a single goroutine, sequentially, one package at a time.

@knative-prow
Copy link

knative-prow bot commented Jun 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, evankanderson

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

The pull request process is described here

Details 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

@evankanderson
Copy link
Member

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2025
@dprotaso
Copy link
Member Author

/hold cancel

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 26, 2025
@knative-prow knative-prow bot merged commit 5e2512c into knative:main Jun 26, 2025
52 of 54 checks passed
@dprotaso dprotaso deleted the observability branch June 26, 2025 04:05
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. 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.

4 participants