This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 356
Add monitoring.json snapshotting #3104
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
traffic_ops/app/db/migrations/20181206000000_create_monitor_snapshots.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| -- +goose Up | ||
| -- SQL in section 'Up' is executed when this migration is applied | ||
|
|
||
| -- snapshots | ||
| ALTER TABLE snapshot ADD COLUMN monitoring json; | ||
| UPDATE snapshot SET monitoring = '{}'; | ||
| ALTER TABLE snapshot ALTER COLUMN monitoring SET NOT NULL; | ||
| ALTER TABLE snapshot RENAME content TO crconfig; | ||
|
|
||
| -- +goose Down | ||
| -- SQL section 'Down' is executed when this migration is rolled back | ||
| ALTER TABLE snapshot DELETE COLUMN monitoring; | ||
| ALTER TABLE snapshot RENAME crconfig TO content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we are just changing the behavior of the end point that TM uses, do you feel that there is value in knowing what the non-snapped Monitor config would look like? Seems to me like we should have two seperate end points, one for the monitoring snapshot and one for the raw monitoring.config file.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does change the behavior, because the existing behavior is fundamentally a bug, and it's never correct to use non-snapshotted data for monitoring.
I think that sounds good in theory, but in practice, I'm very concerned that someone might use the data, and it's always wrong to use it for anything practical. The monitoring data must always be synchronized with the CRConfig snapshot, or the race conditions in #1738 will happen.
But I can see the use case, e.g. for GUIs like the Portal to be able to present a diff. The CRConfig has a "raw" endpoint at
/cdns/{cdn}/snapshot/new. Following that convention, what if we add a new un-snapshotted endpoint atcdns/{cdn}/configs/monitoring/new, and extensively document in the API Documentation, above the route in theroutes.gofile, and a GoDoc comment over the function itself, that it MUST NOT ever be used for any logic decisions, but only for presenting users with a comparison. How does that sound?I understand the use case, but it really worries me if anyone were ever to use it for anything, they'd reintroduce the subtle and dangerous bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think the idea is that at some point we will want to be able to diff what is snapshotted vs what is raw. There could also be some future use cases where the raw data really is desired, I just want to make sure that we keep it available like it is today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dneuman64 would you be good with us opening up a separate issue for that? We were throwing around some ideas like a diff end point instead of a full raw one and things like that, but its a bit out of the scope of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think a new issue is fine.