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

Provide consistent interface for Synthetics Tests API #103

Merged
merged 14 commits into from
Jun 28, 2022
Merged

Provide consistent interface for Synthetics Tests API #103

merged 14 commits into from
Jun 28, 2022

Conversation

danielfurman
Copy link
Contributor

@danielfurman danielfurman commented Jun 1, 2022

GetTestResults() and GetTestTrace() methods will be implemented in next PR.

Based-on: #104
Issue: KNTK-399

@danielfurman danielfurman marked this pull request as ready for review June 23, 2022 13:25
Copy link
Contributor

@mmac-m3a mmac-m3a left a comment

Choose a reason for hiding this comment

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

I'd like to get your feedback to my comments before merging the code. The code is good to go in as long as we've tickets for:

  • support for labels for tests and agents
  • support for passing edate in TestUpdate requests

examples/synthetics_example_test.go Outdated Show resolved Hide resolved
examples/synthetics_example_test.go Show resolved Hide resolved
examples/synthetics_example_test.go Show resolved Hide resolved
examples/synthetics_example_test.go Outdated Show resolved Hide resolved
examples/synthetics_example_test.go Outdated Show resolved Hide resolved
kentikapi/internal/synthetics/test.go Show resolved Hide resolved
kentikapi/internal/synthetics/test.go Show resolved Hide resolved
Status: syntheticspb.TestStatus(syntheticspb.TestStatus_value[string(t.Status)]),
Settings: ts,
Cdate: nil, // read-only
Edate: nil, // read-only
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to support the ability to provide edate in TestUpdate requests. If provided, the API returns error if the object to be modified has been modified in the DB after the edate timestamp. This allows to guard against concurrent modifications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: faa5fc9

kentikapi/internal/synthetics/test.go Show resolved Hide resolved
kentikapi/synthetics/test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mateuszmidor mateuszmidor 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, minor comments left

@mmac-m3a
Copy link
Contributor

godot days: Error: Comment should end in a period (godot)... Like anybody was waiting for him to days that :-).

Copy link
Contributor

@mmac-m3a mmac-m3a left a comment

Choose a reason for hiding this comment

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

Getting ever better.

@@ -55,9 +70,10 @@ func demonstrateSyntheticsAgentAPI() error {
fmt.Println("Number of agents:", len(getAllResp.Agents))
fmt.Println("Number of invalid agents:", getAllResp.InvalidAgentsCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

That should be printed in large blinking red, if the value is non-zero :). The number is actually of any use for Kentik engineers. A non-zero value indicates some bug in the Kentik system. Let's print it only if it is non-zero and add text suggesting to contact Kentik support. Something like: Kentik API returned <N> invalid agents. Please, contact Kentik support..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: 061b51c
Skipped the blinking red part ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And fixed again: e9566f4

examples/synthetics_example_test.go Show resolved Hide resolved
fmt.Println("Number of invalid tests:", getAllResp.InvalidCount)
fmt.Println()
fmt.Println("Number of tests:", len(getAllResp.Tests))
fmt.Println("Number of invalid tests:", getAllResp.InvalidTestsCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

Like for agents, this number is of any use only to Kentik engineers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: e9566f4

return fmt.Errorf("client.Synthetics.GetAllAgents: %w", err)
}

dualIPRustAgentID, err := pickDualIPRustAgentID(getAllResp.Agents)
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering that the goal of the example is to demonstrate the Go SDK (as opposed to test the Kentik API), let's use only IPv4 agents and tests. The reason for this is that the API is little bit behind the development of the Kentik synthetics system, and it currently cannot reliably represent dual stacked agents (it has no place to show the "other" IP address. Which one (v4 or v6) of addresses is shown in the ip (and also local_ip) property is undefined. The system internally (since about 2 months ago) does the right thing, but it is not visible in the API. The visible behavior may confuse more detailed oriented customers :).

We can add examples of choosing dual stack agents and picking protocol family in the test once the API catches up and we add support for new fields in the SDK.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that soon (PR is pending review) node.js (ksynth-agent) agents will be allowed to run any synthetic test. Rust (ksynth) agents will never be able to run page-load and transaction tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified example to use IPv4 agents: 695420c
Let us know when changes to agents arrive: we'll update docstrings and simplify TestDemonstrateSyntheticsTestsAPI_CreateMinimalTests

examples/synthetics_example_test.go Show resolved Hide resolved
@danielfurman
Copy link
Contributor Author

@mateuszmidor @mmac-m3a All comments addressed

examples/synthetics_example_test.go Show resolved Hide resolved
examples/synthetics_example_test.go Show resolved Hide resolved
@mmac-m3a mmac-m3a merged commit f7e48af into kentik:dev_grpc Jun 28, 2022
@danielfurman danielfurman deleted the synth-tests-transformation branch June 29, 2022 07:06
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