Skip to content

Adding Takipi agent framework#472

Closed
chook wants to merge 4 commits into
cloudfoundry:masterfrom
chook:takipi-agent
Closed

Adding Takipi agent framework#472
chook wants to merge 4 commits into
cloudfoundry:masterfrom
chook:takipi-agent

Conversation

@chook

@chook chook commented Jul 25, 2017

Copy link
Copy Markdown
Contributor

Added support for Takipi analytics and root cause analysis tool.
The framework supports both local and remote collector approaches.

Added support for Takipi analytics and root cause analysis tool.
The framework supports both local and remote collector approaches.
@cfdreddbot

Copy link
Copy Markdown

Hey chook!

Thanks for submitting this pull request!

All pull request submitters and commit authors must have a Contributor License Agreement (CLA) on-file with us. Please sign the appropriate CLA (individual or corporate).

When sending signed CLA please provide your github username in case of individual CLA or the list of github usernames that can make pull requests on behalf of your organization.

If you are confident that you're covered under a Corporate CLA, please make sure you've publicized your membership in the appropriate Github Org, per these instructions.

Once you've publicized your membership, one of the owners of this repository can close and reopen this pull request, and dreddbot will take another look.

@chook

chook commented Jul 25, 2017

Copy link
Copy Markdown
Contributor Author

signed and sent CLA doc.

@nebhale nebhale self-requested a review July 25, 2017 17:12
@nebhale nebhale self-assigned this Jul 25, 2017
@nebhale nebhale added this to the v4.4 milestone Jul 25, 2017

@nebhale nebhale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a great submission and shouldn't require a huge amount of work to get it merged into the mainline. The one big change is that I'd like to have the framework trigger off the existence of a service who's credential payload exposes connection endpoints and authentication credentials (if necessary). Nearly every other framework could be used an example of how we do this.

I've also taken a look at the agent in your repository and noticed that it does not have a license within it. Anything distributed on the internet should probably have some sort of license that describes what the downloader is allows to do with it. Since there's no license of any kind in there at the moment, I could do pretty much anything with it legally speaking. In order to add the framework to the buildpack (and therefore distribute your agent as part of the offline buildpack), we require a distribution license to be packaged within the agent and liberal enough that all Cloud Foundry distributions can distribute your agent without any additional legal paperwork. As an example, you might look at the license that Contrast Security provides with their agent.

Again, a really great submission that I hope we can get into the buildpack quickly.

Comment thread takipi_agent.yml
@@ -0,0 +1,23 @@
# Cloud Foundry Java Buildpack

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be in config/ directory.


## Logs

Currently, you can get the Takipi agent logs using `cf files` command:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given the ephemeral nature of the filesystem in a container, we recommend that you do not write to, or depend on files on, the filesystem. Any chance that the configuration of the agent when running on Cloud Foundry can be modified so that logs all go to stdout or stderr?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll see what can be done. what about temp state files? we have some of those.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Those should be fine as they only need to live for the lifetime of the container itself. Logs are particularly problematic because you typically need them after something has gone wrong. And when things go wrong, the container is recycled and the filesystem is disposed of. This is why all logging is collected from the console and streamed out to cf logs or a log warehouse like PaperTrail or Splunk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

our logs are internal debug by nature and our users should not deal with them directly.

I opened an internal task to have some sort of "user facing logs" that can adhere to these requirements and live in the STDOUT/STDERR, but I hope this is not a blocker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nope. I’ll leave it to you to issue an updated PR with the feature shows, but keep in mind that any debugging you’ll need to do for customers on CF likely won’t have logs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, i'm leaving it as is for now


# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
def supports?
@configuration['secret_key'] || @configuration['collector_host']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than doing this with explicit configuration, we would prefer to use services. The advantage of services is that they can communicate credentials to an application (and buildpack) without ever exposing them to users. So you'd expect a user to be able to cf create-service takipi && cf bind-service my-app takipi and everything would just configure itself transparently. In the case where a service broker doesn't yet exist, users would create the same service payload manually (cf create-user-provided-service takipi -p '{ "collector_host": "https://..." }' but to the buildpack this appears to be identical to the service broker approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for the detailed explanation. I did see all other agents do that but it kinda breached my cf knowledge so i brute forced my way in using config. I'll try and incorporate the services module and report back if i get stuck

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Absolutely. I've got a call with your team tomorrow, so if you come up against anything we can discuss there. Beyond that, I'm happy to answer any questions you have here or in the Cloud Foundry Slack #java-buildpack channel.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No problem. Switched to services

if @configuration['node_name_prefix'] && !@configuration['node_name_prefix'].empty?
"#{@configuration['node_name_prefix']}-$CF_INSTANCE_INDEX"
else
%q|$(ruby -rjson -e "puts JSON.parse(ENV['VCAP_APPLICATION'])['instance_id']")|

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is really something you want to do. The instance_id is a UUID that is changed for each and every instance (it can also be more directly accessed as $CF_INSTANCE_GUID). This would mean that every instance in a multi-instance deployment would identify itself as a different node. In addition, instances come and go quite regularly (re-balancing, platform upgrades, etc.) and it's very common to see dozens of new instances in a day on many enterprise systems.

I think you might be better off coming with a default node_name_prefix instead and always having a <node_name_prefix>-$CF_INSTANCE_INDEX.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When I previously dealt with PaaS it was Heroku, and there the "node name" was web1..web2 etc...
what is the equivalent CF way of achieving a reasonable name for each container?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The numerical value is $CF-INSTANCE-INDEX and there isn’t really an equivalent to the web part. If you wanted to replicate that kind of behavior, I’d just make node_name_prefix default to web and allow the user to override it. Then with the concatenation, you’d see web-1, web-2 and if a user overrode it task-1, foo-1, etc. That seems reasonable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Vastly simplifies this code as well.

@nebhale nebhale closed this Jul 28, 2017
@nebhale nebhale reopened this Jul 28, 2017
@cfdreddbot

Copy link
Copy Markdown

Hey chook!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

@nebhale

nebhale commented Jul 28, 2017

Copy link
Copy Markdown
Contributor

@chook And it looks like the CLA has gone through now as well. Progressing quite nicely.

@chook

chook commented Jul 28, 2017

Copy link
Copy Markdown
Contributor Author

Awesome. I hope to push fixes later tonight.
What's the policy for review commits with respect to squashing?

chook added 2 commits July 28, 2017 19:06
1. Config file placed correctly.
2. Moved from configuration to service provision
3. Updated tests
4. Added Takipi to list of frameworks in readme
5. Fixed node prefix definition
@chook

chook commented Jul 28, 2017

Copy link
Copy Markdown
Contributor Author

@nebhale 2 more issues on my plate, but I didn't want the review to wait:

  1. License: will be bundled to our next release.
  2. Framework readme copywriting: to better articulate the use of services.

@nebhale

nebhale commented Jul 28, 2017

Copy link
Copy Markdown
Contributor

@chook I'm going to squash all your commits, so if you want to do them before I get there, please do. The GH review system is good enough for me to compare my requested changes to the latest version of the code so there's no problem with you being aggressive about it.

@chook

chook commented Jul 28, 2017

Copy link
Copy Markdown
Contributor Author

i committed my code changes.

1. Readme updates now includes service
2. Change repository url
@nebhale

nebhale commented Jul 31, 2017

Copy link
Copy Markdown
Contributor

@chook Any news on getting a distribution license of some kind into the agent TARs?

@chook

chook commented Aug 1, 2017

Copy link
Copy Markdown
Contributor Author

@nebhale yes. we've added a license as discussed. It should go live with the next release probably on Monday. I'll update

@nebhale

nebhale commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

Copy that. I look forward to getting this in.

@nebhale nebhale modified the milestones: v4.4, v4.5 Aug 4, 2017
@chook

chook commented Aug 7, 2017

Copy link
Copy Markdown
Contributor Author

@nebhale see latest build (4.8.18) of the Takipi agent. It contains a license

@nebhale

nebhale commented Aug 7, 2017

Copy link
Copy Markdown
Contributor

Looks good. I'll work on it now.

nebhale pushed a commit that referenced this pull request Aug 7, 2017
This change adds the Takipi agent framework to the buildpack. This framework
supports both the local and remote collector approaches for using the Takipi
agent.

[#472]
nebhale added a commit that referenced this pull request Aug 7, 2017
This change includes some minor polishing to match project conventions

[#472]
@nebhale

nebhale commented Aug 7, 2017

Copy link
Copy Markdown
Contributor

@chook All merged in. Go ahead and run some tests with it to ensure that you're happy and we'll cut a release late this week or early next week for you.

@chook

chook commented Aug 8, 2017

Copy link
Copy Markdown
Contributor Author

LGTM! Thank you so much.

@nebhale nebhale closed this Aug 8, 2017
@chook

chook commented Aug 16, 2017

Copy link
Copy Markdown
Contributor Author

Hi @nebhale was wondering when can we expect a release.
Also - if a customer wants Takipi, but for buildpacks 3.x, is there a process there?

@nebhale

nebhale commented Aug 16, 2017

Copy link
Copy Markdown
Contributor

There is not. The 3.x line is EOL at this time and all customers have been encouraged to upgrade to the 4.x line for the last couple of months.

@chook

chook commented Aug 17, 2017

Copy link
Copy Markdown
Contributor Author

got it. and what about 4.5 release? any forecast?

@nebhale

nebhale commented Aug 17, 2017

Copy link
Copy Markdown
Contributor

Historically we've released on about a three week cadence, but we don't have a fixed release schedule. At this point it's been two weeks since the last release, so some time in the next week is likely.

ramonskie pushed a commit that referenced this pull request Dec 4, 2025
This change adds the Takipi agent framework to the buildpack. This framework
supports both the local and remote collector approaches for using the Takipi
agent.

[#472]
ramonskie pushed a commit that referenced this pull request Dec 4, 2025
This change includes some minor polishing to match project conventions

[#472]
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