Add copyright notices to all remaining files.

This commit is contained in:
Julius Volz 2013-02-07 11:49:04 +01:00
parent d8c4f2c3c9
commit 16d9dcd6a8
23 changed files with 310 additions and 63 deletions

View file

@ -1,3 +1,16 @@
# Copyright 2013 Prometheus Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
all: parser.y.go lexer.l.go
parser.y.go: parser.y

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View file

@ -1,3 +1,16 @@
/* Copyright 2013 Prometheus Team
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http: *www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. */
%{
package config
%}

View file

@ -216,13 +216,13 @@ func yylex() int {
return 0
}
var S_GLOBAL yystartcondition = 1024
var S_JOB yystartcondition = 1026
var S_GLOBAL_LABELS yystartcondition = 1025
var S_TARGET_LABELS yystartcondition = 1028
var S_COMMENTS yystartcondition = 1029
var S_TARGETS yystartcondition = 1027
var yystartconditionexclmap = map[yystartcondition]bool{S_GLOBAL: false, S_JOB: false, S_GLOBAL_LABELS: false, S_TARGET_LABELS: false, S_COMMENTS: true, S_TARGETS: false, }
var S_GLOBAL_LABELS yystartcondition = 1025
var S_JOB yystartcondition = 1026
var S_TARGET_LABELS yystartcondition = 1028
var S_GLOBAL yystartcondition = 1024
var S_COMMENTS yystartcondition = 1029
var yystartconditionexclmap = map[yystartcondition]bool{S_COMMENTS: true, S_TARGETS: false, S_GLOBAL_LABELS: false, S_JOB: false, S_TARGET_LABELS: false, S_GLOBAL: false, }
var yyrules []yyrule = []yyrule{{regexp.MustCompile("[^\\n]"), nil, []yystartcondition{}, false, func() (yyar yyactionreturn) {
defer func() {
if r := recover(); r != nil {

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
%{
package config

View file

@ -1,11 +1,11 @@
//line parser.y:2
//line parser.y:15
package config
import "fmt"
import "github.com/prometheus/prometheus/model"
import "github.com/matttproud/prometheus/model"
//line parser.y:8
//line parser.y:21
type yySymType struct {
yys int
num model.SampleValue
@ -39,7 +39,7 @@ const yyEofCode = 1
const yyErrCode = 2
const yyMaxDepth = 200
//line parser.y:102
//line parser.y:115
//line yacctab:1
@ -359,61 +359,61 @@ yydefault:
switch yynt {
case 4:
//line parser.y:32
//line parser.y:45
{ PopJob() }
case 7:
//line parser.y:40
//line parser.y:53
{ parsedConfig.Global.SetOption(yyS[yypt-2].str, yyS[yypt-0].str) }
case 8:
//line parser.y:42
//line parser.y:55
{ parsedConfig.Global.SetLabels(yyS[yypt-0].labelSet) }
case 9:
//line parser.y:44
//line parser.y:57
{ parsedConfig.Global.AddRuleFiles(yyS[yypt-0].stringSlice) }
case 10:
//line parser.y:48
//line parser.y:61
{ yyVAL.labelSet = yyS[yypt-1].labelSet }
case 11:
//line parser.y:50
//line parser.y:63
{ yyVAL.labelSet = model.LabelSet{} }
case 12:
//line parser.y:54
//line parser.y:67
{ yyVAL.labelSet = yyS[yypt-0].labelSet }
case 13:
//line parser.y:56
//line parser.y:69
{ for k, v := range yyS[yypt-0].labelSet { yyVAL.labelSet[k] = v } }
case 14:
//line parser.y:60
//line parser.y:73
{ yyVAL.labelSet = model.LabelSet{ model.LabelName(yyS[yypt-2].str): model.LabelValue(yyS[yypt-0].str) } }
case 15:
//line parser.y:64
//line parser.y:77
{ yyVAL.stringSlice = yyS[yypt-0].stringSlice }
case 18:
//line parser.y:72
//line parser.y:85
{ PushJobOption(yyS[yypt-2].str, yyS[yypt-0].str) }
case 19:
//line parser.y:74
//line parser.y:87
{ PushJobTargets() }
case 22:
//line parser.y:82
//line parser.y:95
{ PushTargetEndpoints(yyS[yypt-0].stringSlice) }
case 23:
//line parser.y:84
//line parser.y:97
{ PushTargetLabels(yyS[yypt-0].labelSet) }
case 24:
//line parser.y:88
//line parser.y:101
{ yyVAL.stringSlice = yyS[yypt-0].stringSlice }
case 25:
//line parser.y:92
//line parser.y:105
{ yyVAL.stringSlice = yyS[yypt-1].stringSlice }
case 26:
//line parser.y:94
//line parser.y:107
{ yyVAL.stringSlice = []string{} }
case 27:
//line parser.y:98
//line parser.y:111
{ yyVAL.stringSlice = []string{yyS[yypt-0].str} }
case 28:
//line parser.y:100
//line parser.y:113
{ yyVAL.stringSlice = append(yyVAL.stringSlice, yyS[yypt-0].str) }
}
goto yystack /* stack new state and value */

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View file

@ -1,3 +1,16 @@
# Copyright 2013 Prometheus Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
all: parser.y.go lexer.l.go
parser.y.go: parser.y

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ast
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ast
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ast
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ast
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rules
import (

View file

@ -1,3 +1,16 @@
/* Copyright 2013 Prometheus Team
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http: *www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. */
%{
package rules

View file

@ -10,7 +10,7 @@ import (
"sort"
)
import (
"github.com/prometheus/prometheus/model"
"github.com/matttproud/prometheus/model"
"strconv"
)

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rules
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
%{
package rules

View file

@ -1,12 +1,12 @@
//line parser.y:2
//line parser.y:15
package rules
import "fmt"
import "github.com/prometheus/prometheus/model"
import "github.com/prometheus/prometheus/rules/ast"
import "github.com/matttproud/prometheus/model"
import "github.com/matttproud/prometheus/rules/ast"
//line parser.y:9
//line parser.y:22
type yySymType struct {
yys int
num model.SampleValue
@ -52,7 +52,7 @@ const yyEofCode = 1
const yyErrCode = 2
const yyMaxDepth = 200
//line parser.y:162
//line parser.y:175
//line yacctab:1
@ -381,120 +381,120 @@ yydefault:
switch yynt {
case 5:
//line parser.y:52
//line parser.y:65
{ yylex.(*RulesLexer).parsedExpr = yyS[yypt-0].ruleNode }
case 6:
//line parser.y:56
//line parser.y:69
{
rule, err := CreateRule(yyS[yypt-3].str, yyS[yypt-2].labelSet, yyS[yypt-0].ruleNode, yyS[yypt-4].boolean)
if err != nil { yylex.Error(err.Error()); return 1 }
yylex.(*RulesLexer).parsedRules = append(yylex.(*RulesLexer).parsedRules, rule)
}
case 7:
//line parser.y:64
//line parser.y:77
{ yyVAL.boolean = false }
case 8:
//line parser.y:66
//line parser.y:79
{ yyVAL.boolean = true }
case 9:
//line parser.y:70
//line parser.y:83
{ yyVAL.labelSet = model.LabelSet{} }
case 10:
//line parser.y:72
//line parser.y:85
{ yyVAL.labelSet = yyS[yypt-1].labelSet }
case 11:
//line parser.y:74
//line parser.y:87
{ yyVAL.labelSet = model.LabelSet{} }
case 12:
//line parser.y:77
//line parser.y:90
{ yyVAL.labelSet = yyS[yypt-0].labelSet }
case 13:
//line parser.y:79
//line parser.y:92
{ for k, v := range yyS[yypt-0].labelSet { yyVAL.labelSet[k] = v } }
case 14:
//line parser.y:83
//line parser.y:96
{ yyVAL.labelSet = model.LabelSet{ model.LabelName(yyS[yypt-2].str): model.LabelValue(yyS[yypt-0].str) } }
case 15:
//line parser.y:88
//line parser.y:101
{ yyVAL.ruleNode = yyS[yypt-1].ruleNode }
case 16:
//line parser.y:90
//line parser.y:103
{ yyS[yypt-0].labelSet["name"] = model.LabelValue(yyS[yypt-1].str); yyVAL.ruleNode = ast.NewVectorLiteral(yyS[yypt-0].labelSet) }
case 17:
//line parser.y:92
//line parser.y:105
{
var err error
yyVAL.ruleNode, err = NewFunctionCall(yyS[yypt-3].str, yyS[yypt-1].ruleNodeSlice)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 18:
//line parser.y:98
//line parser.y:111
{
var err error
yyVAL.ruleNode, err = NewFunctionCall(yyS[yypt-2].str, []ast.Node{})
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 19:
//line parser.y:104
//line parser.y:117
{
var err error
yyVAL.ruleNode, err = NewMatrix(yyS[yypt-3].ruleNode, yyS[yypt-1].str)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 20:
//line parser.y:110
//line parser.y:123
{
var err error
yyVAL.ruleNode, err = NewVectorAggregation(yyS[yypt-4].str, yyS[yypt-2].ruleNode, yyS[yypt-0].labelNameSlice)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 21:
//line parser.y:118
//line parser.y:131
{
var err error
yyVAL.ruleNode, err = NewArithExpr(yyS[yypt-1].str, yyS[yypt-2].ruleNode, yyS[yypt-0].ruleNode)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 22:
//line parser.y:124
//line parser.y:137
{
var err error
yyVAL.ruleNode, err = NewArithExpr(yyS[yypt-1].str, yyS[yypt-2].ruleNode, yyS[yypt-0].ruleNode)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 23:
//line parser.y:130
//line parser.y:143
{
var err error
yyVAL.ruleNode, err = NewArithExpr(yyS[yypt-1].str, yyS[yypt-2].ruleNode, yyS[yypt-0].ruleNode)
if err != nil { yylex.Error(err.Error()); return 1 }
}
case 24:
//line parser.y:136
//line parser.y:149
{ yyVAL.ruleNode = ast.NewScalarLiteral(yyS[yypt-0].num)}
case 25:
//line parser.y:140
//line parser.y:153
{ yyVAL.labelNameSlice = []model.LabelName{} }
case 26:
//line parser.y:142
//line parser.y:155
{ yyVAL.labelNameSlice = yyS[yypt-1].labelNameSlice }
case 27:
//line parser.y:146
//line parser.y:159
{ yyVAL.labelNameSlice = []model.LabelName{model.LabelName(yyS[yypt-0].str)} }
case 28:
//line parser.y:148
//line parser.y:161
{ yyVAL.labelNameSlice = append(yyVAL.labelNameSlice, model.LabelName(yyS[yypt-0].str)) }
case 29:
//line parser.y:152
//line parser.y:165
{ yyVAL.ruleNodeSlice = []ast.Node{yyS[yypt-0].ruleNode} }
case 30:
//line parser.y:154
//line parser.y:167
{ yyVAL.ruleNodeSlice = append(yyVAL.ruleNodeSlice, yyS[yypt-0].ruleNode) }
case 31:
//line parser.y:158
//line parser.y:171
{ yyVAL.ruleNode = yyS[yypt-0].ruleNode }
case 32:
//line parser.y:160
//line parser.y:173
{ yyVAL.ruleNode = ast.NewStringLiteral(yyS[yypt-0].str) }
}
goto yystack /* stack new state and value */

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rules
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rules
import (

View file

@ -1,3 +1,16 @@
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rules
import (