-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fixbug: Update commandName in RunAndEmitStats #3437
fixbug: Update commandName in RunAndEmitStats #3437
Conversation
@@ -35,30 +35,31 @@ func NewInstrumentedProjectCommandRunner(scope tally.Scope, projectCommandRunner | |||
} | |||
|
|||
func (p *InstrumentedProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult { | |||
return RunAndEmitStats("plan", ctx, p.projectCommandRunner.Plan, p.scope) | |||
return RunAndEmitStats(ctx, p.projectCommandRunner.Plan, p.scope) |
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.
Any chance of adding a unit or e2e test here?
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.
I didn't see this comment, let me check
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.
I don't know how to develop the test 🥺, is there a boilerplate or something I can use as guide, should I just look at other tests?
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.
For now @albertorm95 , please look to other tests for examples.
Then we can create server/events/instrumented_project_command_runner_test.go
and then write a test that will test the output of the RunAndEmitStats
function.
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.
Working on it
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.
@nitrocode I try to develop the code, but it looks like there is a lot of work to do in order to make that NewInstrumentedProjectCommandRunner
or RunAndEmitStats
testable, looks like I need to develop a mock? and then add it to the events.NewPlanCommandRunner()
and same for apply, etc.., I don't feel confident enough to do this
The latest release is already failing because of this. What do you suggest to do in this case?
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.
I'm tempted to merge based on the above comments regarding testing and how you tested end to end.
cc: @GenPage @jamengual thoughts?
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.
I agree
This should fix #3439 |
@pseudomorph Can you test on your end before merging? |
@GenPage - I don't have Prometheus set up. Perhaps @chriskuchin would be able to help test? Is there an image published for this change? |
My only running atlantis instance is the one my team uses. I might be able to roll a test image but if someone has a local setup the prometheus config would just require in the server side yaml. You won't actually need a prometheus server for it to trigger. metrics:
prometheus:
endpoint: "/metrics" |
It's either we merge this or revert #3416. I'm OK with reverting and also OK with merging this. However, we could merge this and it results in another bad build whereas reverting will at least ensure a healthy build. |
Ok let's merge and hope for the best. If not, we can revert both prs |
A new image will be created after this is finished in 20 to 30 mins https://github.com/runatlantis/atlantis/actions/runs/5063551272/jobs/9090284221 @albertorm95 (et al) once the job finishes, the following images will be available. Please give one a try in your setup and confirm it works. Then we can release 0.24.1.
|
done |
what
CommandName.String()
from thectx
instead of fixed string.why
commandName
argument fromRunAndEmitStats
function you can see it clearly in the first commit it was only use forlogger.Err()
commandName
argument in order to fix the previous mention issue and that when we saw the first panic that was cause bypolicy check
string without_
: https://github.com/runatlantis/atlantis/pull/3416/files#diff-161796dd18c10dc19d3513064a1bcc27d4a5e2fc9c2276d82e741aa85f89c79eR63ctx.CommandName.String()
value that already have the correct command names,atlantis/server/events/command/name.go
Lines 59 to 79 in 8e72ab5
tests
Debugging:
![Screenshot 2023-05-23 at 3 44 18 PM](https://private-user-images.githubusercontent.com/8814890/240300395-8f36c8d7-3abd-4257-ab07-a477795ba419.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDMwMDM5NS04ZjM2YzhkNy0zYWJkLTQyNTctYWIwNy1hNDc3Nzk1YmE0MTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjdmYmJlMzhlZjE4Y2NiNDg3YzE2ZDBlODI0ZTU4ODI2OTFjNWE3MDIxNGExODgwODRlZTU4MzgzMTI5NzRhZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.74fhsAsCLpTkj_ki2-hutxvpKvsZkHm9OAPSwsSK2KI)
Before:
policy_check:
and then panic:
![image](https://private-user-images.githubusercontent.com/8814890/240300849-cd416fa9-649c-407b-95fb-fb36d99beb60.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDMwMDg0OS1jZDQxNmZhOS02NDljLTQwN2ItOTVmYi1mYjM2ZDk5YmViNjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTdiY2VjYTZjODM5NWUwMjA0YjljNDZjOWY1N2RiZTJkMWM2ZTJlYmZhMjg5MGQ0N2YxZDViZTM2NGE1NTIzMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.3V7MJT93EFXWmZhNsGjlHd0e2uYgZHh35Ht_UBA4wig)
After:
![Screenshot 2023-05-23 at 3 42 26 PM](https://private-user-images.githubusercontent.com/8814890/240299587-349bee9f-76f5-4173-b535-822b504379a6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDI5OTU4Ny0zNDliZWU5Zi03NmY1LTQxNzMtYjUzNS04MjJiNTA0Mzc5YTYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzY5ZjVhOGFlZWJlN2RkYjMyZTE5M2QzYmQyYzcyYTVkOWY3ZjkwOWY4NmI0N2Q1ZGIzYzI5M2NlMDlhZjRlMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.MKLnVOIGKh-8OQt1O3sNQj1hEGAORAAzE9AOg4su4qo)
plan:
policy_check
![Screenshot 2023-05-23 at 3 42 44 PM](https://private-user-images.githubusercontent.com/8814890/240299680-9db7e0cd-1db9-42ef-b344-c3e328799d8b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDI5OTY4MC05ZGI3ZTBjZC0xZGI5LTQyZWYtYjM0NC1jM2UzMjg3OTlkOGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzYxMDAzN2Y5NDcxN2EyNDJlMzFiNTk5YTdmMjEzZmVlMWU3MjU5ZjY0YjVlOGZjM2UwM2RmNjhmNzZmYWRjNiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.CKlayQECrtu_nr_hnNu4EimYPtjDn2W7aJmSl-LzD4I)
approve_policies
![Screenshot 2023-05-23 at 3 39 40 PM](https://private-user-images.githubusercontent.com/8814890/240298759-e67ee3f7-2477-4592-bcaa-ef02fdd47e30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDI5ODc1OS1lNjdlZTNmNy0yNDc3LTQ1OTItYmNhYS1lZjAyZmRkNDdlMzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OGM1OWQ2MzI4YzRmM2U0ZGI0OWU0ZGQxMmUwMzQzMmM2ZTI0ZTg2YjUzM2NlYTE1NTMzNjFiZjA3NjI1ZmZlYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Ly7dbwjDiNSxcd4_Cesss7l4MHwCQjDk0ALFKy9khuM)
apply
![Screenshot 2023-05-23 at 3 40 33 PM](https://private-user-images.githubusercontent.com/8814890/240299048-598463d6-78a0-4fd6-b2f6-e8419e575383.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDI5OTA0OC01OTg0NjNkNi03OGEwLTRmZDYtYjJmNi1lODQxOWU1NzUzODMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGRjYTVjYmRhMjRlOGY2OTk3OWE1MWEyNTNmYTVhYjZkMzRhZWU2Zjk2NjA0NDdmMzYwYTQ2NzUyNjc2MGQzMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.gEkPVz_FGD6busjb6pF0I98h4iTJNjJXqEYihOTu9Cg)
state or state rm
![Screenshot 2023-05-23 at 3 41 06 PM](https://private-user-images.githubusercontent.com/8814890/240299224-44e4be56-635a-493e-8368-e7e6d06e45ee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzY2MjYsIm5iZiI6MTczOTIzNjMyNiwicGF0aCI6Ii84ODE0ODkwLzI0MDI5OTIyNC00NGU0YmU1Ni02MzVhLTQ5M2UtODM2OC1lN2U2ZDA2ZTQ1ZWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDExMjA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTg1YzUwMWFiNjk0OThiYmJhOWEwOTNiODRkMjlkYjhmYmIwMTY4NDFhNzUxZmVhZWMzMWU5YTJhN2YxZjY2MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.0AV7Lr9R9kkDgZOgyIf6QKTUlH_ZlkVrGyIRs8QakIQ)
Metrics:
Show Metrics
references