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

add agent point #154

Merged
merged 6 commits into from
Sep 5, 2022
Merged

Conversation

mat1e
Copy link
Member

@mat1e mat1e commented Aug 18, 2022

Link to #150

Add agent_point with :

  • agent_name : name of the agent
  • agent_label : label of the agent

@asimell
Copy link
Contributor

asimell commented Aug 29, 2022

I feel like adding a completely new measurement is a slight overkill for effectively 1 new metric (build_agent_name is already available in jenkins_data). What is the benefit of this new measurement compared to just adding the agent label as a new metric for jenkins_data as well? And is there any other relevant data one could collect from the agent other than the name and label? I'm having a hard time grasping what is the overall use case of having such a tiny measurement.

@mat1e
Copy link
Member Author

mat1e commented Aug 29, 2022

In agent_datas, you can find all agents called by the pipeline. I tried to get others informations like the time the build use the agent but I didn't find a way to get it yet. Because the agents are already removed (in case of cloud agents). For now the only benefit is to have all agents names and label used by a pipeline.

@asimell
Copy link
Contributor

asimell commented Aug 30, 2022

Could you also add unit tests to demonstrate this behaviour? Currently the tests only test with one agent, which is exactly the same behaviour as the build_agent_name in jenkins_data. What this looks like to me is that you're writing multiple points on the same timestamp, which in InfluxDB results into overwriting data. For example, with RobotFrameworkPointGenerator we need to manually set the timestamp, so that data is not overwritten and I think something similar is needed here.

@mat1e
Copy link
Member Author

mat1e commented Aug 30, 2022

Could you also add unit tests to demonstrate this behaviour? Currently the tests only test with one agent, which is exactly the same behaviour as the build_agent_name in jenkins_data. What this looks like to me is that you're writing multiple points on the same timestamp, which in InfluxDB results into overwriting data. For example, with RobotFrameworkPointGenerator we need to manually set the timestamp, so that data is not overwritten and I think something similar is needed here.

You're right, we just tested and datas are overwrited... I will do the modifications.

@asimell
Copy link
Contributor

asimell commented Aug 31, 2022

The plugin contains a class called TimeGenerator, which you can use to iterate 1 nanosecond onwards to get a different timestamp, so the easiest way to avoid data overwrite would be to do something like this

TimeGenerator generator = new TimeGenerator(timestamp);
for (...) {
    long time = generator.next();
    Point point = BuildPoint("measurement", customPrefix, build, time)
   ...;
}

@mat1e
Copy link
Member Author

mat1e commented Aug 31, 2022

The plugin contains a class called TimeGenerator, which you can use to iterate 1 nanosecond onwards to get a different timestamp, so the easiest way to avoid data overwrite would be to do something like this

TimeGenerator generator = new TimeGenerator(timestamp);
for (...) {
    long time = generator.next();
    Point point = BuildPoint("measurement", customPrefix, build, time)
   ...;
}

It is not good with an unique_id ? I don't want to corrupt the datas...

@asimell
Copy link
Contributor

asimell commented Aug 31, 2022

A unique ID tag works as well. Just pointing out a solution for not reinventing the wheel, but you had already done your own solution. 😊

doc/available_metrics.md Outdated Show resolved Hide resolved
@HabibMAALEM
Copy link

A unique ID tag works as well. Just pointing out a solution for not reinventing the wheel, but you had already done your own solution. 😊

A unique_id tag such an incremental number is suitable for this case (especially for performance), example :

unique_id=1
unique_id=2

Copy link
Contributor

@asimell asimell left a comment

Choose a reason for hiding this comment

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

LGTM

@asimell asimell merged commit 1e80fd7 into jenkinsci:development Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants