diff options
author | Chris Baumbauer <cab@cabnetworks.net> | 2019-04-06 02:02:39 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-04-06 02:02:39 +0000 |
commit | b77fe7db3e885edca14c862f362e2bbd43f0e498 (patch) | |
tree | cd984b8bb900a6b3e37c8f6106101ba8617bf524 /app/models/serverless | |
parent | 8e33e7cf474b61bbc684d993d86cb5aa775a01d0 (diff) | |
download | gitlab-ce-b77fe7db3e885edca14c862f362e2bbd43f0e498.tar.gz |
Add Knative metrics to Prometheus
Diffstat (limited to 'app/models/serverless')
-rw-r--r-- | app/models/serverless/function.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/models/serverless/function.rb b/app/models/serverless/function.rb new file mode 100644 index 00000000000..5d4f8e0c9e2 --- /dev/null +++ b/app/models/serverless/function.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Serverless + class Function + attr_accessor :name, :namespace + + def initialize(project, name, namespace) + @project = project + @name = name + @namespace = namespace + end + + def id + @project.id.to_s + "/" + @name + "/" + @namespace + end + + def self.find_by_id(id) + array = id.split("/") + project = Project.find_by_id(array[0]) + name = array[1] + namespace = array[2] + + self.new(project, name, namespace) + end + end +end |